Skip to content

Commit 1afb4f4

Browse files
authored
fix: Add some bottom padding for Mobile (#31)
* fix: Add some bottom padding for Mobile * fix: Add side padding for Mobile
1 parent ce29075 commit 1afb4f4

File tree

2 files changed

+140
-124
lines changed

2 files changed

+140
-124
lines changed

lib/pages/home/home_page.dart

Lines changed: 139 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -161,61 +161,72 @@ class HomePage extends HookConsumerWidget {
161161
duration: const Duration(milliseconds: 150),
162162
child: SizedBox(
163163
width: constraints.maxWidth,
164-
height: 86,
164+
height: 86 + media.viewPadding.bottom,
165165
child: BlurWidget(
166-
child: Row(
167-
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
168-
children: [
169-
IconButton(
170-
onPressed: _openDrawer,
171-
icon: const Icon(TablerIcons.menu_2),
172-
padding: const EdgeInsets.all(20),
173-
color: themes.fgColor,
174-
style: btnStyle,
175-
),
176-
IconButton(
177-
onPressed: () {
178-
var logic =
179-
ref.read(homePageStateProvider.notifier);
180-
logic.changePage("timeline");
181-
},
182-
icon: const Icon(TablerIcons.home),
183-
padding: const EdgeInsets.all(20),
184-
color: themes.fgColor,
185-
style: btnStyle,
186-
),
187-
IconButton(
188-
onPressed: () {
189-
var logic =
190-
ref.read(homePageStateProvider.notifier);
191-
logic.changePage("notifications");
192-
},
193-
icon: const Icon(TablerIcons.bell),
194-
padding: const EdgeInsets.all(20),
195-
color: themes.fgColor,
196-
style: btnStyle,
166+
child: Padding(
167+
padding: EdgeInsets.only(
168+
bottom: media.viewPadding.bottom,
169+
),
170+
child: Padding(
171+
padding: EdgeInsets.only(
172+
left: media.viewPadding.left,
173+
right: media.viewPadding.right,
197174
),
198-
IconButton(
199-
onPressed: _openEndDrawer,
200-
icon: const Icon(TablerIcons.apps),
201-
padding: const EdgeInsets.all(20),
202-
color: themes.fgColor,
203-
style: btnStyle,
175+
child: Row(
176+
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
177+
children: [
178+
IconButton(
179+
onPressed: _openDrawer,
180+
icon: const Icon(TablerIcons.menu_2),
181+
padding: const EdgeInsets.all(20),
182+
color: themes.fgColor,
183+
style: btnStyle,
184+
),
185+
IconButton(
186+
onPressed: () {
187+
var logic = ref
188+
.read(homePageStateProvider.notifier);
189+
logic.changePage("timeline");
190+
},
191+
icon: const Icon(TablerIcons.home),
192+
padding: const EdgeInsets.all(20),
193+
color: themes.fgColor,
194+
style: btnStyle,
195+
),
196+
IconButton(
197+
onPressed: () {
198+
var logic = ref
199+
.read(homePageStateProvider.notifier);
200+
logic.changePage("notifications");
201+
},
202+
icon: const Icon(TablerIcons.bell),
203+
padding: const EdgeInsets.all(20),
204+
color: themes.fgColor,
205+
style: btnStyle,
206+
),
207+
IconButton(
208+
onPressed: _openEndDrawer,
209+
icon: const Icon(TablerIcons.apps),
210+
padding: const EdgeInsets.all(20),
211+
color: themes.fgColor,
212+
style: btnStyle,
213+
),
214+
IconButton(
215+
onPressed: () {
216+
NoteCreateDialog.open(context: context);
217+
},
218+
icon: const Icon(TablerIcons.pencil),
219+
padding: const EdgeInsets.all(20),
220+
color: themes.fgColor,
221+
style: btnStyle,
222+
),
223+
],
204224
),
205-
IconButton(
206-
onPressed: () {
207-
NoteCreateDialog.open(context: context);
208-
},
209-
icon: const Icon(TablerIcons.pencil),
210-
padding: const EdgeInsets.all(20),
211-
color: themes.fgColor,
212-
style: btnStyle,
213-
)
214-
],
225+
),
215226
),
216227
),
217228
),
218-
)
229+
),
219230
],
220231
);
221232
},
@@ -248,83 +259,88 @@ class NavBar extends HookConsumerWidget {
248259
height: double.infinity,
249260
duration: const Duration(milliseconds: 150),
250261
curve: Curves.easeInOut,
251-
child: Column(
252-
children: [
253-
const ServerIconAndBanner(),
254-
Expanded(child: SingleChildScrollView(
255-
child: Builder(builder: (context) {
256-
var list = <Widget>[];
257-
for (var element in state.navItemList) {
258-
if (element["line"] == null) {
259-
list.add(NavbarItem(
260-
icon: element["icon"],
261-
label: element["label"],
262-
id: element["id"] ?? '',
263-
currentId: currentId ?? '',
264-
onSelect: () {
265-
if (onSelect != null) {
266-
onSelect!();
267-
}
268-
},
269-
));
270-
} else {
271-
list.add(Padding(
272-
padding: const EdgeInsets.fromLTRB(18, 8, 18, 8),
273-
child: SizedBox(
274-
width: double.infinity,
275-
height: 1,
276-
child: DecoratedBox(
277-
decoration: BoxDecoration(color: themes.dividerColor),
262+
child: Padding(
263+
padding: EdgeInsetsGeometry.only(
264+
left: MediaQuery.of(context).viewPadding.left),
265+
child: Column(
266+
children: [
267+
const ServerIconAndBanner(),
268+
Expanded(child: SingleChildScrollView(
269+
child: Builder(builder: (context) {
270+
var list = <Widget>[];
271+
for (var element in state.navItemList) {
272+
if (element["line"] == null) {
273+
list.add(NavbarItem(
274+
icon: element["icon"],
275+
label: element["label"],
276+
id: element["id"] ?? '',
277+
currentId: currentId ?? '',
278+
onSelect: () {
279+
if (onSelect != null) {
280+
onSelect!();
281+
}
282+
},
283+
));
284+
} else {
285+
list.add(Padding(
286+
padding: const EdgeInsets.fromLTRB(18, 8, 18, 8),
287+
child: SizedBox(
288+
width: double.infinity,
289+
height: 1,
290+
child: DecoratedBox(
291+
decoration: BoxDecoration(color: themes.dividerColor),
292+
),
278293
),
279-
),
280-
));
294+
));
295+
}
281296
}
282-
}
283297

284-
return SizedBox(
285-
width: double.infinity,
286-
child: Column(
287-
children: [
288-
...list,
289-
if (isWide)
290-
NavbarItem(
291-
icon: TablerIcons.settings,
292-
label: S.current.settings,
293-
id: "settingProfile",
294-
currentId: currentId ?? '',
295-
onSelect: () {
296-
if (onSelect != null) {
297-
onSelect!();
298-
}
299-
300-
context.goNamed("settingProfile");
301-
},
302-
)
303-
else
304-
NavbarItem(
305-
icon: TablerIcons.settings,
306-
label: S.current.settings,
307-
id: "settings",
308-
currentId: currentId ?? '',
309-
onSelect: () {
310-
if (onSelect != null) {
311-
onSelect!();
312-
}
313-
314-
context.goNamed("settings");
315-
},
316-
),
317-
],
318-
),
319-
);
320-
}),
321-
)),
322-
const SizedBox(height: 20),
323-
const CreateBottom(),
324-
const SizedBox(height: 20),
325-
UserAvatarButton(onSelect: onSelect),
326-
const SizedBox(height: 20),
327-
],
298+
return SizedBox(
299+
width: double.infinity,
300+
child: Column(
301+
children: [
302+
...list,
303+
if (isWide)
304+
NavbarItem(
305+
icon: TablerIcons.settings,
306+
label: S.current.settings,
307+
id: "settingProfile",
308+
currentId: currentId ?? '',
309+
onSelect: () {
310+
if (onSelect != null) {
311+
onSelect!();
312+
}
313+
314+
context.goNamed("settingProfile");
315+
},
316+
)
317+
else
318+
NavbarItem(
319+
icon: TablerIcons.settings,
320+
label: S.current.settings,
321+
id: "settings",
322+
currentId: currentId ?? '',
323+
onSelect: () {
324+
if (onSelect != null) {
325+
onSelect!();
326+
}
327+
328+
context.goNamed("settings");
329+
},
330+
),
331+
],
332+
),
333+
);
334+
}),
335+
)),
336+
const SizedBox(height: 20),
337+
const CreateBottom(),
338+
const SizedBox(height: 20),
339+
UserAvatarButton(onSelect: onSelect),
340+
const SizedBox(height: 20),
341+
SizedBox(height: MediaQuery.of(context).viewPadding.bottom),
342+
],
343+
),
328344
),
329345
);
330346
}

lib/widgets/note_create_dialog/note_create_dialog.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ class NoteCreateDialog extends HookConsumerWidget {
248248
)
249249
else
250250
SizedBox(
251-
height: keyboardHeight,
251+
height: keyboardHeight + MediaQuery.of(context).viewPadding.bottom,
252252
)
253253
],
254254
),

0 commit comments

Comments
 (0)