I followed the tutorial of adding a splash screen in an app in flutter using rive animation tool, but the splash screen won't show up.
Link which i followed:- https://pub.dev/packages/rive_splash_screen
Code in main.dart file
import 'package:flutter/material.dart';
import 'package:rive_splash_screen/rive_splash_screen.dart';
import 'package:rive/rive.dart';
import 'dart:ui';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: SplashScreen.navigate(
name: 'assets/doublersplashscreen.riv',
next: (_) => const MyHomePage(),
until: () => Future.delayed(const Duration(seconds: 5)),
startAnimation: 'Splash',
),
);
}
}
class MyHomePage extends StatelessWidget {
const MyHomePage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
color: Colors.red,
height: 400,
width: 300,
);
}
}
Code in pubspec.yaml file