Skip to content

Commit 9819678

Browse files
committed
Improve landscape mobile home page
1 parent c882e3f commit 9819678

2 files changed

Lines changed: 75 additions & 27 deletions

File tree

app/lib/views/home/page.dart

Lines changed: 74 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ class _HomePageState extends State<HomePage> {
5454
@override
5555
Widget build(BuildContext context) {
5656
final size = MediaQuery.sizeOf(context);
57-
final isDesktop = size.width > LeapBreakpoints.expanded;
58-
final isMobile = size.width < LeapBreakpoints.compact;
57+
final isMobile = size.shortestSide < LeapBreakpoints.compact;
58+
final isMobileLandscape = isMobile && size.width > size.height;
59+
final isDesktop = !isMobile && size.width > LeapBreakpoints.expanded;
5960
return BlocBuilder<SettingsCubit, ButterflySettings>(
6061
buildWhen: (previous, current) =>
6162
previous.bannerVisibility != current.bannerVisibility ||
@@ -115,7 +116,7 @@ class _HomePageState extends State<HomePage> {
115116
);
116117
return Scaffold(
117118
appBar: isMobile ? null : appBar,
118-
bottomNavigationBar: isMobile
119+
bottomNavigationBar: isMobile && !isMobileLandscape
119120
? NavigationBar(
120121
destinations: [
121122
NavigationDestination(
@@ -143,35 +144,81 @@ class _HomePageState extends State<HomePage> {
143144
)
144145
: null,
145146
body: isMobile
146-
? DefaultTabController(
147-
length: 1,
148-
child: switch (_tab) {
149-
_MobileTab.home => Scaffold(
150-
appBar: appBar,
151-
body: ListView(
152-
children: [
153-
_QuickstartHomeView(
154-
remote: _remote,
155-
isMobile: true,
156-
onReload: () => setState(
157-
() => _filesViewKey.currentState
158-
?.reloadFileSystem(),
147+
? Row(
148+
children: [
149+
if (isMobileLandscape) ...[
150+
NavigationRail(
151+
destinations: [
152+
NavigationRailDestination(
153+
icon: const Icon(PhosphorIconsLight.house),
154+
selectedIcon: const Icon(
155+
PhosphorIconsFill.house,
156+
),
157+
label: Text(AppLocalizations.of(context).home),
158+
),
159+
NavigationRailDestination(
160+
icon: const Icon(PhosphorIconsLight.folder),
161+
selectedIcon: const Icon(
162+
PhosphorIconsFill.folder,
163+
),
164+
label: Text(AppLocalizations.of(context).files),
165+
),
166+
NavigationRailDestination(
167+
icon: const Icon(PhosphorIconsLight.gear),
168+
selectedIcon: const Icon(
169+
PhosphorIconsFill.gear,
170+
),
171+
label: Text(
172+
AppLocalizations.of(context).settings,
159173
),
160174
),
161-
RecentFilesView(replace: false, asGrid: true),
162175
],
176+
onDestinationSelected: (index) {
177+
setState(() {
178+
_tab = _MobileTab.values[index];
179+
});
180+
},
181+
selectedIndex: _tab.index,
182+
labelType: NavigationRailLabelType.selected,
183+
),
184+
const VerticalDivider(width: 1),
185+
],
186+
Expanded(
187+
child: DefaultTabController(
188+
length: 1,
189+
child: switch (_tab) {
190+
_MobileTab.home => Scaffold(
191+
appBar: appBar,
192+
body: ListView(
193+
children: [
194+
_QuickstartHomeView(
195+
remote: _remote,
196+
isMobile: true,
197+
onReload: () => setState(
198+
() => _filesViewKey.currentState
199+
?.reloadFileSystem(),
200+
),
201+
),
202+
RecentFilesView(
203+
replace: false,
204+
asGrid: true,
205+
),
206+
],
207+
),
208+
),
209+
_MobileTab.files => FilesView(
210+
activeAsset: widget.selectedAsset,
211+
remote: _remote,
212+
isMobile: true,
213+
isPage: true,
214+
key: _filesViewKey,
215+
onRemoteChanged: (value) => updateRemote(value),
216+
),
217+
_MobileTab.settings => SettingsPage(),
218+
},
163219
),
164220
),
165-
_MobileTab.files => FilesView(
166-
activeAsset: widget.selectedAsset,
167-
remote: _remote,
168-
isMobile: true,
169-
isPage: true,
170-
key: _filesViewKey,
171-
onRemoteChanged: (value) => updateRemote(value),
172-
),
173-
_MobileTab.settings => SettingsPage(),
174-
},
221+
],
175222
)
176223
: SingleChildScrollView(
177224
child: Align(

metadata/en-US/changelogs/195.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
* Improve landscape mobile home page
12
* Fix importing WebP images ([#1240](https://github.com/LinwoodDev/Butterfly/issues/1240))
23
* Fix file thumbnails not refreshing after returning from documents on mobile ([#1241](https://github.com/LinwoodDev/Butterfly/issues/1241))
34
* Fix importing encrypted notes requiring their password ([#1242](https://github.com/LinwoodDev/Butterfly/issues/1242))

0 commit comments

Comments
 (0)