feat:增加底部标题栏

This commit is contained in:
2025-11-16 22:10:53 +08:00
parent 61922cbcd8
commit 1132b78ecd
5 changed files with 58 additions and 19 deletions

View File

@@ -20,3 +20,8 @@ final List<PageInfo> pages = [
];
final List<Widget> pageWidgets = pages.map((item) => item.page).toList();
final List<BottomNavigationBarItem> bottomNavItems =
pages.map((page) {
return BottomNavigationBarItem(icon: Icon(page.icon), label: page.title);
}).toList();

22
lib/layout/nav_bar.dart Normal file
View File

@@ -0,0 +1,22 @@
import 'package:flutter/material.dart';
import 'menu.dart';
Widget buildBottomNavigationBar({
required BuildContext context,
required int index,
required Function(int) onTap,
}) {
return BottomNavigationBar(
currentIndex: index,
onTap: onTap,
items: bottomNavItems,
type: BottomNavigationBarType.fixed,
selectedItemColor: Theme.of(context).colorScheme.primary,
unselectedItemColor: Colors.grey,
showSelectedLabels: true,
showUnselectedLabels: true,
backgroundColor: Colors.white,
elevation: 8,
);
}