factor:布局颜色重构
This commit is contained in:
@@ -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,
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user