MOD: renamed to SplashVideo which makes more sense
This commit is contained in:
parent
19e889617b
commit
c2fee98cd0
|
|
@ -33,7 +33,7 @@ void main() {
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: SplashVideoPage(
|
home: SplashVideo(
|
||||||
source: AssetSource('assets/videos/splash.mp4'),
|
source: AssetSource('assets/videos/splash.mp4'),
|
||||||
nextScreen: const Scaffold(),
|
nextScreen: const Scaffold(),
|
||||||
onVideoComplete: () {},
|
onVideoComplete: () {},
|
||||||
|
|
@ -51,7 +51,7 @@ void main() {
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: SplashVideoPage(
|
home: SplashVideo(
|
||||||
source: AssetSource('assets/videos/splash.mp4'),
|
source: AssetSource('assets/videos/splash.mp4'),
|
||||||
controller: controller,
|
controller: controller,
|
||||||
nextScreen: const Scaffold(),
|
nextScreen: const Scaffold(),
|
||||||
|
|
@ -69,7 +69,7 @@ void main() {
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: SplashVideoPage(
|
home: SplashVideo(
|
||||||
source: AssetSource('assets/videos/splash.mp4'),
|
source: AssetSource('assets/videos/splash.mp4'),
|
||||||
controller: controller,
|
controller: controller,
|
||||||
onVideoComplete: () {},
|
onVideoComplete: () {},
|
||||||
|
|
@ -87,7 +87,7 @@ void main() {
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: SplashVideoPage(
|
home: SplashVideo(
|
||||||
source: AssetSource('assets/invalid/nonexistent.mp4'),
|
source: AssetSource('assets/invalid/nonexistent.mp4'),
|
||||||
nextScreen: const Scaffold(),
|
nextScreen: const Scaffold(),
|
||||||
),
|
),
|
||||||
|
|
@ -108,7 +108,7 @@ void main() {
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: SplashVideoPage(
|
home: SplashVideo(
|
||||||
source: AssetSource('assets/invalid/nonexistent.mp4'),
|
source: AssetSource('assets/invalid/nonexistent.mp4'),
|
||||||
onVideoError: (error) {
|
onVideoError: (error) {
|
||||||
capturedError = error;
|
capturedError = error;
|
||||||
|
|
@ -130,7 +130,7 @@ void main() {
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: SplashVideoPage(
|
home: SplashVideo(
|
||||||
source: NetworkFileSource('https://invalid.example.com/video.mp4'),
|
source: NetworkFileSource('https://invalid.example.com/video.mp4'),
|
||||||
onVideoError: (e) => error = e,
|
onVideoError: (e) => error = e,
|
||||||
),
|
),
|
||||||
|
|
@ -148,7 +148,7 @@ void main() {
|
||||||
testWidgets('renders title widget overlay', (WidgetTester tester) async {
|
testWidgets('renders title widget overlay', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: SplashVideoPage(
|
home: SplashVideo(
|
||||||
source: AssetSource('assets/videos/splash.mp4'),
|
source: AssetSource('assets/videos/splash.mp4'),
|
||||||
titleWidget: const Text('Welcome'),
|
titleWidget: const Text('Welcome'),
|
||||||
onVideoError: (_) {},
|
onVideoError: (_) {},
|
||||||
|
|
@ -163,7 +163,7 @@ void main() {
|
||||||
testWidgets('renders footer widget overlay', (WidgetTester tester) async {
|
testWidgets('renders footer widget overlay', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: SplashVideoPage(
|
home: SplashVideo(
|
||||||
source: AssetSource('assets/videos/splash.mp4'),
|
source: AssetSource('assets/videos/splash.mp4'),
|
||||||
footerWidget: const Text('Loading...'),
|
footerWidget: const Text('Loading...'),
|
||||||
onVideoError: (_) {},
|
onVideoError: (_) {},
|
||||||
|
|
@ -179,7 +179,7 @@ void main() {
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: SplashVideoPage(
|
home: SplashVideo(
|
||||||
source: AssetSource('assets/videos/splash.mp4'),
|
source: AssetSource('assets/videos/splash.mp4'),
|
||||||
overlayBuilder: (context) => const Text('Custom Overlay'),
|
overlayBuilder: (context) => const Text('Custom Overlay'),
|
||||||
onVideoError: (_) {},
|
onVideoError: (_) {},
|
||||||
|
|
@ -194,7 +194,7 @@ void main() {
|
||||||
testWidgets('renders all overlays together', (WidgetTester tester) async {
|
testWidgets('renders all overlays together', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: SplashVideoPage(
|
home: SplashVideo(
|
||||||
source: AssetSource('assets/videos/splash.mp4'),
|
source: AssetSource('assets/videos/splash.mp4'),
|
||||||
titleWidget: const Text('Title'),
|
titleWidget: const Text('Title'),
|
||||||
footerWidget: const Text('Footer'),
|
footerWidget: const Text('Footer'),
|
||||||
|
|
@ -219,7 +219,7 @@ void main() {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: Builder(
|
home: Builder(
|
||||||
builder: (context) => SplashVideoPage(
|
builder: (context) => SplashVideo(
|
||||||
source: AssetSource('assets/videos/splash.mp4'),
|
source: AssetSource('assets/videos/splash.mp4'),
|
||||||
controller: controller,
|
controller: controller,
|
||||||
footerWidget: ElevatedButton(
|
footerWidget: ElevatedButton(
|
||||||
|
|
@ -253,7 +253,7 @@ void main() {
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: SplashVideoPage(
|
home: SplashVideo(
|
||||||
source: AssetSource('assets/videos/splash.mp4'),
|
source: AssetSource('assets/videos/splash.mp4'),
|
||||||
controller: controller,
|
controller: controller,
|
||||||
onVideoError: (_) {},
|
onVideoError: (_) {},
|
||||||
|
|
@ -282,7 +282,7 @@ void main() {
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: SplashVideoPage(
|
home: SplashVideo(
|
||||||
source: AssetSource('assets/videos/splash.mp4'),
|
source: AssetSource('assets/videos/splash.mp4'),
|
||||||
onVideoError: (_) {},
|
onVideoError: (_) {},
|
||||||
),
|
),
|
||||||
|
|
@ -291,14 +291,14 @@ void main() {
|
||||||
|
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
// Widget should be created without exceptions
|
// Widget should be created without exceptions
|
||||||
expect(find.byType(SplashVideoPage), findsOneWidget);
|
expect(find.byType(SplashVideo), findsOneWidget);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('NetworkFileSource accepts valid URL',
|
testWidgets('NetworkFileSource accepts valid URL',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: SplashVideoPage(
|
home: SplashVideo(
|
||||||
source: NetworkFileSource('https://example.com/video.mp4'),
|
source: NetworkFileSource('https://example.com/video.mp4'),
|
||||||
onVideoError: (_) {},
|
onVideoError: (_) {},
|
||||||
),
|
),
|
||||||
|
|
@ -306,14 +306,14 @@ void main() {
|
||||||
);
|
);
|
||||||
|
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
expect(find.byType(SplashVideoPage), findsOneWidget);
|
expect(find.byType(SplashVideo), findsOneWidget);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('DeviceFileSource accepts file path',
|
testWidgets('DeviceFileSource accepts file path',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: SplashVideoPage(
|
home: SplashVideo(
|
||||||
source: DeviceFileSource('/path/to/video.mp4'),
|
source: DeviceFileSource('/path/to/video.mp4'),
|
||||||
onVideoError: (_) {},
|
onVideoError: (_) {},
|
||||||
),
|
),
|
||||||
|
|
@ -321,7 +321,7 @@ void main() {
|
||||||
);
|
);
|
||||||
|
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
expect(find.byType(SplashVideoPage), findsOneWidget);
|
expect(find.byType(SplashVideo), findsOneWidget);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -330,7 +330,7 @@ void main() {
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: SplashVideoPage(
|
home: SplashVideo(
|
||||||
source: AssetSource('assets/videos/splash.mp4'),
|
source: AssetSource('assets/videos/splash.mp4'),
|
||||||
videoConfig: const VideoConfig(useSafeArea: true),
|
videoConfig: const VideoConfig(useSafeArea: true),
|
||||||
onVideoError: (_) {},
|
onVideoError: (_) {},
|
||||||
|
|
@ -339,7 +339,7 @@ void main() {
|
||||||
);
|
);
|
||||||
|
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
expect(find.byType(SplashVideoPage), findsOneWidget);
|
expect(find.byType(SplashVideo), findsOneWidget);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('supports different visibility modes',
|
testWidgets('supports different visibility modes',
|
||||||
|
|
@ -347,7 +347,7 @@ void main() {
|
||||||
for (final mode in VisibilityEnum.values) {
|
for (final mode in VisibilityEnum.values) {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: SplashVideoPage(
|
home: SplashVideo(
|
||||||
source: AssetSource('assets/videos/splash.mp4'),
|
source: AssetSource('assets/videos/splash.mp4'),
|
||||||
videoConfig: VideoConfig(videoVisibilityEnum: mode),
|
videoConfig: VideoConfig(videoVisibilityEnum: mode),
|
||||||
onVideoError: (_) {},
|
onVideoError: (_) {},
|
||||||
|
|
@ -356,7 +356,7 @@ void main() {
|
||||||
);
|
);
|
||||||
|
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
expect(find.byType(SplashVideoPage), findsOneWidget);
|
expect(find.byType(SplashVideo), findsOneWidget);
|
||||||
|
|
||||||
// Clean up for next iteration
|
// Clean up for next iteration
|
||||||
await tester.pumpWidget(Container());
|
await tester.pumpWidget(Container());
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,9 @@ void main() async {
|
||||||
debugPrint('========================================');
|
debugPrint('========================================');
|
||||||
|
|
||||||
// Initialize and run the app
|
// Initialize and run the app
|
||||||
SplashVideoPage.initialize();
|
SplashVideo.initialize();
|
||||||
|
|
||||||
final mediaKitWorking = await SplashVideoPage.testMediaKit();
|
final mediaKitWorking = await SplashVideo.testMediaKit();
|
||||||
|
|
||||||
if (!mediaKitWorking) {
|
if (!mediaKitWorking) {
|
||||||
debugPrint('');
|
debugPrint('');
|
||||||
|
|
@ -80,7 +80,7 @@ class _DiagnosticPageState extends State<DiagnosticPage> {
|
||||||
body: Stack(
|
body: Stack(
|
||||||
children: [
|
children: [
|
||||||
// The splash video
|
// The splash video
|
||||||
SplashVideoPage(
|
SplashVideo(
|
||||||
source: AssetSource('assets/splash.mp4'),
|
source: AssetSource('assets/splash.mp4'),
|
||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.black,
|
||||||
onVideoError: (error) {
|
onVideoError: (error) {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ void main() {
|
||||||
|
|
||||||
// Initialize SplashVideo: defer first frame & setup MediaKit
|
// Initialize SplashVideo: defer first frame & setup MediaKit
|
||||||
// This is safe because our first screen IS a SplashVideoPage
|
// This is safe because our first screen IS a SplashVideoPage
|
||||||
SplashVideoPage.initialize();
|
SplashVideo.initialize();
|
||||||
|
|
||||||
runApp(const MyApp());
|
runApp(const MyApp());
|
||||||
}
|
}
|
||||||
|
|
@ -56,7 +56,7 @@ class InitialSplashExample extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SplashVideoPage(
|
return SplashVideo(
|
||||||
source: AssetSource(ExampleSelector.kFilePath),
|
source: AssetSource(ExampleSelector.kFilePath),
|
||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.black,
|
||||||
nextScreen: const ExampleSelector(),
|
nextScreen: const ExampleSelector(),
|
||||||
|
|
@ -289,7 +289,7 @@ class AutoNavigateExample extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SplashVideoPage(
|
return SplashVideo(
|
||||||
source: AssetSource(ExampleSelector.kFilePath),
|
source: AssetSource(ExampleSelector.kFilePath),
|
||||||
nextScreen: const HomeScreen(title: 'Auto-Navigate Example'),
|
nextScreen: const HomeScreen(title: 'Auto-Navigate Example'),
|
||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.black,
|
||||||
|
|
@ -314,7 +314,7 @@ class ManualControlExample extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SplashVideoPage(
|
return SplashVideo(
|
||||||
source: AssetSource(ExampleSelector.kFilePath),
|
source: AssetSource(ExampleSelector.kFilePath),
|
||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.black,
|
||||||
onVideoError: (error) {
|
onVideoError: (error) {
|
||||||
|
|
@ -374,7 +374,7 @@ class _LoopingExampleState extends State<LoopingExample> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SplashVideoPage(
|
return SplashVideo(
|
||||||
source: AssetSource(ExampleSelector.kFilePath),
|
source: AssetSource(ExampleSelector.kFilePath),
|
||||||
controller: controller,
|
controller: controller,
|
||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.black,
|
||||||
|
|
@ -435,7 +435,7 @@ class OverlayExample extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SplashVideoPage(
|
return SplashVideo(
|
||||||
source: AssetSource(ExampleSelector.kFilePath),
|
source: AssetSource(ExampleSelector.kFilePath),
|
||||||
nextScreen: const HomeScreen(title: 'Overlay Example'),
|
nextScreen: const HomeScreen(title: 'Overlay Example'),
|
||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.black,
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
library;
|
library;
|
||||||
|
|
||||||
// Main widget
|
// Main widget
|
||||||
export 'widgets/splash_video_page_w.dart';
|
export 'widgets/splash_video_w.dart';
|
||||||
|
|
||||||
// Controller
|
// Controller
|
||||||
export 'splash_video_controller.dart';
|
export 'splash_video_controller.dart';
|
||||||
|
|
|
||||||
|
|
@ -35,14 +35,14 @@ import 'package:splash_video/widgets/splash_video_player_w.dart';
|
||||||
///
|
///
|
||||||
/// This widget handles video playback, overlays, navigation, and lifecycle management.
|
/// This widget handles video playback, overlays, navigation, and lifecycle management.
|
||||||
/// It provides a smooth transition from native splash screen to video splash.
|
/// It provides a smooth transition from native splash screen to video splash.
|
||||||
class SplashVideoPage extends StatefulWidget {
|
class SplashVideo extends StatefulWidget {
|
||||||
/// Creates a SplashVideo widget
|
/// Creates a SplashVideo widget
|
||||||
///
|
///
|
||||||
/// [source] is required and specifies the video source
|
/// [source] is required and specifies the video source
|
||||||
/// [controller] is required when using looping videos
|
/// [controller] is required when using looping videos
|
||||||
///
|
///
|
||||||
/// Throws [AssertionError] if validation rules are violated
|
/// Throws [AssertionError] if validation rules are violated
|
||||||
const SplashVideoPage({
|
const SplashVideo({
|
||||||
super.key,
|
super.key,
|
||||||
required this.source,
|
required this.source,
|
||||||
this.controller,
|
this.controller,
|
||||||
|
|
@ -185,10 +185,10 @@ class SplashVideoPage extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<SplashVideoPage> createState() => _SplashVideoPageState();
|
State<SplashVideo> createState() => _SplashVideoState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _SplashVideoPageState extends State<SplashVideoPage> {
|
class _SplashVideoState extends State<SplashVideo> {
|
||||||
Timer? _completionTimer;
|
Timer? _completionTimer;
|
||||||
StreamSubscription? _skipSubscription;
|
StreamSubscription? _skipSubscription;
|
||||||
|
|
||||||
|
|
@ -201,7 +201,7 @@ class _SplashVideoPageState extends State<SplashVideoPage> {
|
||||||
// Validate configuration
|
// Validate configuration
|
||||||
_validateConfiguration();
|
_validateConfiguration();
|
||||||
|
|
||||||
onSourceLoaded = widget.onSourceLoaded ?? SplashVideoPage.resume;
|
onSourceLoaded = widget.onSourceLoaded ?? SplashVideo.resume;
|
||||||
|
|
||||||
// Listen for skip requests if controller provided
|
// Listen for skip requests if controller provided
|
||||||
if (widget.controller != null) {
|
if (widget.controller != null) {
|
||||||
|
|
@ -32,21 +32,21 @@ void main() {
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: SplashVideoPage(
|
home: SplashVideo(
|
||||||
source: AssetSource('assets/videos/splash.mp4'),
|
source: AssetSource('assets/videos/splash.mp4'),
|
||||||
onVideoError: (_) {}, // Suppress errors in test
|
onVideoError: (_) {}, // Suppress errors in test
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(find.byType(SplashVideoPage), findsOneWidget);
|
expect(find.byType(SplashVideo), findsOneWidget);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('validates conflicting nextScreen and onVideoComplete',
|
testWidgets('validates conflicting nextScreen and onVideoComplete',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: SplashVideoPage(
|
home: SplashVideo(
|
||||||
source: AssetSource('assets/videos/splash.mp4'),
|
source: AssetSource('assets/videos/splash.mp4'),
|
||||||
nextScreen: const Scaffold(body: Text('Next')),
|
nextScreen: const Scaffold(body: Text('Next')),
|
||||||
onVideoComplete: () {},
|
onVideoComplete: () {},
|
||||||
|
|
@ -64,7 +64,7 @@ void main() {
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: SplashVideoPage(
|
home: SplashVideo(
|
||||||
source: AssetSource('assets/videos/splash.mp4'),
|
source: AssetSource('assets/videos/splash.mp4'),
|
||||||
controller: controller,
|
controller: controller,
|
||||||
nextScreen: const Scaffold(),
|
nextScreen: const Scaffold(),
|
||||||
|
|
@ -82,7 +82,7 @@ void main() {
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: SplashVideoPage(
|
home: SplashVideo(
|
||||||
source: AssetSource('assets/videos/splash.mp4'),
|
source: AssetSource('assets/videos/splash.mp4'),
|
||||||
controller: controller,
|
controller: controller,
|
||||||
onVideoComplete: () {},
|
onVideoComplete: () {},
|
||||||
|
|
@ -100,7 +100,7 @@ void main() {
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: SplashVideoPage(
|
home: SplashVideo(
|
||||||
source: AssetSource('assets/videos/splash.mp4'),
|
source: AssetSource('assets/videos/splash.mp4'),
|
||||||
controller: controller,
|
controller: controller,
|
||||||
onVideoError: (_) {},
|
onVideoError: (_) {},
|
||||||
|
|
@ -110,7 +110,7 @@ void main() {
|
||||||
|
|
||||||
// Should not throw
|
// Should not throw
|
||||||
expect(tester.takeException(), isNull);
|
expect(tester.takeException(), isNull);
|
||||||
expect(find.byType(SplashVideoPage), findsOneWidget);
|
expect(find.byType(SplashVideo), findsOneWidget);
|
||||||
|
|
||||||
controller.dispose();
|
controller.dispose();
|
||||||
});
|
});
|
||||||
|
|
@ -118,7 +118,7 @@ void main() {
|
||||||
testWidgets('renders with backgroundColor', (WidgetTester tester) async {
|
testWidgets('renders with backgroundColor', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: SplashVideoPage(
|
home: SplashVideo(
|
||||||
source: AssetSource('assets/videos/splash.mp4'),
|
source: AssetSource('assets/videos/splash.mp4'),
|
||||||
backgroundColor: Colors.red,
|
backgroundColor: Colors.red,
|
||||||
onVideoError: (_) {},
|
onVideoError: (_) {},
|
||||||
|
|
@ -127,13 +127,13 @@ void main() {
|
||||||
);
|
);
|
||||||
|
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
expect(find.byType(SplashVideoPage), findsOneWidget);
|
expect(find.byType(SplashVideo), findsOneWidget);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('renders with title overlay', (WidgetTester tester) async {
|
testWidgets('renders with title overlay', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: SplashVideoPage(
|
home: SplashVideo(
|
||||||
source: AssetSource('assets/videos/splash.mp4'),
|
source: AssetSource('assets/videos/splash.mp4'),
|
||||||
titleWidget: const Text('App Title'),
|
titleWidget: const Text('App Title'),
|
||||||
onVideoError: (_) {},
|
onVideoError: (_) {},
|
||||||
|
|
@ -148,7 +148,7 @@ void main() {
|
||||||
testWidgets('renders with footer overlay', (WidgetTester tester) async {
|
testWidgets('renders with footer overlay', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: SplashVideoPage(
|
home: SplashVideo(
|
||||||
source: AssetSource('assets/videos/splash.mp4'),
|
source: AssetSource('assets/videos/splash.mp4'),
|
||||||
footerWidget: const CircularProgressIndicator(),
|
footerWidget: const CircularProgressIndicator(),
|
||||||
onVideoError: (_) {},
|
onVideoError: (_) {},
|
||||||
|
|
@ -164,7 +164,7 @@ void main() {
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: SplashVideoPage(
|
home: SplashVideo(
|
||||||
source: AssetSource('assets/videos/splash.mp4'),
|
source: AssetSource('assets/videos/splash.mp4'),
|
||||||
overlayBuilder: (context) => const Positioned(
|
overlayBuilder: (context) => const Positioned(
|
||||||
top: 20,
|
top: 20,
|
||||||
|
|
@ -183,7 +183,7 @@ void main() {
|
||||||
testWidgets('renders all overlays together', (WidgetTester tester) async {
|
testWidgets('renders all overlays together', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: SplashVideoPage(
|
home: SplashVideo(
|
||||||
source: AssetSource('assets/videos/splash.mp4'),
|
source: AssetSource('assets/videos/splash.mp4'),
|
||||||
titleWidget: const Text('Title'),
|
titleWidget: const Text('Title'),
|
||||||
footerWidget: const Text('Footer'),
|
footerWidget: const Text('Footer'),
|
||||||
|
|
@ -204,7 +204,7 @@ void main() {
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: SplashVideoPage(
|
home: SplashVideo(
|
||||||
source: AssetSource('assets/invalid.mp4'),
|
source: AssetSource('assets/invalid.mp4'),
|
||||||
onVideoError: (error) {
|
onVideoError: (error) {
|
||||||
errorMessage = error;
|
errorMessage = error;
|
||||||
|
|
@ -224,7 +224,7 @@ void main() {
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: SplashVideoPage(
|
home: SplashVideo(
|
||||||
source: AssetSource('assets/invalid.mp4'),
|
source: AssetSource('assets/invalid.mp4'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -241,8 +241,8 @@ void main() {
|
||||||
group('SplashVideoPage Static Methods', () {
|
group('SplashVideoPage Static Methods', () {
|
||||||
testWidgets('initialize and resume work', (WidgetTester tester) async {
|
testWidgets('initialize and resume work', (WidgetTester tester) async {
|
||||||
// These methods affect WidgetsBinding, so we just verify they don't throw
|
// These methods affect WidgetsBinding, so we just verify they don't throw
|
||||||
SplashVideoPage.initialize();
|
SplashVideo.initialize();
|
||||||
SplashVideoPage.resume();
|
SplashVideo.resume();
|
||||||
|
|
||||||
// Should not throw
|
// Should not throw
|
||||||
expect(true, isTrue);
|
expect(true, isTrue);
|
||||||
|
|
@ -255,7 +255,7 @@ void main() {
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: SplashVideoPage(
|
home: SplashVideo(
|
||||||
source: AssetSource('assets/videos/splash.mp4'),
|
source: AssetSource('assets/videos/splash.mp4'),
|
||||||
controller: controller,
|
controller: controller,
|
||||||
onVideoError: (_) {},
|
onVideoError: (_) {},
|
||||||
|
|
@ -263,7 +263,7 @@ void main() {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(find.byType(SplashVideoPage), findsOneWidget);
|
expect(find.byType(SplashVideo), findsOneWidget);
|
||||||
controller.dispose();
|
controller.dispose();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -272,7 +272,7 @@ void main() {
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: SplashVideoPage(
|
home: SplashVideo(
|
||||||
source: AssetSource('assets/videos/splash.mp4'),
|
source: AssetSource('assets/videos/splash.mp4'),
|
||||||
controller: controller,
|
controller: controller,
|
||||||
onVideoError: (_) {},
|
onVideoError: (_) {},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue