merge: 合并 K43-A 首页冷启动灰屏修复
This commit is contained in:
commit
dc73f4e3bb
4 files changed
+19
-3
No files matched your search
@@ -16,6 +16,7 @@ class RemoteImage extends StatelessWidget {
|
||||
this.showFallbackIcon = false,
|
||||
this.fallbackIconKey,
|
||||
this.fallbackAspectRatio,
|
||||
this.fallbackColor = AppColors.bar,
|
||||
});
|
||||
|
||||
final String path;
|
||||
@@ -25,6 +26,7 @@ class RemoteImage extends StatelessWidget {
|
||||
final bool showFallbackIcon;
|
||||
final Key? fallbackIconKey;
|
||||
final double? fallbackAspectRatio;
|
||||
final Color fallbackColor;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -47,7 +49,7 @@ class RemoteImage extends StatelessWidget {
|
||||
final fallback = Container(
|
||||
width: width,
|
||||
height: height,
|
||||
color: AppColors.bar,
|
||||
color: fallbackColor,
|
||||
alignment: Alignment.center,
|
||||
child: showFallbackIcon
|
||||
? Icon(
|
||||
|
||||
@@ -300,6 +300,11 @@ class _PlayerPageState extends State<PlayerPage> with WidgetsBindingObserver {
|
||||
return Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
if (widget.homeMode)
|
||||
const ColoredBox(
|
||||
key: Key('home-feed-black-background'),
|
||||
color: Colors.black,
|
||||
),
|
||||
if (!ready) _PlayerFallbackBackground(posterUrl: drama.posterUrl),
|
||||
?video,
|
||||
if (widget.homeMode && _chromeVisible && !logic.chromeHidden)
|
||||
@@ -580,10 +585,11 @@ class _PlayerFallbackBackground extends StatelessWidget {
|
||||
posterUrl,
|
||||
key: const Key('player-fallback-cover'),
|
||||
fit: BoxFit.cover,
|
||||
fallbackColor: Colors.black,
|
||||
),
|
||||
const ColoredBox(
|
||||
key: Key('player-fallback-scrim'),
|
||||
color: Color(0x66000000),
|
||||
color: Color(0x4D000000),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -59,6 +59,7 @@ void main() {
|
||||
|
||||
expect(find.byKey(const Key('home-feed-title')), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-feed-full-series')), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-feed-black-background')), findsOneWidget);
|
||||
expect(find.byType(PageView), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-browse-page')), findsNothing);
|
||||
expect(
|
||||
|
||||
@@ -13,6 +13,7 @@ import 'package:fruitshorts/core/data/repositories/favorite_repository.dart';
|
||||
import 'package:fruitshorts/core/data/repositories/playback_repository.dart';
|
||||
import 'package:fruitshorts/core/data/repositories/watch_history_repository.dart';
|
||||
import 'package:fruitshorts/core/theme/app_colors.dart';
|
||||
import 'package:fruitshorts/core/widgets/remote_image.dart';
|
||||
import 'package:fruitshorts/pages/player/widgets/player_center_toggle.dart';
|
||||
import 'package:fruitshorts/pages/player/widgets/seek_progress_bar.dart';
|
||||
|
||||
@@ -333,11 +334,17 @@ void main() {
|
||||
final fallback = find.byKey(const Key('player-fallback-background'));
|
||||
expect(fallback, findsOneWidget);
|
||||
expect(find.byKey(const Key('player-fallback-cover')), findsOneWidget);
|
||||
expect(
|
||||
tester
|
||||
.widget<RemoteImage>(find.byKey(const Key('player-fallback-cover')))
|
||||
.fallbackColor,
|
||||
Colors.black,
|
||||
);
|
||||
expect(
|
||||
tester
|
||||
.widget<ColoredBox>(find.byKey(const Key('player-fallback-scrim')))
|
||||
.color,
|
||||
const Color(0x66000000),
|
||||
const Color(0x4D000000),
|
||||
);
|
||||
expect(
|
||||
tester
|
||||
|
||||
Reference in new issue
Block a user