flutter splash screen
a small splash screen package used to easily add an intro to any flutter application.
usage
to use this package :
- add the dependency to your pubspec.yaml file.
dependencies:
flutter:
sdk: flutter
splashscreen:
how to use
new splashscreen(
seconds: 14,
navigateafterseconds: new aftersplash(),
title: new text('welcome in splashscreen'),
image: new image.asset('screenshot.png'),
backgroundcolor: colors.white,
styletextundertheloader: new textstyle(),
photosize: 100.0,
loadercolor: colors.red
);
example
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
),),
),
);
}
}
Comments are closed.