Skip to content

Commit 393f129

Browse files
committed
add scrollbar for article previews
1 parent 3a795c3 commit 393f129

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/widgets/incrementally_loading_listview.dart

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'dart:async';
2+
import 'package:flutter/material.dart';
23
import 'package:flutter/widgets.dart';
34

45
typedef 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

Comments
 (0)