I’m using a ListView.builder
inside a Container
with a fixed height in Flutter. However, the scrollbar doesn’t scroll all the way to the bottom of the list. Instead, there is an extra space below the last item, and the scrollbar stops prematurely (see screenshot below).
https://imgur.com/a/JcgITuk
Here’s a simplified version of my code:
class MyListView extends StatelessWidget {
final ScrollController _scrollController = ScrollController();
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
height: 200.0,
color: Colors.white,
child: Stack(
children: [
Scrollbar(
controller: _scrollController,
thumbVisibility: true,
trackVisibility: true,
child: ListView.builder(
controller: _scrollController,
itemCount: 30,
padding: EdgeInsets.zero,
itemBuilder: (BuildContext context, int index) {
return Text("List Item ${index + 1}");
},
),
),
],
),
),
);
}
}
2
Answers
because you listview under the notification bar. you make below the notification bar.
you can fix that use SafeArea.
this Works for me just fine