feat(flutter): 应用浅色暖橙视觉主题

This commit is contained in:
Zhou Weidong committed 2026-10-20 10:15:03 +08:00
1 parent 0d2367431d
commit 634b63e16c
56 files changed
+941 -409

No files matched your search

+55 -5
View File
@@ -2,13 +2,13 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:fruitshorts/core/theme/app_colors.dart';
import 'package:fruitshorts/core/theme/app_dimens.dart';
import 'package:fruitshorts/core/widgets/app_bottom_nav.dart';
void main() {
testWidgets('should_render_64_high_navigation_and_keep_item_keys', (
tester,
) async {
testWidgets('should_render_five_slots_with_center_action', (tester) async {
var centerTaps = 0;
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
@@ -23,24 +23,74 @@ void main() {
onTap: () {},
),
AppBottomNavItem(
tabKey: const Key('tab-my'),
tabKey: const Key('tab-theater'),
icon: Icons.explore_outlined,
selectedIcon: Icons.explore_rounded,
label: 'Theater',
onTap: () {},
),
AppBottomNavItem(
tabKey: const Key('tab-create'),
icon: Icons.add_box_outlined,
selectedIcon: Icons.add_box_rounded,
label: 'Create',
onTap: () {},
),
AppBottomNavItem(
tabKey: const Key('tab-mine'),
icon: Icons.person_outline_rounded,
selectedIcon: Icons.person_rounded,
label: 'Me',
onTap: () {},
),
],
centerAction: AppBottomNavCenterAction(
label: 'Create',
onTap: () => centerTaps++,
),
),
),
),
);
expect(find.byKey(const Key('tab-home')), findsOneWidget);
expect(find.byKey(const Key('tab-my')), findsOneWidget);
expect(find.byKey(const Key('tab-theater')), findsOneWidget);
expect(find.byKey(const Key('nav-center-action')), findsOneWidget);
expect(find.byKey(const Key('tab-create')), findsOneWidget);
expect(find.byKey(const Key('tab-mine')), findsOneWidget);
expect(find.text('Home'), findsOneWidget);
final centers = [
Key('tab-home'),
Key('tab-theater'),
Key('nav-center-action'),
Key('tab-create'),
Key('tab-mine'),
].map((key) => tester.getCenter(find.byKey(key)).dx).toList();
expect(centers, orderedEquals(centers.toList()..sort()));
expect(
tester.getSize(find.byType(AppBottomNav)).height,
AppDimens.navHeight,
);
expect(
tester.getSize(find.byKey(const Key('nav-center-action'))),
const Size.square(AppDimens.navCenter),
);
final ink = tester.widget<Ink>(
find
.ancestor(
of: find.byKey(const Key('nav-center-action')),
matching: find.byType(Ink),
)
.first,
);
final decoration = ink.decoration! as BoxDecoration;
expect(decoration.shape, BoxShape.circle);
expect((decoration.gradient! as LinearGradient).colors, const [
AppColors.navCenterStart,
AppColors.navCenterEnd,
]);
await tester.tap(find.byKey(const Key('nav-center-action')));
expect(centerTaps, 1);
});
}