xxxxxxxxxx
@override
void initState() {
super.initState();
Timer(Duration(seconds: 3),
()=>Navigator.pushReplacement(context,
MaterialPageRoute(builder:
(context) =>
SecondScreen()
)
)
);
}
xxxxxxxxxx
dev_dependencies:
flutter_native_splash: ^1.2.0
flutter_native_splash:
image: assets/logo.png
color: "#fafafa"
flutter pub run flutter_native_splash:create
flutter pub run flutter_native_splash:remove
xxxxxxxxxx
flutter_native_splash:
color: "#EDBB99"
image: assets/images/Appicon.png
android: true
ios: true
// run this in the Terminal window in flutter
//flutter clean && flutter pub get && flutter pub run flutter_native_splash:create
xxxxxxxxxx
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,
);
}
}
xxxxxxxxxx
dev_dependencies:
flutter_native_splash: ^2.2.14
flutter_native_splash:
image: assets/logo.png
color: "#fafafa"
flutter pub run flutter_native_splash:create
flutter pub run flutter_native_splash:remove
import 'package:flutter/material.dart';
import 'package:splashscreen/splashscreen.dart';
void main(){
runApp(new MaterialApp(
home: new MyApp(),
));
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => new _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return new SplashScreen(
seconds: 14,
navigateAfterSeconds: new AfterSplash(),
title: new Text('Welcome In SplashScreen',
style: new TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20.0
),),
image: new Image.network('https://i.imgur.com/TyCSG9A.png'),
backgroundColor: Colors.white,
styleTextUnderTheLoader: new TextStyle(),
photoSize: 100.0,
onClick: ()=>print("Flutter Egypt"),
loaderColor: Colors.red
);
}
}
class AfterSplash extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text("Welcome In SplashScreen Package"),
automaticallyImplyLeading: false
),
body: new Center(
child: new Text("Done!",
style: new TextStyle(
fontWeight: FontWeight.bold,
fontSize: 30.0
),),
),
);
}
}
xxxxxxxxxx
import 'dart:async';
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Splash Screen',
theme: ThemeData(
primarySwatch: Colors.green,
),
home: MyHomePage(),
debugShowCheckedModeBanner: false,
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
void initState() {
super.initState();
Timer(Duration(seconds: 3),
()=>Navigator.pushReplacement(context,
MaterialPageRoute(builder:
(context) =>
SecondScreen()
)
)
);
}
@override
Widget build(BuildContext context) {
return Container(
color: Colors.white,
child:FlutterLogo(size:MediaQuery.of(context).size.height)
);
}
}
class SecondScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title:Text("GeeksForGeeks")),
body: Center(
child:Text("Home page",textScaleFactor: 2,)
),
);
}
}
xxxxxxxxxx
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/my_splash"
/>