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, isLoading: files.loading,
error: files.error, error: files.error,
onRetry: () async { onRefresh: widget.bloc.refresh,
await widget.bloc.refresh();
},
onRefresh: () async {
await widget.bloc.refresh();
},
builder: (final context, final widget) => widget, builder: (final context, final widget) => widget,
topScrollingChildren: [ topScrollingChildren: [
Align( 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, items: feeds.data == null ? null : sorted,
isLoading: articles.loading || feeds.loading, isLoading: articles.loading || feeds.loading,
error: articles.error ?? feeds.error, error: articles.error ?? feeds.error,
onRetry: () async {
await widget.bloc.refresh();
await widget.newsBloc.refresh();
},
onRefresh: () async { onRefresh: () async {
await widget.bloc.refresh(); await widget.bloc.refresh();
await widget.newsBloc.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, items: sorted,
isLoading: feeds.loading || folders.loading, isLoading: feeds.loading || folders.loading,
error: feeds.error ?? folders.error, error: feeds.error ?? folders.error,
onRetry: () async { onRefresh: bloc.refresh,
await bloc.refresh();
},
onRefresh: () async {
await bloc.refresh();
},
builder: (final context, final feed) => _buildFeed( builder: (final context, final feed) => _buildFeed(
context, context,
feed, feed,

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

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

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

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

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

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

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

@ -39,12 +39,7 @@ class _NotificationsMainPageState extends State<NotificationsMainPage> {
items: notifications.data, items: notifications.data,
isLoading: notifications.loading, isLoading: notifications.loading,
error: notifications.error, error: notifications.error,
onRetry: () async { onRefresh: widget.bloc.refresh,
await widget.bloc.refresh();
},
onRefresh: () async {
await widget.bloc.refresh();
},
builder: _buildNotification, 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.items,
required this.isLoading, required this.isLoading,
required this.error, required this.error,
required this.onRetry,
required this.onRefresh, required this.onRefresh,
required this.builder, required this.builder,
this.scrollKey, this.scrollKey,
@ -18,7 +17,6 @@ class CustomListView<T> extends StatelessWidget {
final List<T>? items; final List<T>? items;
final bool isLoading; final bool isLoading;
final dynamic error; final dynamic error;
final Function() onRetry;
final Future Function() onRefresh; final Future Function() onRefresh;
final Widget Function(BuildContext, T data) builder; final Widget Function(BuildContext, T data) builder;
final String? scrollKey; final String? scrollKey;
@ -52,7 +50,7 @@ class CustomListView<T> extends StatelessWidget {
], ],
ExceptionWidget( ExceptionWidget(
error, error,
onRetry: onRetry, onRetry: onRefresh,
), ),
if (items != null) ...[ if (items != null) ...[
for (final item in items!) ...[ for (final item in items!) ...[

Loading…
Cancel
Save