diff --git a/lib/ui/capture_screen.dart b/lib/ui/capture_screen.dart index 58b75e2..956c1d2 100644 --- a/lib/ui/capture_screen.dart +++ b/lib/ui/capture_screen.dart @@ -1,5 +1,6 @@ import 'dart:async'; import 'package:crdt_sync/crdt_sync.dart'; +import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; import 'package:todo/analytics/analytics_event.dart'; @@ -221,6 +222,7 @@ class _CaptureScreenState extends State outcome.ok ? 'Synced: ${outcome.detail}' : 'Sync failed: ${outcome.detail}', + isError: !outcome.ok, ); } finally { if (mounted) setState(() => _syncing = false); diff --git a/lib/ui/capture_screen_sync.dart b/lib/ui/capture_screen_sync.dart index e369ad7..96bc22a 100644 --- a/lib/ui/capture_screen_sync.dart +++ b/lib/ui/capture_screen_sync.dart @@ -64,11 +64,19 @@ extension _CaptureSyncBehaviour on _CaptureScreenState { ); } - void _showSnack(String message) { + /// Shows transient feedback, if this screen is still mounted. + /// + /// Delegates to the shared helpers so the styling and the + /// replace-don't-queue behaviour match every other app; [isError] picks + /// the danger hue and the longer duration, because an error the user + /// missed is an error they will hit again. + void _showSnack(String message, {bool isError = false}) { if (!mounted) return; - ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text(message), duration: const Duration(seconds: 2)), - ); + if (isError) { + showError(context, message); + } else { + showToast(context, message); + } } /// Reloads the persisted last-sync outcome so the status line survives a diff --git a/lib/ui/note_editor.dart b/lib/ui/note_editor.dart index e16a25f..bc70c16 100644 --- a/lib/ui/note_editor.dart +++ b/lib/ui/note_editor.dart @@ -1,3 +1,4 @@ +import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:todo/data/note.dart'; @@ -111,13 +112,9 @@ class _NoteEditorState extends State { case NoteEditorMode.guided: // raw -> guided: only if the edited text still fits the template. if (!_doc.tryAdoptGuided()) { - ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: Text( - "Text doesn't match the template — staying in raw", - ), - duration: Duration(seconds: 2), - ), + showError( + context, + "Text doesn't match the template — staying in raw", ); return; } diff --git a/pubspec.yaml b/pubspec.yaml index 9ecbcb2..f9fe5c4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.0.23+1 +version: 1.0.24+1 environment: sdk: ^3.12.2