factor:布局颜色重构

This commit is contained in:
2025-11-20 11:04:29 +08:00
parent a582ebb3e4
commit 6e97d7f33f
16 changed files with 311 additions and 284 deletions

View File

@@ -6,7 +6,7 @@ import 'package:provider/provider.dart';
class AppDrawer extends StatelessWidget {
const AppDrawer({super.key});
DrawerHeader buildDrawerHeader(BuildContext context) {
DrawerHeader _buildDrawerHeader(BuildContext context) {
return DrawerHeader(
decoration: BoxDecoration(color: Theme.of(context).colorScheme.primary),
child: Column(
@@ -86,7 +86,7 @@ class AppDrawer extends StatelessWidget {
);
}
Widget buildVersionInfo({
Widget _buildVersionInfo({
required BuildContext context,
required String fullVersion,
}) {
@@ -109,18 +109,16 @@ class AppDrawer extends StatelessWidget {
@override
Widget build(BuildContext context) {
final appProvider = Provider.of<AppProvider>(context);
final appProvider = context.watch<AppProvider>();
return Drawer(
child: Column(
children: [
// 主要内容区域,可以滚动
Expanded(
child: ListView(
padding: EdgeInsets.zero,
children: [
// 抽屉头部
buildDrawerHeader(context),
_buildDrawerHeader(context),
_buildThemeSection(context, appProvider),
const Divider(),
_buildDrawerItem(
@@ -135,15 +133,10 @@ class AppDrawer extends StatelessWidget {
],
),
),
Consumer<AppProvider>(
builder: (context, appProvider, child) {
return buildVersionInfo(
context: context,
fullVersion: appProvider.fullVersion,
);
},
),
_buildVersionInfo(
context: context,
fullVersion: appProvider.fullVersion,
)
],
),
);