opt: navigation bar (#740)

This commit is contained in:
Noo6
2025-04-22 11:54:29 +08:00
committed by GitHub
parent ede238c647
commit fa90c1ef31

View File

@@ -144,10 +144,7 @@ class _HomePageState extends State<HomePage>
config: { config: {
Breakpoints.small: SlotLayout.from( Breakpoints.small: SlotLayout.from(
key: const Key('bottomNavigation'), key: const Key('bottomNavigation'),
builder: (context) => ListenableBuilder( builder: (context) => _buildBottomBar(),
listenable: _selectIndex,
builder: (context, child) => _buildBottomBar(),
),
), ),
}, },
), ),
@@ -156,31 +153,37 @@ class _HomePageState extends State<HomePage>
} }
Widget _buildBottomBar() { Widget _buildBottomBar() {
return ListenableBuilder( return Stores.setting.fullScreen.fetch()
listenable: _selectIndex, ? UIs.placeholder
builder: (context, child) => NavigationBar( : ListenableBuilder(
selectedIndex: _selectIndex.value, listenable: _selectIndex,
height: kBottomNavigationBarHeight * 1.1, builder: (context, child) => NavigationBar(
animationDuration: const Duration(milliseconds: 250), selectedIndex: _selectIndex.value,
onDestinationSelected: _onDestinationSelected, height: kBottomNavigationBarHeight * 1.1,
labelBehavior: NavigationDestinationLabelBehavior.onlyShowSelected, animationDuration: const Duration(milliseconds: 250),
destinations: AppTab.navDestinations, onDestinationSelected: _onDestinationSelected,
), labelBehavior:
); NavigationDestinationLabelBehavior.onlyShowSelected,
destinations: AppTab.navDestinations,
),
);
} }
Widget _buildRailBar({bool extended = false}) { Widget _buildRailBar({bool extended = false}) {
return ListenableBuilder( return Stores.setting.fullScreen.fetch()
listenable: _selectIndex, ? UIs.placeholder
builder: (context, child) => AdaptiveScaffold.standardNavigationRail( : ListenableBuilder(
extended: extended, listenable: _selectIndex,
padding: EdgeInsets.zero, builder: (context, child) =>
selectedIndex: _selectIndex.value, AdaptiveScaffold.standardNavigationRail(
destinations: AppTab.navRailDestinations, extended: extended,
onDestinationSelected: _onDestinationSelected, padding: EdgeInsets.zero,
labelType: extended ? null : NavigationRailLabelType.selected, selectedIndex: _selectIndex.value,
), destinations: AppTab.navRailDestinations,
); onDestinationSelected: _onDestinationSelected,
labelType: extended ? null : NavigationRailLabelType.selected,
),
);
} }
@override @override