feat:增加主题色模块
This commit is contained in:
44
lib/layout/app_drawer.dart
Normal file
44
lib/layout/app_drawer.dart
Normal file
@@ -0,0 +1,44 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:food_hub_app/layout/theme_layout.dart';
|
||||
|
||||
class AppDrawer extends StatefulWidget {
|
||||
const AppDrawer({super.key});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => AppDrawerState();
|
||||
}
|
||||
|
||||
class AppDrawerState extends State<AppDrawer> {
|
||||
@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),
|
||||
),
|
||||
),
|
||||
),
|
||||
ThemeLayout(),
|
||||
const Divider(),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.info),
|
||||
title: const Text('关于我们'),
|
||||
onTap: () {
|
||||
Navigator.pop(context); // 关闭抽屉
|
||||
// 跳转到关于页面
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user