fix(flutter): 修复详情与播放器底部闪白
This commit is contained in:
1 parent
9eec9ed77a
commit
0aa5a99a22
8 files changed
+201
-92
No files matched your search
@@ -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:provider/provider.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
@@ -53,6 +54,11 @@ void main() {
|
||||
) async {
|
||||
await _pumpDetail(tester);
|
||||
|
||||
final overlay = tester.widget<AnnotatedRegion<SystemUiOverlayStyle>>(
|
||||
find.byKey(const Key('detail-system-overlay')),
|
||||
);
|
||||
expect(overlay.value.systemNavigationBarColor, AppColors.ink);
|
||||
expect(overlay.value.systemNavigationBarContrastEnforced, isFalse);
|
||||
expect(find.byKey(const Key('detail-hero')), findsOneWidget);
|
||||
expect(
|
||||
tester.getSize(find.byKey(const Key('detail-poster'))),
|
||||
@@ -92,6 +98,10 @@ void main() {
|
||||
expect(find.byKey(const Key('detail-tags')), findsOneWidget);
|
||||
expect(find.byKey(const Key('detail-episodes-section')), findsOneWidget);
|
||||
expect(tester.getSize(find.byKey(const Key('detail-cta'))).height, 46);
|
||||
final bottomBar = tester.widget<Container>(
|
||||
find.byKey(const Key('detail-bottom-bar')),
|
||||
);
|
||||
expect((bottomBar.decoration! as BoxDecoration).color, AppColors.ink);
|
||||
expect(find.byKey(const Key('detail-share')), findsOneWidget);
|
||||
expect(find.byKey(const Key('detail-more')), findsOneWidget);
|
||||
for (final key in const [Key('detail-share'), Key('detail-more')]) {
|
||||
|
||||
@@ -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:shared_preferences_platform_interface/in_memory_shared_preferences_async.dart';
|
||||
import 'package:shared_preferences_platform_interface/shared_preferences_async_platform_interface.dart';
|
||||
@@ -50,6 +51,16 @@ void main() {
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
testWidgets('should_use_black_system_navigation_bar_on_feed_and_player', (
|
||||
tester,
|
||||
) async {
|
||||
await _pumpApp(tester);
|
||||
_expectPlayerNavigationBar(tester);
|
||||
|
||||
await _openSeriesPlayer(tester);
|
||||
_expectPlayerNavigationBar(tester);
|
||||
});
|
||||
|
||||
testWidgets('should_fall_back_to_black_when_poster_is_empty', (tester) async {
|
||||
await _pumpApp(
|
||||
tester,
|
||||
@@ -716,6 +727,20 @@ void main() {
|
||||
final delegate =
|
||||
grid.gridDelegate as SliverGridDelegateWithFixedCrossAxisCount;
|
||||
expect(delegate.crossAxisCount, 6);
|
||||
final overlay = tester.widget<AnnotatedRegion<SystemUiOverlayStyle>>(
|
||||
find.byKey(const Key('player-episodes-system-overlay')),
|
||||
);
|
||||
expect(overlay.value.systemNavigationBarColor, AppColors.card);
|
||||
expect(overlay.value.systemNavigationBarContrastEnforced, isFalse);
|
||||
final safeArea = tester.widget<SafeArea>(
|
||||
find
|
||||
.descendant(
|
||||
of: find.byKey(const Key('player-episodes-sheet')),
|
||||
matching: find.byType(SafeArea),
|
||||
)
|
||||
.first,
|
||||
);
|
||||
expect(safeArea.bottom, isTrue);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
@@ -969,6 +994,16 @@ void main() {
|
||||
});
|
||||
}
|
||||
|
||||
void _expectPlayerNavigationBar(WidgetTester tester) {
|
||||
final overlay = tester.widget<AnnotatedRegion<SystemUiOverlayStyle>>(
|
||||
find.byKey(const Key('player-system-overlay')).last,
|
||||
);
|
||||
expect(overlay.value.systemNavigationBarColor, Colors.black);
|
||||
expect(overlay.value.systemNavigationBarDividerColor, Colors.transparent);
|
||||
expect(overlay.value.systemNavigationBarContrastEnforced, isFalse);
|
||||
expect(overlay.value.systemNavigationBarIconBrightness, Brightness.light);
|
||||
}
|
||||
|
||||
void _expectFullscreenOverlay(WidgetTester tester) {
|
||||
expect(find.byKey(const Key('player-back')), findsOneWidget);
|
||||
expect(find.byKey(const Key('player-episode-heading')), findsOneWidget);
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
|
||||
import 'dart:math';
|
||||
|
||||
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/theme/app_colors.dart';
|
||||
import 'package:fruitshorts/core/theme/app_theme.dart';
|
||||
|
||||
@@ -50,6 +52,25 @@ void main() {
|
||||
expect(theme.appBarTheme.systemOverlayStyle, SystemUiOverlayStyle.dark);
|
||||
});
|
||||
|
||||
test('should_use_ink_navigation_bar_without_contrast_scrim', () {
|
||||
expect(appSystemOverlayStyle.statusBarColor, Colors.transparent);
|
||||
expect(appSystemOverlayStyle.systemNavigationBarColor, AppColors.ink);
|
||||
expect(
|
||||
appSystemOverlayStyle.systemNavigationBarDividerColor,
|
||||
Colors.transparent,
|
||||
);
|
||||
expect(
|
||||
appSystemOverlayStyle.systemNavigationBarIconBrightness,
|
||||
Brightness.dark,
|
||||
);
|
||||
expect(appSystemOverlayStyle.systemNavigationBarContrastEnforced, isFalse);
|
||||
|
||||
final sheetTheme = AppTheme.light().bottomSheetTheme;
|
||||
expect(sheetTheme.backgroundColor, Colors.transparent);
|
||||
expect(sheetTheme.modalBackgroundColor, Colors.transparent);
|
||||
expect(sheetTheme.surfaceTintColor, Colors.transparent);
|
||||
});
|
||||
|
||||
test('should_expose_page_gradient_and_soft_card_shadow', () {
|
||||
expect(AppTheme.pageGradient.colors, [AppColors.surfaceTop, AppColors.ink]);
|
||||
expect(AppTheme.cardShadow.color, AppColors.cardShadow);
|
||||
|
||||
Reference in new issue
Block a user