This commit is contained in:
vipg
2025-11-13 18:28:02 +08:00
parent e85f38ac81
commit f5a3255df8

View File

@@ -74,23 +74,7 @@ class _HomePageState extends State<HomePage> {
return Scaffold( return Scaffold(
backgroundColor: Theme.of(context).colorScheme.surface, backgroundColor: Theme.of(context).colorScheme.surface,
appBar: AppBar( // 移除顶部导航栏
leading: IconButton(
icon: const Icon(Icons.settings),
onPressed: () {
Navigator.pushNamed(context, '/setting_list');
},
),
title: const Text(''),
backgroundColor: Theme.of(context).colorScheme.surface,
elevation: 4,
actions: [
IconButton(
icon: const Icon(Icons.logout),
onPressed: () => _logout(context),
),
],
),
body: Row( body: Row(
children: [ children: [
// 左侧功能导航栏 // 左侧功能导航栏
@@ -98,7 +82,6 @@ class _HomePageState extends State<HomePage> {
width: 180, width: 180,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surfaceContainerHighest, color: Theme.of(context).colorScheme.surfaceContainerHighest,
// 使用withValues替换withOpacity
border: Border( border: Border(
right: BorderSide( right: BorderSide(
color: Theme.of( color: Theme.of(
@@ -107,6 +90,10 @@ class _HomePageState extends State<HomePage> {
), ),
), ),
), ),
child: Column(
children: [
// 功能列表
Expanded(
child: ListView.builder( child: ListView.builder(
itemCount: _functions.length, itemCount: _functions.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
@@ -124,7 +111,6 @@ class _HomePageState extends State<HomePage> {
), ),
), ),
selected: _selectedFunctionIndex == index, selected: _selectedFunctionIndex == index,
// 使用withValues替换withOpacity
selectedTileColor: Theme.of( selectedTileColor: Theme.of(
context, context,
).colorScheme.primary.withValues(alpha: 0.1), ).colorScheme.primary.withValues(alpha: 0.1),
@@ -138,6 +124,25 @@ class _HomePageState extends State<HomePage> {
}, },
), ),
), ),
// 底部退出登录功能
const Divider(height: 1), // 分隔线
ListTile(
title: const Text(
'退出登录',
textAlign: TextAlign.center, // 文案居中展示
),
// 设置文本颜色为灰白色
textColor: Theme.of(context).colorScheme.onSurfaceVariant,
onTap: () => _logout(context),
tileColor: Theme.of(
context,
).colorScheme.surfaceContainerHighest,
// 移除默认内边距,使居中更美观
contentPadding: EdgeInsets.zero,
),
],
),
),
// 右侧内容区域 // 右侧内容区域
Expanded( Expanded(
@@ -150,7 +155,6 @@ class _HomePageState extends State<HomePage> {
color: Theme.of( color: Theme.of(
context, context,
).colorScheme.surfaceContainerHighest, ).colorScheme.surfaceContainerHighest,
// 使用withValues替换withOpacity
border: Border( border: Border(
bottom: BorderSide( bottom: BorderSide(
color: Theme.of( color: Theme.of(
@@ -204,6 +208,7 @@ class _HomePageState extends State<HomePage> {
// 子功能操作页面区域 // 子功能操作页面区域
Expanded(child: currentSubFunction.page), Expanded(child: currentSubFunction.page),
Expanded(child: currentSubFunction.page),
], ],
), ),
), ),