11import 'dart:async' ;
2+ import 'package:flutter/material.dart' ;
23import 'package:flutter/widgets.dart' ;
34
45typedef LoadMore = Future Function ();
@@ -39,6 +40,7 @@ class IncrementallyLoadingListView extends StatefulWidget {
3940 final bool addAutomaticKeepAlives;
4041 final bool addRepaintBoundaries;
4142 final double cacheExtent;
43+ final bool useScrollbar;
4244
4345 /// A callback that is triggered when more items are being loaded
4446 final OnLoadMore onLoadMore;
@@ -51,6 +53,7 @@ class IncrementallyLoadingListView extends StatefulWidget {
5153 @required this .loadMore,
5254 this .loadMoreOffsetFromBottom = 0 ,
5355 this .key,
56+ this .useScrollbar = true ,
5457 this .scrollDirection = Axis .vertical,
5558 this .reverse = false ,
5659 this .controller,
@@ -73,6 +76,7 @@ class IncrementallyLoadingListView extends StatefulWidget {
7376 @required this .loadMore,
7477 this .loadMoreOffsetFromBottom = 0 ,
7578 this .key,
79+ this .useScrollbar = true ,
7680 this .scrollDirection = Axis .vertical,
7781 this .reverse = false ,
7882 this .controller,
@@ -158,7 +162,7 @@ class IncrementallyLoadingListViewState
158162 final itemCount =
159163 _isSeparated ? _separatedItemCount () : widget.itemCount ();
160164 final itemBuilder = _isSeparated ? _separatedItemBuilder : _buildItem;
161- return ListView .builder (
165+ final listview = ListView .builder (
162166 key: widget.key,
163167 scrollDirection: widget.scrollDirection,
164168 reverse: widget.reverse,
@@ -174,6 +178,12 @@ class IncrementallyLoadingListViewState
174178 addRepaintBoundaries: widget.addRepaintBoundaries,
175179 cacheExtent: widget.cacheExtent,
176180 );
181+
182+ if (widget.useScrollbar) {
183+ return Scrollbar (child: listview, thickness: 4 ,);
184+ }
185+
186+ return listview;
177187 });
178188 }
179189
0 commit comments