feat(ui): 重做三 Tab 首页与发现页
This commit is contained in:
1 parent
eae1c533ce
commit
e8c1859e70
23 files changed
+1734
-432
No files matched your search
@@ -15,7 +15,7 @@ class HomeLogic extends ChangeNotifier {
|
||||
|
||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
Drama currentDrama;
|
||||
int tab = 1;
|
||||
int tab = 0;
|
||||
int searchRequest = 0;
|
||||
int sectionRequest = 0;
|
||||
int resumeRequest = 0;
|
||||
|
||||
@@ -244,35 +244,30 @@ class _HomeTabsState extends State<_HomeTabs> {
|
||||
barKey: const Key('home-tabs-bar'),
|
||||
items: [
|
||||
AppBottomNavItem(
|
||||
tabKey: const Key('tab-discover'),
|
||||
tabKey: const Key('tab-home'),
|
||||
icon: Icons.home_outlined,
|
||||
selectedIcon: Icons.home_rounded,
|
||||
label: l10n.homeTab,
|
||||
selected: logic.tab == 1,
|
||||
onTap: () => _selectTab(context, 1),
|
||||
),
|
||||
AppBottomNavItem(
|
||||
tabKey: const Key('tab-home'),
|
||||
icon: Icons.movie_outlined,
|
||||
selectedIcon: Icons.movie_rounded,
|
||||
label: l10n.shortsTab,
|
||||
selected: logic.tab == 0,
|
||||
indicatorKey: const Key('tab-home-indicator'),
|
||||
onTap: () => _selectTab(context, 0),
|
||||
),
|
||||
AppBottomNavItem(
|
||||
tabKey: const Key('tab-my-list'),
|
||||
icon: Icons.bookmark_border_rounded,
|
||||
selectedIcon: Icons.bookmark_rounded,
|
||||
label: l10n.myListTab,
|
||||
selected: logic.tab == 2 && !logic.profile,
|
||||
onTap: () => _selectTab(context, 2),
|
||||
tabKey: const Key('tab-discover'),
|
||||
icon: Icons.explore_outlined,
|
||||
selectedIcon: Icons.explore_rounded,
|
||||
label: l10n.discoverTab,
|
||||
selected: logic.tab == 1,
|
||||
indicatorKey: const Key('tab-discover-indicator'),
|
||||
onTap: () => _selectTab(context, 1),
|
||||
),
|
||||
AppBottomNavItem(
|
||||
tabKey: const Key('tab-my'),
|
||||
icon: Icons.person_outline_rounded,
|
||||
selectedIcon: Icons.person_rounded,
|
||||
label: l10n.myTab,
|
||||
selected: logic.tab == 2 && logic.profile,
|
||||
selected: logic.tab == 2,
|
||||
indicatorKey: const Key('tab-my-indicator'),
|
||||
onTap: () => _selectTab(context, 2, myProfile: true),
|
||||
),
|
||||
],
|
||||
@@ -282,9 +277,7 @@ class _HomeTabsState extends State<_HomeTabs> {
|
||||
}
|
||||
|
||||
void _selectTab(BuildContext context, int tab, {bool myProfile = false}) {
|
||||
final same = tab == 2
|
||||
? logic.tab == 2 && logic.profile == myProfile
|
||||
: logic.tab == tab;
|
||||
final same = logic.tab == tab;
|
||||
if (!same) {
|
||||
unawaited(context.read<Haptics>().selectionClick());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user