Commit 3c3991bc by tanghuan

增加Android系统的虚拟按键安全区

1 parent b4b51f0d
...@@ -26,6 +26,12 @@ class App extends StatelessWidget { ...@@ -26,6 +26,12 @@ class App extends StatelessWidget {
theme: ThemeData(primarySwatch: Colors.blue), theme: ThemeData(primarySwatch: Colors.blue),
supportedLocales: AppLocalizations.supportedLocales, supportedLocales: AppLocalizations.supportedLocales,
localizationsDelegates: AppLocalizations.localizationsDelegates, localizationsDelegates: AppLocalizations.localizationsDelegates,
// Android edge-to-edge 模式下虚拟导航键叠在内容上方,
// 通过 builder 统一包裹 SafeArea,所有路由页面自动适配底部安全区域。
builder: (context, child) => ColoredBox(
color: Colors.white,
child: SafeArea(top: false, child: child!),
),
); );
// 全局默认状态栏样式兑底:透明背景 + 深色图标。 // 全局默认状态栏样式兑底:透明背景 + 深色图标。
......
...@@ -45,7 +45,9 @@ class _PreviewMediaPageState extends State<PreviewMediaPage> { ...@@ -45,7 +45,9 @@ class _PreviewMediaPageState extends State<PreviewMediaPage> {
_initialized = true; _initialized = true;
} }
return Scaffold( return ColoredBox(
color: Colors.black,
child: Scaffold(
backgroundColor: Colors.black, backgroundColor: Colors.black,
body: Stack( body: Stack(
children: [ children: [
...@@ -107,7 +109,7 @@ class _PreviewMediaPageState extends State<PreviewMediaPage> { ...@@ -107,7 +109,7 @@ class _PreviewMediaPageState extends State<PreviewMediaPage> {
), ),
if (_items.length > 1) if (_items.length > 1)
Positioned( Positioned(
bottom: MediaQuery.of(context).padding.bottom + 24, bottom: MediaQuery.of(context).viewPadding.bottom + 24,
left: 0, left: 0,
right: 0, right: 0,
child: Center( child: Center(
...@@ -130,6 +132,7 @@ class _PreviewMediaPageState extends State<PreviewMediaPage> { ...@@ -130,6 +132,7 @@ class _PreviewMediaPageState extends State<PreviewMediaPage> {
), ),
], ],
), ),
),
); );
} }
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!