add
This commit is contained in:
@@ -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,35 +90,57 @@ class _HomePageState extends State<HomePage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: ListView.builder(
|
child: Column(
|
||||||
itemCount: _functions.length,
|
children: [
|
||||||
itemBuilder: (context, index) {
|
// 功能列表
|
||||||
final function = _functions[index];
|
Expanded(
|
||||||
return ListTile(
|
child: ListView.builder(
|
||||||
title: Text(
|
itemCount: _functions.length,
|
||||||
function.name,
|
itemBuilder: (context, index) {
|
||||||
style: TextStyle(
|
final function = _functions[index];
|
||||||
color: _selectedFunctionIndex == index
|
return ListTile(
|
||||||
? Theme.of(context).colorScheme.secondary
|
title: Text(
|
||||||
: Theme.of(context).colorScheme.onSurface,
|
function.name,
|
||||||
fontWeight: _selectedFunctionIndex == index
|
style: TextStyle(
|
||||||
? FontWeight.bold
|
color: _selectedFunctionIndex == index
|
||||||
: FontWeight.normal,
|
? Theme.of(context).colorScheme.secondary
|
||||||
),
|
: Theme.of(context).colorScheme.onSurface,
|
||||||
|
fontWeight: _selectedFunctionIndex == index
|
||||||
|
? FontWeight.bold
|
||||||
|
: FontWeight.normal,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
selected: _selectedFunctionIndex == index,
|
||||||
|
selectedTileColor: Theme.of(
|
||||||
|
context,
|
||||||
|
).colorScheme.primary.withValues(alpha: 0.1),
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
_selectedFunctionIndex = index;
|
||||||
|
_selectedSubFunctionIndex = 0; // 切换功能时默认选中第一个子功能
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
selected: _selectedFunctionIndex == index,
|
),
|
||||||
// 使用withValues替换withOpacity
|
// 底部退出登录功能
|
||||||
selectedTileColor: Theme.of(
|
const Divider(height: 1), // 分隔线
|
||||||
|
ListTile(
|
||||||
|
title: const Text(
|
||||||
|
'退出登录',
|
||||||
|
textAlign: TextAlign.center, // 文案居中展示
|
||||||
|
),
|
||||||
|
// 设置文本颜色为灰白色
|
||||||
|
textColor: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
|
onTap: () => _logout(context),
|
||||||
|
tileColor: Theme.of(
|
||||||
context,
|
context,
|
||||||
).colorScheme.primary.withValues(alpha: 0.1),
|
).colorScheme.surfaceContainerHighest,
|
||||||
onTap: () {
|
// 移除默认内边距,使居中更美观
|
||||||
setState(() {
|
contentPadding: EdgeInsets.zero,
|
||||||
_selectedFunctionIndex = index;
|
),
|
||||||
_selectedSubFunctionIndex = 0; // 切换功能时默认选中第一个子功能
|
],
|
||||||
});
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
@@ -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),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user