diff --git a/packages/neon/lib/src/apps/news/dialogs/add_feed.dart b/packages/neon/lib/src/apps/news/dialogs/add_feed.dart index 20af2835..b4833e7e 100644 --- a/packages/neon/lib/src/apps/news/dialogs/add_feed.dart +++ b/packages/neon/lib/src/apps/news/dialogs/add_feed.dart @@ -68,9 +68,7 @@ class _NewsAddFeedDialogState extends State { Center( child: ExceptionWidget( folders.error, - onRetry: () async { - await widget.bloc.refresh(); - }, + onRetry: widget.bloc.refresh, ), ), Center( diff --git a/packages/neon/lib/src/apps/notes/dialogs/create_note.dart b/packages/neon/lib/src/apps/notes/dialogs/create_note.dart index 401613c9..2682ff4e 100644 --- a/packages/neon/lib/src/apps/notes/dialogs/create_note.dart +++ b/packages/neon/lib/src/apps/notes/dialogs/create_note.dart @@ -51,9 +51,7 @@ class _NotesCreateNoteDialogState extends State { Center( child: ExceptionWidget( notes.error, - onRetry: () async { - await widget.bloc.refresh(); - }, + onRetry: widget.bloc.refresh, ), ), Center( diff --git a/packages/neon/lib/src/apps/notes/dialogs/select_category.dart b/packages/neon/lib/src/apps/notes/dialogs/select_category.dart index 1e4b1d66..6a21b7e6 100644 --- a/packages/neon/lib/src/apps/notes/dialogs/select_category.dart +++ b/packages/neon/lib/src/apps/notes/dialogs/select_category.dart @@ -39,9 +39,7 @@ class _NotesSelectCategoryDialogState extends State { Center( child: ExceptionWidget( notes.error, - onRetry: () async { - await widget.bloc.refresh(); - }, + onRetry: widget.bloc.refresh, ), ), Center( diff --git a/packages/neon/lib/src/pages/account_settings.dart b/packages/neon/lib/src/pages/account_settings.dart index aea3b48f..076f49ce 100644 --- a/packages/neon/lib/src/pages/account_settings.dart +++ b/packages/neon/lib/src/pages/account_settings.dart @@ -74,9 +74,7 @@ class AccountSettingsPage extends StatelessWidget { ], ExceptionWidget( userDetails.error, - onRetry: () async { - await _userDetailsBloc.refresh(); - }, + onRetry: _userDetailsBloc.refresh, ), CustomLinearProgressIndicator( visible: userDetails.loading, diff --git a/packages/neon/lib/src/pages/home.dart b/packages/neon/lib/src/pages/home.dart index 162e04ac..612edea8 100644 --- a/packages/neon/lib/src/pages/home.dart +++ b/packages/neon/lib/src/pages/home.dart @@ -254,9 +254,7 @@ class _HomePageState extends State { ] else ...[ ExceptionWidget( capabilities.error, - onRetry: () async { - await _capabilitiesBloc.refresh(); - }, + onRetry: _capabilitiesBloc.refresh, ), CustomLinearProgressIndicator( visible: capabilities.loading, @@ -303,9 +301,7 @@ class _HomePageState extends State { ExceptionWidget( appImplementations.error, onlyIcon: isQuickBar, - onRetry: () async { - await _appsBloc.refresh(); - }, + onRetry: _appsBloc.refresh, ), CustomLinearProgressIndicator( visible: appImplementations.loading, @@ -539,9 +535,7 @@ class _HomePageState extends State { children: [ ExceptionWidget( appImplementations.error, - onRetry: () async { - await _appsBloc.refresh(); - }, + onRetry: _appsBloc.refresh, ), if (appImplementations.data != null) ...[ if (appImplementations.data!.isEmpty) ...[ diff --git a/packages/neon/lib/src/pages/login.dart b/packages/neon/lib/src/pages/login.dart index 142e0d36..04e491da 100644 --- a/packages/neon/lib/src/pages/login.dart +++ b/packages/neon/lib/src/pages/login.dart @@ -66,7 +66,7 @@ class _LoginPageState extends State { for (final a in accountsBloc.accounts.value) { if (a.id == account.id) { ExceptionWidget.showSnackbar(context, AppLocalizations.of(context).errorAccountAlreadyExists); - _loginBloc.setServerURL(result.server); + await _loginBloc.refresh(); return; } } @@ -168,9 +168,7 @@ class _LoginPageState extends State { height: 10, ), ElevatedButton( - onPressed: () { - _loginBloc.setServerURL(serverURLSnapshot.data!); - }, + onPressed: _loginBloc.refresh, child: Text(AppLocalizations.of(context).loginOpenAgain), ), ], @@ -224,17 +222,13 @@ class _LoginPageState extends State { if (serverConnectionStateSnapshot.data == ServerConnectionState.unreachable) ...[ ExceptionWidget( AppLocalizations.of(context).errorUnableToReachServer, - onRetry: () { - _loginBloc.setServerURL(serverURLSnapshot.data); - }, + onRetry: _loginBloc.refresh, ), ], if (serverConnectionStateSnapshot.data == ServerConnectionState.maintenanceMode) ...[ ExceptionWidget( AppLocalizations.of(context).errorServerInMaintenanceMode, - onRetry: () { - _loginBloc.setServerURL(serverURLSnapshot.data); - }, + onRetry: _loginBloc.refresh, ), ], ], diff --git a/packages/neon/lib/src/widgets/account_tile.dart b/packages/neon/lib/src/widgets/account_tile.dart index 6058cb75..45a6623e 100644 --- a/packages/neon/lib/src/widgets/account_tile.dart +++ b/packages/neon/lib/src/widgets/account_tile.dart @@ -71,9 +71,7 @@ class AccountTile extends StatelessWidget { userDetails.error!, onlyIcon: true, iconSize: 24, - onRetry: () async { - await userDetailsBloc.refresh(); - }, + onRetry: userDetailsBloc.refresh, ), ], ],