2024-05-18 10:17:16 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:solian/router.dart';
|
|
|
|
import 'package:solian/widgets/navigation/app_navigation.dart';
|
|
|
|
|
|
|
|
class AppNavigationBottomBar extends StatefulWidget {
|
|
|
|
const AppNavigationBottomBar({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<AppNavigationBottomBar> createState() => _AppNavigationBottomBarState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _AppNavigationBottomBarState extends State<AppNavigationBottomBar> {
|
|
|
|
int _selectedIndex = 0;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return BottomNavigationBar(
|
2024-05-25 17:21:08 +00:00
|
|
|
items: AppNavigation.destinations
|
|
|
|
.map(
|
|
|
|
(e) => BottomNavigationBarItem(
|
|
|
|
icon: e.icon,
|
|
|
|
label: e.label,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
.toList(),
|
2024-05-28 14:13:23 +00:00
|
|
|
type: BottomNavigationBarType.fixed,
|
2024-05-18 10:17:16 +00:00
|
|
|
landscapeLayout: BottomNavigationBarLandscapeLayout.centered,
|
|
|
|
currentIndex: _selectedIndex,
|
|
|
|
showUnselectedLabels: false,
|
|
|
|
onTap: (idx) {
|
|
|
|
setState(() => _selectedIndex = idx);
|
2024-07-09 13:23:38 +00:00
|
|
|
AppRouter.instance.goNamed(AppNavigation.destinations[idx].page);
|
2024-05-18 10:17:16 +00:00
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|