fix(ui): 修正六屏顶栏与内容间距
This commit is contained in:
1 parent
e03ea76505
commit
2fd92cdbea
11 files changed
+281
-66
No files matched your search
@@ -34,7 +34,7 @@ void main() {
|
||||
await tester.tap(find.byKey(const Key('home-drama-card-city-lights-demo')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
_expectFullscreenOverlay();
|
||||
_expectFullscreenOverlay(tester);
|
||||
expect(find.byType(PageView), findsOneWidget);
|
||||
await tester.tap(find.byKey(const Key('player-more')));
|
||||
await tester.pumpAndSettle();
|
||||
@@ -56,13 +56,13 @@ void main() {
|
||||
|
||||
await tester.tap(find.byKey(const Key('detail-cta')));
|
||||
await tester.pumpAndSettle();
|
||||
_expectFullscreenOverlay();
|
||||
_expectFullscreenOverlay(tester);
|
||||
|
||||
await tester.binding.handlePopRoute();
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byKey(const Key('detail-episode-chip-2')));
|
||||
await tester.pumpAndSettle();
|
||||
_expectFullscreenOverlay();
|
||||
_expectFullscreenOverlay(tester);
|
||||
expect(
|
||||
tester.widget<Text>(find.byKey(const Key('player-title'))).data,
|
||||
contains('Episode 2'),
|
||||
@@ -156,12 +156,33 @@ void main() {
|
||||
isFalse,
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('should_fit_player_header_on_320_width', (tester) async {
|
||||
await _pumpApp(tester, size: const Size(320, 568));
|
||||
await tester.binding.handlePopRoute();
|
||||
await tester.pumpAndSettle();
|
||||
await tester.binding.handlePopRoute();
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byKey(const Key('drawer-open-series')));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byKey(const Key('detail-cta')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(
|
||||
tester.getSize(find.byKey(const Key('player-back'))),
|
||||
const Size(36, 36),
|
||||
);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
}
|
||||
|
||||
void _expectFullscreenOverlay() {
|
||||
void _expectFullscreenOverlay(WidgetTester tester) {
|
||||
expect(find.byKey(const Key('player-back')), findsOneWidget);
|
||||
expect(find.byKey(const Key('player-title')), findsOneWidget);
|
||||
expect(find.byKey(const Key('player-more')), findsOneWidget);
|
||||
for (final key in const [Key('player-back'), Key('player-more')]) {
|
||||
expect(tester.getSize(find.byKey(key)), const Size(36, 36));
|
||||
}
|
||||
expect(find.byKey(const Key('player-play-toggle')), findsOneWidget);
|
||||
expect(find.byKey(const Key('player-episodes')), findsOneWidget);
|
||||
expect(find.byKey(const Key('player-comments')), findsOneWidget);
|
||||
@@ -172,8 +193,11 @@ void _expectFullscreenOverlay() {
|
||||
expect(find.byKey(const Key('rail-save')), findsNothing);
|
||||
}
|
||||
|
||||
Future<void> _pumpApp(WidgetTester tester) async {
|
||||
tester.view.physicalSize = const Size(390, 844);
|
||||
Future<void> _pumpApp(
|
||||
WidgetTester tester, {
|
||||
Size size = const Size(390, 844),
|
||||
}) async {
|
||||
tester.view.physicalSize = size;
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
|
||||
Reference in new issue
Block a user