feat(ui): 更新底栏图标与播放加载视觉

This commit is contained in:
Zhou Weidong authored and Vicky committed 2026-10-31 14:35:26 +08:00
1 parent 8ec6df2be5
commit 12b1a11bd3
11 files changed
+584 -70

No files matched your search

+15 -12
View File
@@ -313,7 +313,7 @@ void main() {
.first;
expect(loadingOverlay, findsOneWidget);
expect(tester.widget<IgnorePointer>(loadingOverlay).ignoring, isTrue);
expect(tester.getSize(loadingOverlay), const Size(40, 40));
expect(tester.getSize(loadingOverlay), const Size(56, 36));
expect(
tester
.widget<AnimatedOpacity>(
@@ -327,26 +327,29 @@ void main() {
);
expect(
tester.getSize(find.byKey(const Key('player-loading-surface'))),
const Size(40, 40),
const Size(56, 36),
);
expect(
tester.getSize(find.byKey(const Key('player-entry-loading'))),
const Size(20, 20),
const Size(48, 29),
);
expect(
tester
.widget<CircularProgressIndicator>(
find.byKey(const Key('player-entry-loading')),
)
.color,
Colors.white,
find.descendant(
of: loadingOverlay,
matching: find.byType(CircularProgressIndicator),
),
findsNothing,
);
expect(find.text('Loading'), findsNothing);
expect(find.byKey(const Key('player-entry-loading-track')), findsNothing);
expect(
find.byKey(const Key('player-entry-loading-highlight')),
findsNothing,
);
final loadingSurface = tester.widget<Container>(
find.byKey(const Key('player-loading-surface')),
);
final decoration = loadingSurface.decoration! as BoxDecoration;
expect(decoration.color, AppColors.refreshIndicatorSurface);
expect(decoration.borderRadius, BorderRadius.circular(20));
expect(loadingSurface.decoration, isNull);
expect(
find.descendant(of: loadingOverlay, matching: find.byType(ColoredBox)),
findsNothing,
@@ -0,0 +1,73 @@
// Author: fruit.com.cn
// 职责:验证剧集播放页 YMB 入场 loading 的品牌视觉、运动和减少动画行为。
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:fruitshorts/l10n/app_localizations.dart';
import 'package:fruitshorts/pages/player/widgets/player_loading_overlay.dart';
const _surface = Key('player-loading-surface');
const _logo = Key('player-entry-loading');
const _motion = Key('player-entry-loading-motion');
void main() {
testWidgets('should_show_ymb_motion_without_circular_spinner', (
tester,
) async {
await _pump(tester);
expect(find.byType(CircularProgressIndicator), findsNothing);
expect(find.byKey(_surface), findsOneWidget);
expect(find.byKey(_logo), findsOneWidget);
expect(find.text('Loading'), findsNothing);
expect(find.byKey(const Key('player-entry-loading-track')), findsNothing);
expect(
find.byKey(const Key('player-entry-loading-highlight')),
findsNothing,
);
expect(find.byType(ShaderMask), findsOneWidget);
expect(tester.getSize(find.byKey(_surface)), const Size(56, 36));
expect(tester.getSize(find.byKey(_logo)), const Size(48, 29));
expect(tester.widget<Container>(find.byKey(_surface)).decoration, isNull);
final initialScale = _scaleOf(tester);
await tester.pump(const Duration(milliseconds: 300));
expect(_scaleOf(tester), isNot(initialScale));
});
testWidgets('should_keep_loading_static_when_motion_is_disabled', (
tester,
) async {
await _pump(tester, disableAnimations: true);
final initialScale = _scaleOf(tester);
await tester.pump(const Duration(milliseconds: 300));
expect(_scaleOf(tester), initialScale);
expect(find.byKey(_logo), findsOneWidget);
expect(find.text('Loading'), findsNothing);
});
}
double _scaleOf(WidgetTester tester) {
return tester.widget<Transform>(find.byKey(_motion)).transform.storage.first;
}
Future<void> _pump(
WidgetTester tester, {
bool disableAnimations = false,
}) async {
await tester.pumpWidget(
MaterialApp(
locale: const Locale('en'),
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
home: MediaQuery(
data: MediaQueryData(disableAnimations: disableAnimations),
child: Scaffold(
body: Center(
child: PlayerLoadingOverlay(opacity: 1, onFadeEnd: () {}),
),
),
),
),
);
}