44 lines
1.4 KiB
Dart
44 lines
1.4 KiB
Dart
import 'package:flisp_app/provider/app_provider.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
class AppNavbar extends StatelessWidget {
|
|
AppNavbar({super.key});
|
|
|
|
final List<BottomNavigationBarItem> navItems = [
|
|
BottomNavigationBarItem(icon: Icon(Icons.flash_on), label: '闪灵'),
|
|
BottomNavigationBarItem(icon: Icon(Icons.checklist), label: '待办'),
|
|
BottomNavigationBarItem(icon: Icon(Icons.calendar_month), label: '日程'),
|
|
BottomNavigationBarItem(icon: Icon(Icons.insert_chart), label: '统计'),
|
|
];
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final appProvider = context.watch<AppProvider>();
|
|
final colors = Theme.of(context).colorScheme;
|
|
|
|
return Container(
|
|
decoration: BoxDecoration(
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: colors.shadow.withAlpha(20),
|
|
blurRadius: 8,
|
|
offset: const Offset(0, -2),
|
|
),
|
|
],
|
|
),
|
|
child: BottomNavigationBar(
|
|
currentIndex: appProvider.currentTab,
|
|
onTap: (index) => appProvider.changeTab(index),
|
|
type: BottomNavigationBarType.fixed,
|
|
backgroundColor: colors.surface,
|
|
selectedItemColor: colors.primary,
|
|
unselectedItemColor: colors.onSurface.withAlpha(120),
|
|
showSelectedLabels: true,
|
|
showUnselectedLabels: true,
|
|
items: navItems,
|
|
),
|
|
);
|
|
}
|
|
}
|