feat:重构UI模块
This commit is contained in:
69
lib/layout/drawer.dart
Normal file
69
lib/layout/drawer.dart
Normal file
@@ -0,0 +1,69 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
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); // 关闭抽屉
|
||||
// 跳转到关于页面
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user