Animated Splash Screen #
Check it out at Pub.Dev
I've been maintaining quite many repos these days and burning out slowly. If you could help me cheer up, buying me a cup of coffee will make my life really happy and get much energy out of it.
To use is simple, just do this:
@override
Widget build(BuildContext context) {
return AnimatedSplashScreen(
splash: 'images/splash.png',
nextScreen: MainScreen(),
splashTransition: SplashTransition.rotationTransition,
pageTransitionType: PageTransitionType.scale,
);
}
Here, you can pass:
enum SplashTransition {
slideTransition,
scaleTransition,
rotationTransition,
sizeTransition,
fadeTransition,
decoratedBoxTransition
}
enum PageTransitionType {
fade,
rightToLeft,
leftToRight,
upToDown,
downToUp,
scale,
rotate,
size,
rightToLeftWithFade,
leftToRightWithFade,
}
AnimatedSplashScreen({
Curve curve = Curves.easeInCirc,
Future Function() function, // Here you can make something before change of screen
int duration = 2500,
@required dynamic splash,
@required Widget nextScreen,
Color backgroundColor = Colors.white,
Animatable customTween,
bool centered = true,
SplashTransition splashTransition = SplashTransition.fadeTransition,
PageTransitionType pageTransitionType = PageTransitionType.downToUp,
})
Here you can do something that will return your next screen, ex:
AnimatedSplashScreen.withScreenFunction(
splash: 'images/splash.png',
screenFunction: () async{
return MainScreen();
},
splashTransition: SplashTransition.rotationTransition,
pageTransitionType: PageTransitionType.scale,
)
Run this command:
With Flutter:
$ flutter pub add animated_splash_screen
This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get
):
dependencies:
animated_splash_screen: ^1.3.0
Alternatively, your editor might support flutter pub get
. Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:animated_splash_screen/animated_splash_screen.dart';
import 'package:animated_splash_screen/animated_splash_screen.dart';
import 'package:flutter/material.dart';
import 'package:page_transition/page_transition.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Clean Code',
home: AnimatedSplashScreen(
duration: 3000,
splash: Icons.home,
nextScreen: MainScreen(),
splashTransition: SplashTransition.fadeTransition,
pageTransitionType: PageTransitionType.scale,
backgroundColor: Colors.blue));
}
}
class MainScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
color: Colors.redAccent,
);
}
}
Download details:
Author: cleancode.dev
Source: https://github.com/clean-code-dev/animated_splash_screen
#flutter #android #ios #web-development #ui #mobile-apps #animations #animation #animate