A Rive splash screen is one of the most common requests I get from Flutter teams, and also one of the easiest to get subtly wrong. The usual version plays a fixed-length animation, waits on a hard-coded timer, and then jumps to the home screen whether the app is ready or not. In this post I'll show a better pattern: the Rive animation plays an intro, loops for as long as your real startup work takes, and only plays its outro once your app says "ready". All of it is driven by Rive Data Binding (View Models), not the deprecated state machine inputs.
The code targets the current stable Rive Flutter runtime (rive: ^0.14.11). I'll note the one change you need for the 0.15 dev release at the end.
Native launch screen vs. Rive splash screen
First, a reality check. When a Flutter app starts, the operating system shows the native launch screen before Flutter has drawn a single frame. That screen is configured natively (a background color and a static image), so it can't be a Rive animation.
What you can do is make the first Flutter screen your Rive splash screen, and make the handoff invisible:
- Use the same background color on the native launch screen, the Flutter widget behind the Rive animation, and the Rive artboard.
- Make the first frame of the Rive intro look like the static native image (same logo, same position). The user sees one continuous launch, not a static logo followed by a "pop".
There are also third-party pub.dev packages for this (for example rive_splash_screen and splash_master_rive). They're built around named timeline animations. Below I build it directly with RiveWidget and Data Binding, so the logic lives in the Rive file and you control everything.
How the Rive file is set up
This is the contract between the animator and the developer. If you hire someone to animate your splash, send them this list.
The View Model
Create a View Model called Splash, assign it to the artboard, and give it a "Default" instance with these properties:
-
progress(Number, 0 to 100): written by the app. Bind it to whatever shows progress, for example a bar's width or a trim path's end. -
phase(Enum with valuesloading,ready,done): the default instance starts atloading. The app sets it toready; Rive sets it todone.
The state machine
- Intro (one-shot): the logo builds in. Its first frame matches the native launch image.
- Loop: a seamless loop. Transition from Intro to Loop uses Exit Time 100%, so the intro always finishes.
-
Outro (one-shot): the logo hands off to the app. Transition from Loop to Outro has one condition:
phaseequalsready. - On the transition out of Outro (Exit Time 100%), add a View Model Change action that sets
phasetodone. Rive's action system lets transitions set View Model properties when they start or finish, so this is how the animation tells your code "I'm finished".
Why this shape works: on a fast device, the user still gets the full intro and outro, because the Loop to Outro transition can only happen after the intro is done. On a slow device or a slow network, the loop simply keeps playing. Nobody has to guess a duration.
The Flutter code
Initialize Rive in main()
The Rive docs recommend calling RiveNative.init() at the start of the app, so Rive is ready before your first graphic. Add the .riv file to your pubspec.yaml assets as well.
import 'package:flutter/material.dart';
import 'package:rive/rive.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await RiveNative.init();
runApp(MaterialApp(
home: RiveSplash(
initApp: (report) async {
// Replace these with your real startup work.
await loadConfig();
report(0.4);
await warmUpCache();
report(0.8);
await restoreSession();
report(1.0);
},
nextScreen: (_) => const HomeScreen(),
),
));
}
The RiveSplash widget
import 'package:flutter/material.dart';
import 'package:rive/rive.dart';
class RiveSplash extends StatefulWidget {
const RiveSplash({
super.key,
required this.initApp,
required this.nextScreen,
});
/// Your startup work. Call reportProgress with values from 0.0 to 1.0.
final Future<void> Function(void Function(double) reportProgress) initApp;
final WidgetBuilder nextScreen;
@override
State<RiveSplash> createState() => _RiveSplashState();
}
class _RiveSplashState extends State<RiveSplash> {
File? _file;
RiveWidgetController? _controller;
ViewModelInstance? _vmi;
ViewModelInstanceNumber? _progress;
ViewModelInstanceEnum? _phase;
bool _left = false;
@override
void initState() {
super.initState();
_start();
}
Future<void> _start() async {
// 1. Load the splash file first so the animation appears quickly.
try {
_file = await File.asset('assets/splash.riv', riveFactory: Factory.rive);
} catch (_) {
_file = null; // Never block startup because of the animation.
}
if (!mounted) return;
if (_file != null) {
_controller = RiveWidgetController(_file!);
_vmi = _controller!.dataBind(DataBind.auto());
_progress = _vmi!.number('progress');
_phase = _vmi!.enumerator('phase');
_phase?.addListener(_onPhaseChanged);
setState(() {});
}
// 2. Run the real startup work while the loop plays.
await widget.initApp(
(p) => _progress?.value = (p * 100).clamp(0, 100).toDouble(),
);
// 3. Tell Rive we're ready. The outro plays, then Rive sets phase to "done".
if (_phase == null) {
_goNext();
} else {
_phase!.value = 'ready';
// Safety net in case the outro never reports back.
Future.delayed(const Duration(seconds: 3), _goNext);
}
}
void _onPhaseChanged(String value) {
if (value == 'done') _goNext();
}
void _goNext() {
if (_left || !mounted) return;
_left = true;
Navigator.of(context).pushReplacement(
PageRouteBuilder(
pageBuilder: (context, _, __) => widget.nextScreen(context),
transitionsBuilder: (context, animation, _, child) =>
FadeTransition(opacity: animation, child: child),
),
);
}
@override
void dispose() {
_phase?.removeListener(_onPhaseChanged);
_phase?.dispose();
_progress?.dispose();
_vmi?.dispose();
_controller?.dispose();
_file?.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
final controller = _controller;
return ColoredBox(
// Match your native launch screen color.
color: const Color(0xFF101418),
child: controller == null
? const SizedBox.expand()
: RiveWidget(controller: controller, fit: Fit.contain),
);
}
}
What's happening here
-
File.assetloads the.rivwith the Rive Renderer (Factory.rive). -
controller.dataBind(DataBind.auto())binds the artboard's default View Model using the instance marked "Default" in the editor. -
number('progress')andenumerator('phase')get the properties by name. Setting.valueupdates everything bound to them on the next state machine advance. -
addListeneronphaseis how the app hears Rive'sdonesignal. Enum values are strings in the Flutter runtime, so the listener receives aString. - Everything is disposed in reverse order of creation, as the Rive docs recommend when you manage
RiveWidgetresources yourself.
Keep the splash .riv small and fast
A splash screen is the one animation every user sees on every cold start, so file size and decode time matter more here than anywhere else. From Rive's own performance guidance:
- Ship it as an asset, not a URL. Loading over the network on the very first screen adds a failure point exactly when you can least afford one.
- Compress raster images. Rive recommends WebP for the smallest size, and images sized to how big they actually appear on the artboard.
- Subset fonts. If your splash has a wordmark in a custom font, include only the glyphs you need. Better still, convert the wordmark to shapes.
- Watch vertex counts. Vectors converted from raster images or generated with AI can carry thousands of points. Clean them up before animating.
-
Only what's used gets exported. Assets not used on an exported artboard don't increase the
.rivsize, and only the default artboard plus Components are exported. - Let it rest. If no looping animation is playing, the runtime can pause itself. Your outro should end in a still frame, not an endless loop behind the home screen.
Common mistakes
-
Using a timer as the source of truth.
Future.delayed(Duration(seconds: 3))is either too long on fast phones or too short on slow ones. Let the app decide when it's ready and let Rive decide when the outro is done. -
Letting the animation block startup. If the
.rivfails to load, the app must still open. That's why the code above falls through to_goNext(). - A color flash between native and Flutter. Three backgrounds need to match: native launch screen, the Flutter widget, and the artboard.
- A 6-second brand film. Users open your app to use it. Keep the intro and outro short and put the personality into the loop, which only plays when there's actually something to wait for.
- Ignoring reduced motion. I covered this in my earlier post on Rive accessibility. For a splash, a simple approach is to skip the loop entirely when the system asks for reduced motion.
Using the 0.15 dev release?
In rive 0.15.0 (currently a dev release), Data Binding happens when you construct RiveWidgetController, and controller.dataBind(...) is removed. Replace the binding line with:
_controller = RiveWidgetController(_file!);
final vmi = _controller!.viewModelInstance;
The controller now owns that instance, so drop the _vmi?.dispose() call. Everything else in this article stays the same.
Need a Rive animator?
I'm Maxim, a Rive animator and motion designer with 10+ years in motion design and 100+ projects: interactive mascots, animated logos and icons, UI animations and splash screens, always delivered with a clean developer handoff (View Models named and documented, like the contract above).
See my work and get a quote at hireriveanimator.com
Building a splash screen in Rive right now? Drop your questions or your setup in the comments, I'm happy to help.
Top comments (0)