From 347d294f6e88d652c097b59d8baa06207aac0643 Mon Sep 17 00:00:00 2001 From: GT610 <79314033+GT-610@users.noreply.github.com> Date: Wed, 21 Jan 2026 10:56:39 +0800 Subject: [PATCH] fix: settings page and SSH virtual keys bottom overflow (#1015) * fix: Add SafeArea to the page to prevent content from being obscured Add the SafeArea component to multiple pages to ensure that content is not obscured by the device status bar or navigation bar, thereby enhancing the user experience * fix(ssh page): Fix the issue of the virtual keyboard area being displayed within the security zone Wrap the virtual keyboard area within the SafeArea to prevent it from being obscured by the system UI, and remove any unnecessary bottom padding --- lib/view/page/backup.dart | 2 +- lib/view/page/private_key/list.dart | 2 +- lib/view/page/setting/about.dart | 8 ++++--- lib/view/page/setting/entry.dart | 2 +- lib/view/page/ssh/page/page.dart | 37 ++++++++++++++++------------- 5 files changed, 28 insertions(+), 23 deletions(-) diff --git a/lib/view/page/backup.dart b/lib/view/page/backup.dart index 4ff49ab3..e7318544 100644 --- a/lib/view/page/backup.dart +++ b/lib/view/page/backup.dart @@ -41,7 +41,7 @@ final class _BackupPageState extends ConsumerState with AutomaticKee @override Widget build(BuildContext context) { super.build(context); - return Scaffold(body: _buildBody); + return Scaffold(body: SafeArea(child: _buildBody)); } Widget get _buildBody { diff --git a/lib/view/page/private_key/list.dart b/lib/view/page/private_key/list.dart index aef8a8b7..de7618d1 100644 --- a/lib/view/page/private_key/list.dart +++ b/lib/view/page/private_key/list.dart @@ -23,7 +23,7 @@ class _PrivateKeyListState extends ConsumerState with After @override Widget build(BuildContext context) { return Scaffold( - body: _buildBody(), + body: SafeArea(child: _buildBody()), floatingActionButton: FloatingActionButton( child: const Icon(Icons.add), onPressed: () => PrivateKeyEditPage.route.go(context), diff --git a/lib/view/page/setting/about.dart b/lib/view/page/setting/about.dart index 99ecc04f..c5f2c36e 100644 --- a/lib/view/page/setting/about.dart +++ b/lib/view/page/setting/about.dart @@ -11,9 +11,10 @@ final class _AppAboutPageState extends State<_AppAboutPage> with AutomaticKeepAl @override Widget build(BuildContext context) { super.build(context); - return ListView( - padding: const EdgeInsets.all(13), - children: [ + return SafeArea( + child: ListView( + padding: const EdgeInsets.all(13), + children: [ UIs.height13, ConstrainedBox(constraints: const BoxConstraints(maxHeight: 47, maxWidth: 47), child: UIs.appIcon), const Text('${BuildData.name}\nv${BuildData.build}', textAlign: TextAlign.center, style: UIs.text15), @@ -59,6 +60,7 @@ ${l10n.madeWithLove('[lollipopkit](${Urls.myGithub})')} ''', ).paddingAll(13).cardx, ], + ), ); } diff --git a/lib/view/page/setting/entry.dart b/lib/view/page/setting/entry.dart index 402eb3be..2802f2b1 100644 --- a/lib/view/page/setting/entry.dart +++ b/lib/view/page/setting/entry.dart @@ -98,7 +98,7 @@ class _SettingsPageState extends ConsumerState with SingleTickerPr ), ], ), - body: TabBarView(controller: _tabCtrl, children: SettingsTabs.pages), + body: SafeArea(child: TabBarView(controller: _tabCtrl, children: SettingsTabs.pages)), ); } } diff --git a/lib/view/page/ssh/page/page.dart b/lib/view/page/ssh/page/page.dart index bebe2f76..d2fb61b3 100644 --- a/lib/view/page/ssh/page/page.dart +++ b/lib/view/page/ssh/page/page.dart @@ -268,23 +268,26 @@ class SSHPageState extends ConsumerState } Widget _buildBottom() { - return AnimatedPadding( - padding: _media.viewInsets, - duration: const Duration(milliseconds: 23), - curve: Curves.fastOutSlowIn, - child: Container( - color: _terminalTheme.background, - height: _virtKeysHeight + _media.padding.bottom, - child: Consumer( - builder: (context, ref, child) { - final virtKeyState = ref.watch(virtKeyboardProvider); - final virtKeyNotifier = ref.read(virtKeyboardProvider.notifier); - - // Set the terminal input handler - _terminal.inputHandler = virtKeyNotifier; - - return _buildVirtualKey(virtKeyState, virtKeyNotifier); - }, + return SafeArea( + top: false, + child: AnimatedPadding( + padding: _media.viewInsets, + duration: const Duration(milliseconds: 23), + curve: Curves.fastOutSlowIn, + child: Container( + color: _terminalTheme.background, + height: _virtKeysHeight, + child: Consumer( + builder: (context, ref, child) { + final virtKeyState = ref.watch(virtKeyboardProvider); + final virtKeyNotifier = ref.read(virtKeyboardProvider.notifier); + + // Set the terminal input handler + _terminal.inputHandler = virtKeyNotifier; + + return _buildVirtualKey(virtKeyState, virtKeyNotifier); + }, + ), ), ), );