Offline Support
This commit is contained in:
@@ -518,9 +518,15 @@ class _TeamsScreenState extends ConsumerState<TeamsScreen> {
|
||||
}
|
||||
} catch (e) {
|
||||
if (!mounted) return;
|
||||
// ignore: use_build_context_synchronously
|
||||
showErrorSnackBar(context, 'Failed to save team: $e');
|
||||
return;
|
||||
final offline = isOfflineSaveError(e);
|
||||
if (offline) {
|
||||
// ignore: use_build_context_synchronously
|
||||
showSuccessSnackBar(context, 'Team saved offline — will sync when connected.');
|
||||
} else {
|
||||
// ignore: use_build_context_synchronously
|
||||
showErrorSnackBar(context, 'Failed to save team: $e');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ref.invalidate(teamsProvider);
|
||||
@@ -660,9 +666,13 @@ class _TeamsScreenState extends ConsumerState<TeamsScreen> {
|
||||
ref.invalidate(teamMembersProvider);
|
||||
} catch (e) {
|
||||
if (!mounted) return;
|
||||
// ignore: use_build_context_synchronously
|
||||
showErrorSnackBar(ctx, 'Failed to delete team: $e');
|
||||
return;
|
||||
if (isOfflineSaveError(e)) {
|
||||
// ignore: use_build_context_synchronously
|
||||
showSuccessSnackBar(ctx, 'Delete queued offline — will sync when connected.');
|
||||
} else {
|
||||
// ignore: use_build_context_synchronously
|
||||
showErrorSnackBar(ctx, 'Failed to delete team: $e');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user