深色模式、首页设置页面和功能优化
This commit is contained in:
@@ -4,7 +4,7 @@ import '../constants/app_constants.dart';
|
||||
/// 时间: 2026-03-22
|
||||
/// 功能: 主导航内「标题 + Tab」共用 AppBar 构造
|
||||
/// 介绍: 压缩工具栏与 Tab 行高度,关闭 M3 卷动 surface tint,统一收藏页与发现页顶部观感
|
||||
/// 最新变化: 初始提取,减少两页相同结构的顶部留白
|
||||
/// 最新变化: 2026-04-02 支持深色模式
|
||||
|
||||
/// 主导航子页(IndexedStack 内)带 [TabBar] 的页面共用 [AppBar] 配置
|
||||
class TabbedNavAppBar {
|
||||
@@ -19,19 +19,26 @@ class TabbedNavAppBar {
|
||||
bool tabBarScrollable = false,
|
||||
EdgeInsetsGeometry? tabPadding,
|
||||
EdgeInsetsGeometry? tabLabelPadding,
|
||||
Color? backgroundColor,
|
||||
Color? foregroundColor,
|
||||
}) {
|
||||
final isDark = backgroundColor != null && backgroundColor != Colors.white;
|
||||
|
||||
return AppBar(
|
||||
title: Text(
|
||||
title,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 18,
|
||||
color: Colors.black87,
|
||||
color: foregroundColor ?? (isDark ? Colors.white : Colors.black87),
|
||||
),
|
||||
),
|
||||
backgroundColor: Colors.white,
|
||||
foregroundColor: Colors.black87,
|
||||
iconTheme: const IconThemeData(color: Colors.black87),
|
||||
backgroundColor: backgroundColor ?? Colors.white,
|
||||
foregroundColor:
|
||||
foregroundColor ?? (isDark ? Colors.white : Colors.black87),
|
||||
iconTheme: IconThemeData(
|
||||
color: foregroundColor ?? (isDark ? Colors.white : Colors.black87),
|
||||
),
|
||||
elevation: 0,
|
||||
scrolledUnderElevation: 0,
|
||||
surfaceTintColor: Colors.transparent,
|
||||
@@ -49,7 +56,7 @@ class TabbedNavAppBar {
|
||||
dividerColor: Colors.transparent,
|
||||
tabs: tabLabels.map((String e) => Tab(text: e)).toList(),
|
||||
labelColor: AppConstants.primaryColor,
|
||||
unselectedLabelColor: Colors.grey[600],
|
||||
unselectedLabelColor: isDark ? Colors.grey[400] : Colors.grey[600],
|
||||
indicator: UnderlineTabIndicator(
|
||||
borderSide: BorderSide(color: AppConstants.primaryColor, width: 3),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user