feat(nav): 底部导航改为首页推荐追剧我的

This commit is contained in:
Zhou Weidong committed 2026-10-22 16:21:05 +08:00
1 parent ec3cb8f163
commit 91e869d589
34 files changed
+359 -263

No files matched your search

+30 -24
View File
@@ -7,7 +7,7 @@ import 'package:fruitshorts/core/theme/app_dimens.dart';
import 'package:fruitshorts/core/widgets/app_bottom_nav.dart';
void main() {
testWidgets('should_render_four_slots_with_orange_selected_state', (
testWidgets('should_render_four_slots_with_white_selected_state', (
tester,
) async {
var theaterTaps = 0;
@@ -25,17 +25,17 @@ void main() {
onTap: () {},
),
AppBottomNavItem(
tabKey: const Key('tab-theater'),
icon: Icons.explore_outlined,
selectedIcon: Icons.explore_rounded,
label: 'Theater',
tabKey: const Key('tab-recommend'),
icon: Icons.smart_display_outlined,
selectedIcon: Icons.smart_display_rounded,
label: 'Recommend',
onTap: () => theaterTaps++,
),
AppBottomNavItem(
tabKey: const Key('tab-create'),
icon: Icons.add_box_outlined,
selectedIcon: Icons.add_box_rounded,
label: 'Create',
tabKey: const Key('tab-follow'),
icon: Icons.bookmark_border_rounded,
selectedIcon: Icons.bookmark_rounded,
label: 'Following',
onTap: () {},
),
AppBottomNavItem(
@@ -52,15 +52,21 @@ void main() {
);
expect(find.byKey(const Key('tab-home')), findsOneWidget);
expect(find.byKey(const Key('tab-theater')), findsOneWidget);
expect(find.byKey(const Key('tab-create')), findsOneWidget);
expect(find.byKey(const Key('tab-recommend')), findsOneWidget);
expect(find.byKey(const Key('tab-follow')), findsOneWidget);
expect(find.byKey(const Key('tab-mine')), findsOneWidget);
expect(find.byKey(const Key('nav-center-action')), findsNothing);
expect(find.text('Home'), findsOneWidget);
final selectedLabel = tester.widget<Text>(find.text('Home'));
expect(selectedLabel.style?.color, AppColors.navSelected);
expect(selectedLabel.style?.fontWeight, FontWeight.w600);
final unselectedLabel = tester.widget<Text>(find.text('Recommend'));
expect(unselectedLabel.style?.color, AppColors.navUnselected);
expect(unselectedLabel.style?.fontWeight, FontWeight.w400);
final centers = [
Key('tab-home'),
Key('tab-theater'),
Key('tab-create'),
Key('tab-recommend'),
Key('tab-follow'),
Key('tab-mine'),
].map((key) => tester.getCenter(find.byKey(key)).dx).toList();
expect(centers, orderedEquals(centers.toList()..sort()));
@@ -77,9 +83,9 @@ void main() {
),
)
.color,
AppColors.blue,
AppColors.navSelected,
);
await tester.tap(find.byKey(const Key('tab-theater')));
await tester.tap(find.byKey(const Key('tab-recommend')));
expect(theaterTaps, 1);
});
@@ -105,17 +111,17 @@ void main() {
onTap: () {},
),
AppBottomNavItem(
tabKey: const Key('tab-theater'),
icon: Icons.explore_outlined,
selectedIcon: Icons.explore_rounded,
label: 'Theater',
tabKey: const Key('tab-recommend'),
icon: Icons.smart_display_outlined,
selectedIcon: Icons.smart_display_rounded,
label: 'Recommend',
onTap: () {},
),
AppBottomNavItem(
tabKey: const Key('tab-create'),
icon: Icons.add_box_outlined,
selectedIcon: Icons.add_box_rounded,
label: 'Create',
tabKey: const Key('tab-follow'),
icon: Icons.bookmark_border_rounded,
selectedIcon: Icons.bookmark_rounded,
label: 'Following',
onTap: () {},
),
AppBottomNavItem(
@@ -144,6 +150,6 @@ void main() {
matching: find.byType(ColoredBox),
),
);
expect(coloredBox.color, AppColors.bar);
expect(coloredBox.color, AppColors.navBackground);
});
}