flutter how to use gif as splash screen stackoverflow
import 'dart:async'; import 'package:app/ui/login_screen.dart';
import 'package:flutter/material.dart';
void main() { runApp(new MaterialApp( home: new MyApp(), )); }
class MyApp extends StatefulWidget {
@override _MyAppState createState() => new _MyAppState();
}
class _MyAppState extends State {
@override void initState() {
super.initState();
new Future.delayed( const Duration(seconds: 4), () =>
Navigator.pushReplacement( context,
MaterialPageRoute(builder: (context) => LoginScreen()),
));
}
@override
Widget build(BuildContext context) {
return new Scaffold(
backgroundColor: Colors.white,
body: Container(
height: double.infinity,
width: double.infinity,
child: Image.asset("assets/yourgif.gif",
gaplessPlayback: true,
fit: BoxFit.fill
)
));
}
}