Skip to content

Commit e741ea2

Browse files
committed
feat(feed): improve loading and scroll trigger
- Shorter app bar title - Scroll trigger at 98% - CircularProgressIndicator
1 parent ca6729f commit e741ea2

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

lib/headlines-feed/view/headlines_feed_page.dart

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ class _HeadlinesFeedViewState extends State<_HeadlinesFeedView> {
3434
void initState() {
3535
super.initState();
3636
_scrollController.addListener(_onScroll);
37-
// context.read<HeadlinesFeedBloc>().add(HeadlinesFeedRefreshRequested());
3837
}
3938

4039
@override
@@ -60,14 +59,14 @@ class _HeadlinesFeedViewState extends State<_HeadlinesFeedView> {
6059
if (!_scrollController.hasClients) return false;
6160
final maxScroll = _scrollController.position.maxScrollExtent;
6261
final currentScroll = _scrollController.offset;
63-
return currentScroll >= (maxScroll * 0.9);
62+
return currentScroll >= (maxScroll * 0.98);
6463
}
6564

6665
@override
6766
Widget build(BuildContext context) {
6867
return Scaffold(
6968
appBar: AppBar(
70-
title: const Text('Headlines Feed'),
69+
title: const Text('HT'),
7170
actions: [
7271
BlocBuilder<HeadlinesFeedBloc, HeadlinesFeedState>(
7372
builder: (context, state) {
@@ -135,10 +134,8 @@ class _HeadlinesFeedViewState extends State<_HeadlinesFeedView> {
135134
: state.headlines.length,
136135
itemBuilder: (context, index) {
137136
if (index >= state.headlines.length) {
138-
return const LoadingStateWidget(
139-
icon: Icons.hourglass_empty,
140-
headline: 'Loading...',
141-
subheadline: 'Fetching more headlines',
137+
return const Center(
138+
child: CircularProgressIndicator(),
142139
);
143140
}
144141
final headline = state.headlines[index];

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: ht_main
22
description: main headlines toolkit mobile app.
3-
version: 0.21.0
3+
version: 0.23.0
44
publish_to: none
55
repository: https://github.com/headlines-toolkit/ht-main
66
environment:

0 commit comments

Comments
 (0)