Add master-detail layout for Notes and Chat on wide screens
On screens ≥600dp, Notes and Chat show a two-pane layout: - Left pane (300dp): scrollable list with selection highlight - Right pane: inline detail (NoteDetailScreen / ChatScreen) Tapping a list item selects it in wide mode instead of pushing a route. Creating a new conversation on wide screen auto-selects it in the pane. Deleting a selected note/conversation clears the right pane. NoteDetailScreen gains an optional onDeleted callback used by the embedded pane to clear selection rather than call context.pop(). Tasks keep push-based navigation (edit form has save/pop semantics that require a full-screen context). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -8,7 +8,9 @@ import '../../providers/notes_provider.dart';
|
||||
|
||||
class NoteDetailScreen extends ConsumerWidget {
|
||||
final int noteId;
|
||||
const NoteDetailScreen({super.key, required this.noteId});
|
||||
// Provided when embedded in master-detail: called instead of context.pop().
|
||||
final VoidCallback? onDeleted;
|
||||
const NoteDetailScreen({super.key, required this.noteId, this.onDeleted});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@@ -51,7 +53,9 @@ class NoteDetailScreen extends ConsumerWidget {
|
||||
);
|
||||
if (confirm == true) {
|
||||
await ref.read(notesProvider.notifier).delete(noteId);
|
||||
if (context.mounted) context.pop();
|
||||
if (context.mounted) {
|
||||
onDeleted != null ? onDeleted!() : context.pop();
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user