feat:增加图表组件
This commit is contained in:
132
lib/layout/index.dart
Normal file
132
lib/layout/index.dart
Normal file
@@ -0,0 +1,132 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class NavBar extends StatelessWidget {
|
||||
final int currentIndex;
|
||||
final Function(int) onTap;
|
||||
|
||||
static const List<BottomNavigationBarItem> navItems = [
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.home_outlined),
|
||||
activeIcon: Icon(Icons.home),
|
||||
label: "记录",
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.pie_chart_outline),
|
||||
activeIcon: Icon(Icons.pie_chart),
|
||||
label: "统计",
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.group_outlined),
|
||||
activeIcon: Icon(Icons.group),
|
||||
label: "朋友圈",
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.account_circle_outlined),
|
||||
activeIcon: Icon(Icons.account_circle),
|
||||
label: "我的",
|
||||
),
|
||||
];
|
||||
|
||||
const NavBar({super.key, required this.currentIndex, required this.onTap});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BottomNavigationBar(
|
||||
currentIndex: currentIndex,
|
||||
iconSize: 25,
|
||||
type: BottomNavigationBarType.fixed,
|
||||
backgroundColor: Colors.white,
|
||||
items: navItems,
|
||||
onTap: onTap,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class SettingsDrawer extends StatelessWidget {
|
||||
const SettingsDrawer({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// final themeProvider = Provider.of<ThemeProvider>(context);
|
||||
|
||||
return Drawer(
|
||||
child: ListView(
|
||||
padding: EdgeInsets.zero,
|
||||
children: [
|
||||
ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxHeight: 100),
|
||||
child: DrawerHeader(
|
||||
decoration: BoxDecoration(color: Theme.of(context).primaryColor),
|
||||
child: const Text(
|
||||
'设置',
|
||||
style: TextStyle(color: Colors.white, fontSize: 24),
|
||||
),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.brightness_4),
|
||||
title: const Text('夜间模式'),
|
||||
// trailing: Switch(
|
||||
// value: themeProvider.isDarkMode,
|
||||
// onChanged: (bool value) {
|
||||
// themeProvider.toggleTheme();
|
||||
// },
|
||||
// ),
|
||||
// onTap: () => themeProvider.toggleTheme(),
|
||||
),
|
||||
|
||||
// 其他设置选项
|
||||
ListTile(
|
||||
leading: const Icon(Icons.notifications),
|
||||
title: const Text('通知设置'),
|
||||
onTap: () {
|
||||
Navigator.pop(context); // 关闭抽屉
|
||||
// 跳转到通知设置页面
|
||||
},
|
||||
),
|
||||
|
||||
ListTile(
|
||||
leading: const Icon(Icons.language),
|
||||
title: const Text('语言'),
|
||||
onTap: () {
|
||||
Navigator.pop(context); // 关闭抽屉
|
||||
// 跳转到语言设置页面
|
||||
},
|
||||
),
|
||||
|
||||
// 底部关于
|
||||
const Divider(),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.info),
|
||||
title: const Text('关于我们'),
|
||||
onTap: () {
|
||||
Navigator.pop(context); // 关闭抽屉
|
||||
// 跳转到关于页面
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
List<StatelessWidget> homeActions() {
|
||||
return [
|
||||
IconButton(
|
||||
icon: Icon(Icons.search, color: Colors.white),
|
||||
onPressed: () {
|
||||
// 搜索功能
|
||||
},
|
||||
),
|
||||
Builder(
|
||||
builder: (BuildContext context) {
|
||||
return IconButton(
|
||||
icon: Icon(Icons.settings, color: Colors.white),
|
||||
onPressed: () {
|
||||
Scaffold.of(context).openEndDrawer();
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user