animated_splash 1.0.0 animated_splash: ^1.0.0 copied to clipboard
A light weight package for flutter apps, that easily shows a splash screen with a nice fade animation.
import 'package:flutter/material.dart';
import 'package:animated_splash/animated_splash.dart';
void main() {
Function duringSplash = () {
print('Something background process');
int a = 123 + 23;
print(a);
if (a > 100)
return 1;
else
return 2;
};
Map<int, Widget> op = {1: Home(), 2: HomeSt()};
runApp(MaterialApp(
home: AnimatedSplash(
imagePath: 'assets/flutter_icon.png',
home: Home(),
customFunction: duringSplash,
duration: 2500,
type: AnimatedSplashType.BackgroundProcess,
outputAndHome: op,
),
));
}
class Home extends StatefulWidget {
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State<Home> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Home'),
),
body: Center(
child: Text('My Cool App',
style: TextStyle(color: Colors.black, fontSize: 20.0))));
}
}
class HomeSt extends StatefulWidget {
@override
_HomeStState createState() => _HomeStState();
}
class _HomeStState extends State<HomeSt> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Home'),
),
body: Center(
child: Text('My Cool App home page 2',
style: TextStyle(color: Colors.black, fontSize: 20.0))));
}
}