style(nav): 对齐四 Tab 底栏布局规格

This commit is contained in:
Zhou Weidong committed 2026-10-22 16:38:14 +08:00
1 parent 667fdc5f0a
commit 81787dc3aa
10 files changed
+103 -106

No files matched your search

+4 -16
View File
@@ -17,7 +17,6 @@ import '../../core/formatting/error_text.dart';
import '../../core/theme/app_colors.dart';
import '../../core/theme/app_dimens.dart';
import '../../core/theme/app_theme.dart';
import '../../core/widgets/app_bottom_nav.dart';
import '../../core/widgets/app_pull_to_refresh.dart';
import '../../core/widgets/app_root_tab.dart';
import '../../core/widgets/catalog_debug_info.dart';
@@ -160,7 +159,7 @@ class _DiscoverPageState extends State<DiscoverPage> {
loading: logic.searchLoading,
),
Expanded(child: _feed(l10n, categories)),
if (!embedded) _bottomNav(l10n),
if (!embedded) _bottomNav(),
],
),
),
@@ -612,20 +611,9 @@ class _DiscoverPageState extends State<DiscoverPage> {
unawaited(playDramaFromCatalog(context, drama));
}
Widget _bottomNav(AppLocalizations l10n) => AppBottomNav(
items: [
for (final tab in AppRootTab.values)
AppBottomNavItem(
tabKey: tab.tabKey,
icon: tab.icon,
selectedIcon: tab.selectedIcon,
label: tab.label(l10n),
selected: tab == AppRootTab.recommend,
onTap: tab == AppRootTab.recommend
? () {}
: () => _act(_actionOf(tab)),
),
],
Widget _bottomNav() => AppRootBottomNav(
selected: AppRootTab.recommend,
onSelected: (tab) => _act(_actionOf(tab)),
);
DiscoverPageAction _actionOf(AppRootTab tab) => switch (tab) {
+5 -27
View File
@@ -16,7 +16,6 @@ import '../../core/data/services/category_controller.dart';
import '../../core/platform/haptics.dart';
import '../../core/theme/app_colors.dart';
import '../../core/theme/app_theme.dart';
import '../../core/widgets/app_bottom_nav.dart';
import '../../core/widgets/app_root_tab.dart';
import '../../core/widgets/catalog_debug_info.dart';
import '../../core/widgets/catalog_endpoint_editor.dart';
@@ -262,7 +261,6 @@ class _HomeTabsState extends State<_HomeTabs> {
}
Widget _scaffold(BuildContext context) {
final l10n = AppLocalizations.of(context)!;
final feed = logic.tab == 0;
final content = PopScope(
canPop: false,
@@ -275,7 +273,7 @@ class _HomeTabsState extends State<_HomeTabs> {
backgroundColor: AppColors.transparent,
resizeToAvoidBottomInset: false,
body: _body(context),
bottomNavigationBar: logic.videoImmersive ? null : _nav(context, l10n),
bottomNavigationBar: logic.videoImmersive ? null : _nav(context),
),
);
return AnnotatedRegion<SystemUiOverlayStyle>(
@@ -451,31 +449,11 @@ class _HomeTabsState extends State<_HomeTabs> {
);
}
Widget _nav(BuildContext context, AppLocalizations l10n) {
return AppBottomNav(
Widget _nav(BuildContext context) {
return AppRootBottomNav(
barKey: const Key('home-tabs-bar'),
dark: logic.tab == 0,
items: [
_navItem(context, l10n, AppRootTab.home),
_navItem(context, l10n, AppRootTab.recommend),
_navItem(context, l10n, AppRootTab.following),
_navItem(context, l10n, AppRootTab.mine),
],
);
}
AppBottomNavItem _navItem(
BuildContext context,
AppLocalizations l10n,
AppRootTab tab,
) {
return AppBottomNavItem(
tabKey: tab.tabKey,
icon: tab.icon,
selectedIcon: tab.selectedIcon,
label: tab.label(l10n),
selected: logic.tab == tab.index,
onTap: () => _selectTab(context, tab.index),
selected: AppRootTab.values[logic.tab],
onSelected: (tab) => _selectTab(context, tab.index),
);
}
+5 -15
View File
@@ -12,7 +12,6 @@ import '../../core/data/services/wallet_controller.dart';
import '../../core/theme/app_colors.dart';
import '../../core/theme/app_dimens.dart';
import '../../core/theme/app_theme.dart';
import '../../core/widgets/app_bottom_nav.dart';
import '../../core/widgets/app_root_tab.dart';
import '../../core/widgets/auth_gate.dart';
import '../../core/widgets/plain_page_scaffold.dart';
@@ -87,7 +86,7 @@ class _MyPageState extends State<MyPage> {
children: [
_topBar(l10n),
Expanded(child: _body(context, l10n)),
if (!embedded) _bottomNav(l10n),
if (!embedded) _bottomNav(),
],
),
);
@@ -238,19 +237,10 @@ class _MyPageState extends State<MyPage> {
_openProtected(RechargePage(onPurchased: () => unawaited(wallet.load())));
}
Widget _bottomNav(AppLocalizations l10n) {
return AppBottomNav(
items: [
for (final tab in AppRootTab.values)
AppBottomNavItem(
tabKey: tab.tabKey,
icon: tab.icon,
selectedIcon: tab.selectedIcon,
label: tab.label(l10n),
selected: tab == AppRootTab.mine,
onTap: tab == AppRootTab.mine ? () {} : () => _act(_actionOf(tab)),
),
],
Widget _bottomNav() {
return AppRootBottomNav(
selected: AppRootTab.mine,
onSelected: (tab) => _act(_actionOf(tab)),
);
}