opt: tablet nav

Closes #692

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-16 18:42:48 +08:00
parent f0e3b776bb
commit 9ccf91659f

View File

@@ -204,9 +204,58 @@ class _MainAppState extends State<MainApp>
context.orientation == Orientation.landscape) ...[ context.orientation == Orientation.landscape) ...[
Obx( Obx(
() => _mainController.navigationBars.length > 1 () => _mainController.navigationBars.length > 1
? NavigationRail( ? context.isTablet
? Column(
children: [
SizedBox(
height:
MediaQuery.paddingOf(context).top + 50),
userAndSearchVertical,
const Spacer(flex: 2),
Expanded(
flex: 5,
child: SizedBox(
width: 130,
child: MediaQuery.removePadding(
context: context,
removeRight: true,
child: NavigationDrawer(
tilePadding: const EdgeInsets.symmetric(
vertical: 5, horizontal: 12),
indicatorShape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(16)),
onDestinationSelected: setIndex,
selectedIndex:
_mainController.selectedIndex.value,
children: [
..._mainController.navigationBars
.map((e) {
return NavigationDrawerDestination(
label: Text(e['label']),
icon: _buildIcon(
id: e['id'],
count: e['count'],
icon: e['icon'],
),
selectedIcon: _buildIcon(
id: e['id'],
count: e['count'],
icon: e['selectIcon'],
),
);
}),
],
),
),
),
),
],
)
: NavigationRail(
groupAlignment: 0.5, groupAlignment: 0.5,
selectedIndex: _mainController.selectedIndex.value, selectedIndex:
_mainController.selectedIndex.value,
onDestinationSelected: setIndex, onDestinationSelected: setIndex,
labelType: NavigationRailLabelType.selected, labelType: NavigationRailLabelType.selected,
leading: userAndSearchVertical, leading: userAndSearchVertical,
@@ -228,14 +277,17 @@ class _MainAppState extends State<MainApp>
) )
.toList(), .toList(),
) )
: Container( : SafeArea(
right: false,
child: Container(
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: MediaQuery.paddingOf(context).top + 10, top: 10,
), ),
width: 56, width: 80,
child: userAndSearchVertical, child: userAndSearchVertical,
), ),
), ),
),
VerticalDivider( VerticalDivider(
width: 1, width: 1,
indent: MediaQuery.of(context).padding.top, indent: MediaQuery.of(context).padding.top,