fix: 安卓全屏(状态栏/导航栏区域融入界面)+ 保存/导出对话框按类型区分后缀并记忆目录
- 全屏:移除全局 SafeArea,系统栏透明;工具栏/底部状态栏底色延伸填满状态栏与导航栏区域,图标亮度随深浅主题切换(桌面端 padding 为 0 无影响) - 文件对话框:保存/导出按类型区分——工程 .seq.json、导出 .svg / .png(默认名=项目名,目录列表只显示对应后缀文件,输入自动补全/替换后缀) - 路径体验:默认目录改为桌面(移动端为应用目录),并跨会话记忆上次使用的目录;此修复同时作用于 Windows exe 与安卓版
This commit is contained in:
+18
-13
@@ -25,15 +25,9 @@ import 'ui/app_shell.dart';
|
||||
/// 然后启动根组件 [SequenceDiagramApp]。
|
||||
Future<void> main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
// 移动端:沉浸式(edge-to-edge)显示,配合 SafeArea 自动避让系统栏。
|
||||
// 移动端:沉浸式(edge-to-edge)显示,系统栏区域由应用工具栏/状态栏底色填充。
|
||||
if (Platform.isAndroid || Platform.isIOS) {
|
||||
await SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
||||
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
|
||||
statusBarColor: Colors.transparent,
|
||||
systemNavigationBarColor: Colors.transparent,
|
||||
statusBarIconBrightness: Brightness.dark,
|
||||
statusBarBrightness: Brightness.light,
|
||||
));
|
||||
}
|
||||
await Storage.instance.init();
|
||||
runApp(const SequenceDiagramApp());
|
||||
@@ -170,14 +164,25 @@ class _SequenceDiagramAppState extends State<SequenceDiagramApp> {
|
||||
title: '时序图设计器 · Sequence Diagram Studio',
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: buildTheme(tokens),
|
||||
// 固定文本缩放并包裹 SafeArea:保证平板等分辨率下布局像素级精准,
|
||||
// 不受系统字体缩放影响,并自动避让状态栏 / 导航栏。
|
||||
// 固定文本缩放;系统栏图标随主题亮度自动切换(透明系统栏,
|
||||
// 状态栏 / 导航栏区域由 AppShell 的工具栏 / 状态栏底色填满)。
|
||||
builder: (BuildContext context, Widget? child) {
|
||||
return MediaQuery(
|
||||
data: MediaQuery.of(context).copyWith(
|
||||
textScaler: const TextScaler.linear(1.0),
|
||||
final bool dark = Theme.of(context).brightness == Brightness.dark;
|
||||
return AnnotatedRegion<SystemUiOverlayStyle>(
|
||||
value: SystemUiOverlayStyle(
|
||||
statusBarColor: Colors.transparent,
|
||||
statusBarIconBrightness: dark ? Brightness.light : Brightness.dark,
|
||||
statusBarBrightness: dark ? Brightness.dark : Brightness.light,
|
||||
systemNavigationBarColor: Colors.transparent,
|
||||
systemNavigationBarIconBrightness: dark ? Brightness.light : Brightness.dark,
|
||||
systemNavigationBarDividerColor: Colors.transparent,
|
||||
),
|
||||
child: MediaQuery(
|
||||
data: MediaQuery.of(context).copyWith(
|
||||
textScaler: const TextScaler.linear(1.0),
|
||||
),
|
||||
child: child ?? const SizedBox.shrink(),
|
||||
),
|
||||
child: SafeArea(child: child ?? const SizedBox.shrink()),
|
||||
);
|
||||
},
|
||||
home: AppShell(controller: _controller),
|
||||
|
||||
Reference in New Issue
Block a user