diff --git a/packages/neon/lib/src/apps/files/widgets/browser_view.dart b/packages/neon/lib/src/apps/files/widgets/browser_view.dart index 10a307ea..5fa2382e 100644 --- a/packages/neon/lib/src/apps/files/widgets/browser_view.dart +++ b/packages/neon/lib/src/apps/files/widgets/browser_view.dart @@ -141,12 +141,7 @@ class _FilesBrowserViewState extends State { ], 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( diff --git a/packages/neon/lib/src/apps/news/widgets/articles_view.dart b/packages/neon/lib/src/apps/news/widgets/articles_view.dart index 3c06a172..13fd7af8 100644 --- a/packages/neon/lib/src/apps/news/widgets/articles_view.dart +++ b/packages/neon/lib/src/apps/news/widgets/articles_view.dart @@ -41,10 +41,6 @@ class _NewsArticlesViewState extends State { 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(); diff --git a/packages/neon/lib/src/apps/news/widgets/feeds_view.dart b/packages/neon/lib/src/apps/news/widgets/feeds_view.dart index 85fcba06..836bb729 100644 --- a/packages/neon/lib/src/apps/news/widgets/feeds_view.dart +++ b/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, diff --git a/packages/neon/lib/src/apps/news/widgets/folders_view.dart b/packages/neon/lib/src/apps/news/widgets/folders_view.dart index 09b370e9..8270232c 100644 --- a/packages/neon/lib/src/apps/news/widgets/folders_view.dart +++ b/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, ), ), diff --git a/packages/neon/lib/src/apps/notes/widgets/categories_view.dart b/packages/neon/lib/src/apps/notes/widgets/categories_view.dart index b7dab917..13f5a658 100644 --- a/packages/neon/lib/src/apps/notes/widgets/categories_view.dart +++ b/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, ), ), diff --git a/packages/neon/lib/src/apps/notes/widgets/notes_view.dart b/packages/neon/lib/src/apps/notes/widgets/notes_view.dart index 67f73ce8..394fafd2 100644 --- a/packages/neon/lib/src/apps/notes/widgets/notes_view.dart +++ b/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, ), ), diff --git a/packages/neon/lib/src/apps/notifications/pages/main.dart b/packages/neon/lib/src/apps/notifications/pages/main.dart index 39c822cd..1ca33b95 100644 --- a/packages/neon/lib/src/apps/notifications/pages/main.dart +++ b/packages/neon/lib/src/apps/notifications/pages/main.dart @@ -39,12 +39,7 @@ class _NotificationsMainPageState extends State { 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, ), ), diff --git a/packages/neon/lib/src/widgets/custom_listview.dart b/packages/neon/lib/src/widgets/custom_listview.dart index 5b591f39..09df63eb 100644 --- a/packages/neon/lib/src/widgets/custom_listview.dart +++ b/packages/neon/lib/src/widgets/custom_listview.dart @@ -5,7 +5,6 @@ class CustomListView 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 extends StatelessWidget { final List? 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 extends StatelessWidget { ], ExceptionWidget( error, - onRetry: onRetry, + onRetry: onRefresh, ), if (items != null) ...[ for (final item in items!) ...[