Browse Source

neon: Cleanup list view refreshing

pull/146/head
jld3103 2 years ago
parent
commit
93d27f0cc7
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 7
      packages/neon/lib/src/apps/files/widgets/browser_view.dart
  2. 4
      packages/neon/lib/src/apps/news/widgets/articles_view.dart
  3. 7
      packages/neon/lib/src/apps/news/widgets/feeds_view.dart
  4. 7
      packages/neon/lib/src/apps/news/widgets/folders_view.dart
  5. 7
      packages/neon/lib/src/apps/notes/widgets/categories_view.dart
  6. 7
      packages/neon/lib/src/apps/notes/widgets/notes_view.dart
  7. 7
      packages/neon/lib/src/apps/notifications/pages/main.dart
  8. 4
      packages/neon/lib/src/widgets/custom_listview.dart

7
packages/neon/lib/src/apps/files/widgets/browser_view.dart

@ -141,12 +141,7 @@ class _FilesBrowserViewState extends State<FilesBrowserView> {
],
isLoading: files.loading,
error: files.error,
onRetry: () async {
await widget.bloc.refresh();
},
onRefresh: () async {
await widget.bloc.refresh();
},
onRefresh: widget.bloc.refresh,
builder: (final context, final widget) => widget,
topScrollingChildren: [
Align(

4
packages/neon/lib/src/apps/news/widgets/articles_view.dart

@ -41,10 +41,6 @@ class _NewsArticlesViewState extends State<NewsArticlesView> {
items: feeds.data == null ? null : sorted,
isLoading: articles.loading || feeds.loading,
error: articles.error ?? feeds.error,
onRetry: () async {
await widget.bloc.refresh();
await widget.newsBloc.refresh();
},
onRefresh: () async {
await widget.bloc.refresh();
await widget.newsBloc.refresh();

7
packages/neon/lib/src/apps/news/widgets/feeds_view.dart

@ -45,12 +45,7 @@ class NewsFeedsView extends StatelessWidget {
items: sorted,
isLoading: feeds.loading || folders.loading,
error: feeds.error ?? folders.error,
onRetry: () async {
await bloc.refresh();
},
onRefresh: () async {
await bloc.refresh();
},
onRefresh: bloc.refresh,
builder: (final context, final feed) => _buildFeed(
context,
feed,

7
packages/neon/lib/src/apps/news/widgets/folders_view.dart

@ -47,12 +47,7 @@ class NewsFoldersView extends StatelessWidget {
items: sorted,
isLoading: feeds.loading || folders.loading,
error: feeds.error ?? folders.error,
onRetry: () async {
await bloc.refresh();
},
onRefresh: () async {
await bloc.refresh();
},
onRefresh: bloc.refresh,
builder: _buildFolder,
),
),

7
packages/neon/lib/src/apps/notes/widgets/categories_view.dart

@ -30,12 +30,7 @@ class NotesCategoriesView extends StatelessWidget {
items: sorted,
isLoading: notes.loading,
error: notes.error,
onRetry: () async {
await bloc.refresh();
},
onRefresh: () async {
await bloc.refresh();
},
onRefresh: bloc.refresh,
builder: _buildCategory,
),
),

7
packages/neon/lib/src/apps/notes/widgets/notes_view.dart

@ -60,12 +60,7 @@ class NotesView extends StatelessWidget {
],
isLoading: notes.loading,
error: notes.error,
onRetry: () async {
await bloc.refresh();
},
onRefresh: () async {
await bloc.refresh();
},
onRefresh: bloc.refresh,
builder: _buildNote,
),
),

7
packages/neon/lib/src/apps/notifications/pages/main.dart

@ -39,12 +39,7 @@ class _NotificationsMainPageState extends State<NotificationsMainPage> {
items: notifications.data,
isLoading: notifications.loading,
error: notifications.error,
onRetry: () async {
await widget.bloc.refresh();
},
onRefresh: () async {
await widget.bloc.refresh();
},
onRefresh: widget.bloc.refresh,
builder: _buildNotification,
),
),

4
packages/neon/lib/src/widgets/custom_listview.dart

@ -5,7 +5,6 @@ class CustomListView<T> extends StatelessWidget {
required this.items,
required this.isLoading,
required this.error,
required this.onRetry,
required this.onRefresh,
required this.builder,
this.scrollKey,
@ -18,7 +17,6 @@ class CustomListView<T> extends StatelessWidget {
final List<T>? items;
final bool isLoading;
final dynamic error;
final Function() onRetry;
final Future Function() onRefresh;
final Widget Function(BuildContext, T data) builder;
final String? scrollKey;
@ -52,7 +50,7 @@ class CustomListView<T> extends StatelessWidget {
],
ExceptionWidget(
error,
onRetry: onRetry,
onRetry: onRefresh,
),
if (items != null) ...[
for (final item in items!) ...[

Loading…
Cancel
Save