细节优化

This commit is contained in:
Developer
2026-03-31 20:15:16 +08:00
parent e3ca7db3cc
commit c897f50817
5 changed files with 725 additions and 502 deletions

View File

@@ -117,88 +117,90 @@ class _ActiveSearchPageState extends State<ActiveSearchPage>
children: [
// 自定义标题栏
if (isInTabBarView)
Container(
height: 56,
padding: const EdgeInsets.symmetric(horizontal: 16),
color: Colors.white,
child: Row(
children: [
// 返回按钮
//todo
IconButton(
icon: const Icon(Icons.arrow_back, color: Colors.black87),
onPressed: () {
// 检查是否可以返回,避免黑屏
if (Navigator.of(context).canPop()) {
Navigator.of(context).pop();
} else {
// 如果无法返回(如在 TabBarView 中),跳转到主页
Navigator.of(context).pushReplacement(
MaterialPageRoute(
builder: (_) => const MainNavigation(),
),
);
}
},
tooltip: '返回上一页',
),
// 标题
Expanded(
child: Row(
children: [
const Icon(
Icons.travel_explore,
size: 20,
color: Colors.black87,
),
const SizedBox(width: 8),
const Text(
'诗词搜索',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
SafeArea(
child: Container(
height: 56,
padding: const EdgeInsets.symmetric(horizontal: 16),
color: Colors.white,
child: Row(
children: [
// 返回按钮
//todo
IconButton(
icon: const Icon(Icons.arrow_back, color: Colors.black87),
onPressed: () {
// 检查是否可以返回,避免黑屏
if (Navigator.of(context).canPop()) {
Navigator.of(context).pop();
} else {
// 如果无法返回(如在 TabBarView 中),跳转到主页
Navigator.of(context).pushReplacement(
MaterialPageRoute(
builder: (_) => const MainNavigation(),
),
);
}
},
tooltip: '返回上一页',
),
// 标题
Expanded(
child: Row(
children: [
const Icon(
Icons.travel_explore,
size: 20,
color: Colors.black87,
),
),
],
),
),
// 更多按钮
IconButton(
icon: const Icon(Icons.more_vert, color: Colors.black87),
onPressed: () {
// 更多按钮的点击事件
showModalBottomSheet(
context: context,
builder: (context) => Container(
padding: const EdgeInsets.all(16),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
ListTile(
leading: const Icon(Icons.history),
title: const Text('搜索历史'),
onTap: () {
Navigator.pop(context);
// 实现搜索历史功能
},
),
ListTile(
leading: const Icon(Icons.settings),
title: const Text('搜索设置'),
onTap: () {
Navigator.pop(context);
// 实现搜索设置功能
},
),
],
const SizedBox(width: 8),
const Text(
'诗词搜索',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
color: Colors.black87,
),
),
),
);
},
tooltip: '更多',
),
],
],
),
),
// 更多按钮
IconButton(
icon: const Icon(Icons.more_vert, color: Colors.black87),
onPressed: () {
// 更多按钮的点击事件
showModalBottomSheet(
context: context,
builder: (context) => Container(
padding: const EdgeInsets.all(16),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
ListTile(
leading: const Icon(Icons.history),
title: const Text('搜索历史(开发中)'),
onTap: () {
Navigator.pop(context);
// 实现搜索历史功能
},
),
ListTile(
leading: const Icon(Icons.settings),
title: const Text('搜索设置(开发中)'),
onTap: () {
Navigator.pop(context);
// 实现搜索设置功能
},
),
],
),
),
);
},
tooltip: '更多',
),
],
),
),
),
// 搜索内容区域
@@ -209,9 +211,9 @@ class _ActiveSearchPageState extends State<ActiveSearchPage>
Padding(
padding: EdgeInsets.fromLTRB(
AppConstants.pageHorizontalPadding,
isInTabBarView ? 16 : 8,
isInTabBarView ? 8 : 4,
AppConstants.pageHorizontalPadding,
8,
4,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
@@ -256,10 +258,9 @@ class _ActiveSearchPageState extends State<ActiveSearchPage>
onChanged: (_) => setState(() {}),
),
),
const SizedBox(height: 8),
Wrap(
spacing: 8,
runSpacing: 8,
spacing: 4,
runSpacing: 4,
crossAxisAlignment: WrapCrossAlignment.center,
children: [
const Text('', style: TextStyle(fontSize: 13)),