Files
Auger/lib/widgets/navbar.dart

53 lines
1.0 KiB
Dart

import 'package:go_router/go_router.dart';
import 'package:shadcn_flutter/shadcn_flutter.dart';
class ProjNavBar extends StatelessWidget {
static final Map<String, int> _pageIndex = {
"home": 0,
"settings": 1
};
late final int selectedIndex;
ProjNavBar({super.key, String currentPage = "home"}) {;
selectedIndex = _pageIndex[currentPage] ?? 0;
}
@override
Widget build(BuildContext context) {
// TODO: implement build
return NavigationBar(
index: selectedIndex,
onSelected: (index) {
if (index == 0) {
GoRouter.of(context).go("/");
} else if (index == 1) {
GoRouter.of(context).go("/settings");
}
},
children: [
NavigationItem(
label: Text(
"Home"
),
child: Icon(
LucideIcons.house
),
),
NavigationItem(
label: Text(
"Settings"
),
child: Icon(
LucideIcons.settings
),
)
],
);
}
}