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,23 +153,29 @@ class _HomePageState extends State<HomePage>
} }
Widget _buildBottomBar() { Widget _buildBottomBar() {
return ListenableBuilder( return Stores.setting.fullScreen.fetch()
? UIs.placeholder
: ListenableBuilder(
listenable: _selectIndex, listenable: _selectIndex,
builder: (context, child) => NavigationBar( builder: (context, child) => NavigationBar(
selectedIndex: _selectIndex.value, selectedIndex: _selectIndex.value,
height: kBottomNavigationBarHeight * 1.1, height: kBottomNavigationBarHeight * 1.1,
animationDuration: const Duration(milliseconds: 250), animationDuration: const Duration(milliseconds: 250),
onDestinationSelected: _onDestinationSelected, onDestinationSelected: _onDestinationSelected,
labelBehavior: NavigationDestinationLabelBehavior.onlyShowSelected, labelBehavior:
NavigationDestinationLabelBehavior.onlyShowSelected,
destinations: AppTab.navDestinations, destinations: AppTab.navDestinations,
), ),
); );
} }
Widget _buildRailBar({bool extended = false}) { Widget _buildRailBar({bool extended = false}) {
return ListenableBuilder( return Stores.setting.fullScreen.fetch()
? UIs.placeholder
: ListenableBuilder(
listenable: _selectIndex, listenable: _selectIndex,
builder: (context, child) => AdaptiveScaffold.standardNavigationRail( builder: (context, child) =>
AdaptiveScaffold.standardNavigationRail(
extended: extended, extended: extended,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
selectedIndex: _selectIndex.value, selectedIndex: _selectIndex.value,