From 80e00c7158067055ec7ceceb144e38a8779724fd Mon Sep 17 00:00:00 2001 From: ngfchl Date: Sun, 19 Jul 2026 12:54:04 +0800 Subject: [PATCH] stabilize mobile sidebar sheet layout --- lib/pages/workspace_page.dart | 141 ++++++++++++++++++---------------- 1 file changed, 73 insertions(+), 68 deletions(-) diff --git a/lib/pages/workspace_page.dart b/lib/pages/workspace_page.dart index 1b95acd..41f4d62 100644 --- a/lib/pages/workspace_page.dart +++ b/lib/pages/workspace_page.dart @@ -371,76 +371,81 @@ class _WorkspacePageState extends ConsumerState { ), padding: EdgeInsets.zero, scrollable: false, - child: Column( - children: [ - Padding( - padding: const EdgeInsets.fromLTRB(12, 12, 12, 8), - child: Row( - children: [ - Expanded( - child: _SegmentButton( - icon: Icons.folder_rounded, - label: '光鸭云盘', - compact: false, - selected: _mode == WorkspaceMode.cloud, - onTap: () { - Navigator.of(sheetContext).pop(); - _changeMode(WorkspaceMode.cloud); - }, - ), + useSafeArea: false, + child: SizedBox.expand( + child: SafeArea( + child: Column( + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(12, 12, 12, 8), + child: Row( + children: [ + Expanded( + child: _SegmentButton( + icon: Icons.folder_rounded, + label: '光鸭云盘', + compact: false, + selected: _mode == WorkspaceMode.cloud, + onTap: () { + Navigator.of(sheetContext).pop(); + _changeMode(WorkspaceMode.cloud); + }, + ), + ), + const SizedBox(width: 6), + Expanded( + child: _SegmentButton( + icon: Icons.movie_rounded, + label: '光鸭影视', + compact: false, + selected: _mode == WorkspaceMode.media, + onTap: () { + Navigator.of(sheetContext).pop(); + _changeMode(WorkspaceMode.media); + }, + ), + ), + ], ), - const SizedBox(width: 6), - Expanded( - child: _SegmentButton( - icon: Icons.movie_rounded, - label: '光鸭影视', - compact: false, - selected: _mode == WorkspaceMode.media, - onTap: () { - Navigator.of(sheetContext).pop(); - _changeMode(WorkspaceMode.media); - }, - ), - ), - ], - ), + ), + const ShadSeparator.horizontal(), + Expanded( + child: _mode == WorkspaceMode.cloud + ? _CloudSidebar( + state: ref.read(fileProvider), + width: width, + onSection: (section) { + Navigator.of(sheetContext).pop(); + ref.read(fileProvider.notifier).setSection(section); + }, + onSettings: () { + Navigator.of(sheetContext).pop(); + _showSettings(context); + }, + onSignOut: () { + Navigator.of(sheetContext).pop(); + ref.read(authProvider.notifier).signOut(); + }, + onTool: (tool) { + Navigator.of(sheetContext).pop(); + _openTool(tool); + }, + ) + : _MediaSidebar( + width: width, + onCreate: () { + Navigator.of(sheetContext).pop(); + MediaLibraryPage.showCreateDialog(context, ref); + }, + onTool: (tool) { + Navigator.of(sheetContext).pop(); + _openTool(tool); + }, + ), + ), + ], ), - const ShadSeparator.horizontal(), - Expanded( - child: _mode == WorkspaceMode.cloud - ? _CloudSidebar( - state: ref.read(fileProvider), - width: width, - onSection: (section) { - Navigator.of(sheetContext).pop(); - ref.read(fileProvider.notifier).setSection(section); - }, - onSettings: () { - Navigator.of(sheetContext).pop(); - _showSettings(context); - }, - onSignOut: () { - Navigator.of(sheetContext).pop(); - ref.read(authProvider.notifier).signOut(); - }, - onTool: (tool) { - Navigator.of(sheetContext).pop(); - _openTool(tool); - }, - ) - : _MediaSidebar( - width: width, - onCreate: () { - Navigator.of(sheetContext).pop(); - MediaLibraryPage.showCreateDialog(context, ref); - }, - onTool: (tool) { - Navigator.of(sheetContext).pop(); - _openTool(tool); - }, - ), - ), - ], + ), ), ), );