Skip to content

Commit 5c88d60

Browse files
committed
fix(android/ui): keyboard bug at the home page
1 parent cd0a4d5 commit 5c88d60

7 files changed

Lines changed: 68 additions & 46 deletions

File tree

lib/ui/core/scaffold/miru_scaffold.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ class _MiruScaffoldState extends ConsumerState<MiruScaffold> {
187187

188188
return FScaffold(
189189
childPad: widget.childPad,
190+
resizeToAvoidBottomInset: widget.resizeToAvoidBottomInset,
190191
child: CustomScrollView(
191192
controller: scrollController,
192193
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
@@ -261,6 +262,7 @@ class _MiruScaffoldState extends ConsumerState<MiruScaffold> {
261262
return Positioned.fill(
262263
child: FScaffold(
263264
childPad: widget.childPad,
265+
resizeToAvoidBottomInset: widget.resizeToAvoidBottomInset,
264266
child: widget.mobileBody ?? widget.body ?? const SizedBox.shrink(),
265267
),
266268
);

lib/ui/core/widget/miru_dialog.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ class MiruDialog extends StatelessWidget {
6262
child: title!,
6363
),
6464
),
65-
if (body != null) body!, // ignore: use_null_aware_elements
65+
if (body != null)
66+
DefaultTextStyle.merge(
67+
style: dialogStyle.bodyTextStyle,
68+
child: body!,
69+
), // ignore: use_null_aware_elements
6670
if (actions case final a? when a.isNotEmpty)
6771
Padding(
6872
padding: const EdgeInsets.only(top: 16),

lib/ui/features/detail/detail_loading_page.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,12 @@ class _DetailLoadPageState extends ConsumerState<DetailLoadingPage> {
109109
style: TextStyle(
110110
fontWeight: FontWeight.bold,
111111
fontSize: 18,
112-
color: context.theme.colors.primary,
112+
color: Color.alphaBlend(
113+
context.theme.colors.primary.withAlpha(
114+
128,
115+
), // Foreground
116+
context.theme.colors.foreground, // Background
117+
),
113118
),
114119
// Let the title fill the full width of the Expanded
115120
// and wrap onto multiple lines instead of being

lib/ui/features/detail/widget/mobile_detail_tile.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@ class MobileDetailTile extends ConsumerWidget {
119119
Text(_dateFormatter(DateTime.tryParse(item.update))),
120120
Text(' • '),
121121
],
122-
if (history != null) Text(_progressIndicator(history!)),
122+
if (history != null) ...[
123+
Text(_progressIndicator(history!)),
124+
Text(' • '),
125+
],
123126
if (downloadProgress != null)
124127
Text(
125128
"${downloadProgress.status.name} - ${(downloadProgress.progress / (downloadProgress.total == 0 ? 1 : downloadProgress.total) * 100).toStringAsFixed(1)}%",

lib/ui/features/extension/views/extension_list_view.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ class ExtensionListView extends HookConsumerWidget {
150150
minExtentValue: filterExpanded.value ? 210 : 120,
151151
child: FScaffold(
152152
childPad: false,
153+
resizeToAvoidBottomInset: false,
153154
child: Column(
154155
mainAxisSize: MainAxisSize.min,
155156
children: [

lib/ui/features/favorite/views/favorite_view.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ class _FavoriteDesktopView extends ConsumerWidget {
157157
extent: 60,
158158
child: FScaffold(
159159
childPad: false,
160+
resizeToAvoidBottomInset: false,
160161
child: Padding(
161162
padding: const EdgeInsets.symmetric(
162163
horizontal: 20,
@@ -197,6 +198,7 @@ class _FavoriteDesktopView extends ConsumerWidget {
197198
extent: 60,
198199
child: FScaffold(
199200
childPad: false,
201+
resizeToAvoidBottomInset: false,
200202
child: const Padding(
201203
padding: EdgeInsets.symmetric(horizontal: 20),
202204
child: DesktopFavoriteSearchBar(),
@@ -442,6 +444,7 @@ class _FavoriteHeader extends ConsumerWidget {
442444

443445
return FScaffold(
444446
childPad: false,
447+
resizeToAvoidBottomInset: false,
445448
child: Padding(
446449
padding: const EdgeInsets.fromLTRB(8, 6, 8, 8),
447450
child: Column(

lib/ui/features/main_page.dart

Lines changed: 47 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -186,53 +186,57 @@ class _MainPageState extends ConsumerState<MainPage>
186186
mobileWidget: Column(
187187
children: [
188188
Expanded(child: widget.child ?? const SizedBox()),
189-
FBottomNavigationBar(
190-
index: selected.value,
191-
onChange: (value) {
192-
if (widget.child != null) {
193-
widget.child!.goBranch(value);
194-
}
195-
selected.value = value;
196-
},
197-
children: [
198-
FBottomNavigationBarItem(
199-
label: Text(_navItems[0].text.i18n),
200-
icon: HomeIcon(
201-
color: selected.value == 0
202-
? themeData.colors.primary
203-
: themeData.colors.mutedForeground,
204-
isTriggered: selected.value == 0,
189+
// Hide the bottom navigation bar when the keyboard is open to
190+
// prevent its solid background from appearing as a black box
191+
// above the keyboard.
192+
if (MediaQuery.viewInsetsOf(context).bottom == 0)
193+
FBottomNavigationBar(
194+
index: selected.value,
195+
onChange: (value) {
196+
if (widget.child != null) {
197+
widget.child!.goBranch(value);
198+
}
199+
selected.value = value;
200+
},
201+
children: [
202+
FBottomNavigationBarItem(
203+
label: Text(_navItems[0].text.i18n),
204+
icon: HomeIcon(
205+
color: selected.value == 0
206+
? themeData.colors.primary
207+
: themeData.colors.mutedForeground,
208+
isTriggered: selected.value == 0,
209+
),
205210
),
206-
),
207-
FBottomNavigationBarItem(
208-
label: Text(_navItems[1].text.i18n),
209-
icon: CompassIcon(
210-
color: selected.value == 1
211-
? themeData.colors.primary
212-
: themeData.colors.mutedForeground,
213-
isTriggered: selected.value == 1,
211+
FBottomNavigationBarItem(
212+
label: Text(_navItems[1].text.i18n),
213+
icon: CompassIcon(
214+
color: selected.value == 1
215+
? themeData.colors.primary
216+
: themeData.colors.mutedForeground,
217+
isTriggered: selected.value == 1,
218+
),
214219
),
215-
),
216-
FBottomNavigationBarItem(
217-
label: Text(_navItems[2].text.i18n),
218-
icon: BlocksPathLoopIcon(
219-
color: selected.value == 2
220-
? themeData.colors.primary
221-
: themeData.colors.mutedForeground,
222-
isTriggered: selected.value == 2,
220+
FBottomNavigationBarItem(
221+
label: Text(_navItems[2].text.i18n),
222+
icon: BlocksPathLoopIcon(
223+
color: selected.value == 2
224+
? themeData.colors.primary
225+
: themeData.colors.mutedForeground,
226+
isTriggered: selected.value == 2,
227+
),
223228
),
224-
),
225-
FBottomNavigationBarItem(
226-
label: Text(_navItems[3].text.i18n),
227-
icon: SettingsIcon(
228-
color: selected.value == 3
229-
? themeData.colors.primary
230-
: themeData.colors.mutedForeground,
231-
isTriggered: selected.value == 3,
229+
FBottomNavigationBarItem(
230+
label: Text(_navItems[3].text.i18n),
231+
icon: SettingsIcon(
232+
color: selected.value == 3
233+
? themeData.colors.primary
234+
: themeData.colors.mutedForeground,
235+
isTriggered: selected.value == 3,
236+
),
232237
),
233-
),
234-
],
235-
),
238+
],
239+
),
236240
],
237241
),
238242
desktopWidget: FScaffold(

0 commit comments

Comments
 (0)