fix(flutter): 首页 feed 去底色并优化整集条
This commit is contained in:
1 parent
f94926cff5
commit
636b369bd4
6 files changed
+171
-97
No files matched your search
@@ -209,17 +209,38 @@ void main() {
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final bar = tester.getRect(find.byKey(const Key('home-feed-full-series')));
|
||||
expect(bar.height, 44);
|
||||
expect(
|
||||
tester.getRect(find.textContaining('Watch full series')).center.dy,
|
||||
closeTo(bar.center.dy, 2),
|
||||
);
|
||||
expect(
|
||||
tester.getSize(find.byKey(const Key('home-feed-progress-thumb'))),
|
||||
const Size(6, 6),
|
||||
);
|
||||
|
||||
await tester.tap(find.byKey(const Key('home-feed-refresh')));
|
||||
await tester.pump();
|
||||
expect(refreshed, 1);
|
||||
|
||||
await tester.drag(
|
||||
find.byKey(const Key('home-feed-progress')),
|
||||
const Offset(120, 0),
|
||||
final gesture = await tester.startGesture(
|
||||
tester.getCenter(find.byKey(const Key('home-feed-progress'))),
|
||||
);
|
||||
await gesture.moveBy(const Offset(120, 0));
|
||||
await tester.pump();
|
||||
expect(
|
||||
tester.getSize(find.byKey(const Key('home-feed-progress-thumb'))),
|
||||
const Size(10, 10),
|
||||
);
|
||||
await gesture.up();
|
||||
await tester.pumpAndSettle();
|
||||
expect(seeked, isNotNull);
|
||||
expect(seeked!.inSeconds, greaterThan(0));
|
||||
expect(
|
||||
tester.getSize(find.byKey(const Key('home-feed-progress-thumb'))),
|
||||
const Size(6, 6),
|
||||
);
|
||||
|
||||
await tester.tap(find.byKey(const Key('home-feed-full-series')));
|
||||
await tester.pump();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Author: fruit.com.cn
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:fruitshorts/app.dart';
|
||||
import 'package:fruitshorts/core/data/repositories/favorite_repository.dart';
|
||||
@@ -70,8 +71,10 @@ void main() {
|
||||
expect(find.byKey(const Key('home-feed-fullscreen')), findsNothing);
|
||||
expect(
|
||||
tester.widget<Scaffold>(find.byType(Scaffold).first).backgroundColor,
|
||||
Colors.black,
|
||||
Colors.transparent,
|
||||
);
|
||||
expect(find.byKey(const Key('home-page-gradient')), findsNothing);
|
||||
expect(_hasLightStatusBar(tester), isTrue);
|
||||
expect(tester.widget<PlayerPage>(find.byType(PlayerPage)).homeMode, isTrue);
|
||||
});
|
||||
|
||||
@@ -93,6 +96,19 @@ void main() {
|
||||
expect(find.text('Coming soon'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should_restore_light_theme_after_leaving_feed_tab', (
|
||||
tester,
|
||||
) async {
|
||||
await _pumpApp(tester);
|
||||
expect(_hasLightStatusBar(tester), isTrue);
|
||||
|
||||
await tester.tap(find.byKey(const Key('tab-theater')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byKey(const Key('home-page-gradient')), findsOneWidget);
|
||||
expect(_hasLightStatusBar(tester), isFalse);
|
||||
});
|
||||
|
||||
testWidgets('should_switch_feed_drama_when_swiped_up', (tester) async {
|
||||
await _pumpApp(tester);
|
||||
final before = tester
|
||||
@@ -108,6 +124,28 @@ void main() {
|
||||
expect(after, isNot(before));
|
||||
});
|
||||
|
||||
testWidgets('should_resume_feed_after_returning_from_full_player', (
|
||||
tester,
|
||||
) async {
|
||||
await _pumpApp(tester);
|
||||
await tester.tap(find.byKey(const Key('home-feed-video-toggle')));
|
||||
await tester.pump();
|
||||
expect(find.byKey(const Key('home-feed-center-play')), findsOneWidget);
|
||||
|
||||
await tester.tap(find.byKey(const Key('home-feed-full-series')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(
|
||||
tester.widget<PlayerPage>(find.byType(PlayerPage).last).homeMode,
|
||||
isFalse,
|
||||
);
|
||||
|
||||
await tester.tap(find.byKey(const Key('player-back')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byKey(const Key('home-feed-title')), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-feed-center-play')), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('should_hide_feed_when_switching_to_theater', (tester) async {
|
||||
await _pumpApp(tester);
|
||||
expect(find.byKey(const Key('home-feed-title')), findsOneWidget);
|
||||
@@ -196,6 +234,12 @@ const _tabKeys = [
|
||||
Key('tab-mine'),
|
||||
];
|
||||
|
||||
bool _hasLightStatusBar(WidgetTester tester) => tester
|
||||
.widgetList<AnnotatedRegion<SystemUiOverlayStyle>>(
|
||||
find.byType(AnnotatedRegion<SystemUiOverlayStyle>),
|
||||
)
|
||||
.any((region) => region.value.statusBarIconBrightness == Brightness.light);
|
||||
|
||||
Future<void> _pumpApp(
|
||||
WidgetTester tester, {
|
||||
Size size = const Size(390, 844),
|
||||
|
||||
Reference in new issue
Block a user