diff --git a/lib/pages/feed.dart b/lib/pages/feed.dart index e3a9f4b..2e8a9a8 100644 --- a/lib/pages/feed.dart +++ b/lib/pages/feed.dart @@ -18,9 +18,6 @@ class _FeedPageState extends State List newsArticles = []; ArticleProvider articleProvider = ArticleProvider(); TextEditingController searchController = TextEditingController(); - bool isLoading = false; - double loadProgress = 0; - int page = 1; HashMap subscriptionPage = HashMap(); @override @@ -43,7 +40,7 @@ class _FeedPageState extends State ], ), body: FutureBuilder( - future: articleProvider.loadPage(page, query: null), + future: articleProvider.loadPage(1, query: null), builder: (context, snapshot) { if (snapshot.hasData) { return FeedPageBuilder(null, snapshot.data!); diff --git a/lib/pages/feed_builder.dart b/lib/pages/feed_builder.dart index ee79f40..6f0440c 100644 --- a/lib/pages/feed_builder.dart +++ b/lib/pages/feed_builder.dart @@ -21,7 +21,6 @@ class _FeedPageBuilderState extends State { late List newsArticles; late ArticleProvider articleProvider; late bool isLoading; - late double loadProgress; late int page; late GlobalKey _refreshIndicatorKey; @@ -33,7 +32,6 @@ class _FeedPageBuilderState extends State { }); articleProvider = ArticleProvider(); isLoading = false; - loadProgress = 0; page = 1; _refreshIndicatorKey = GlobalKey(); } @@ -42,11 +40,10 @@ class _FeedPageBuilderState extends State { Widget build(BuildContext context) { return RefreshIndicator( key: _refreshIndicatorKey, - strokeWidth: 4.0, onRefresh: () async { setState(() { newsArticles = []; - page = 1; + page = 0; isLoading = true; }); loadMore(); @@ -60,9 +57,7 @@ class _FeedPageBuilderState extends State { itemBuilder: (context, index) { if (index == 0) { return isLoading - ? LinearProgressIndicator( - value: loadProgress, - ) + ? LinearProgressIndicator() : SizedBox.shrink(); } if (index - 1 < newsArticles.length) { @@ -244,9 +239,7 @@ class ArticleThumbnail extends StatelessWidget { SizedBox( height: 200, ), - LinearProgressIndicator( - value: progress.progress, - ) + LinearProgressIndicator() ]), errorWidget: (context, url, error) { return SizedBox.shrink(); diff --git a/lib/pages/search.dart b/lib/pages/search.dart index fa426b1..2b614ab 100644 --- a/lib/pages/search.dart +++ b/lib/pages/search.dart @@ -19,8 +19,6 @@ class _SearchResultsPageState extends State { List newsArticles = []; ArticleProvider articleProvider = ArticleProvider(); bool isLoading = false; - double loadProgress = 0; - int page = 1; @override void initState() { @@ -30,7 +28,7 @@ class _SearchResultsPageState extends State { @override Widget build(BuildContext context) { return FutureBuilder( - future: articleProvider.loadPage(page, query: widget.query), + future: articleProvider.loadPage(1, query: widget.query), builder: (context, snapshot) { if (snapshot.hasData) { return FeedPageBuilder(widget.query, snapshot.data!);