custom_splash 0.0.1 custom_splash: ^0.0.1 copied to clipboard
A Flutter package to custom splash screen like change logo icon, logo animation, and splash screen background color.
import 'package:flutter/material.dart';
import './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: MyApp(), 2: MyApp()};
runApp(MaterialApp(
home: AnimatedSplash(
imagePath: 'assets/flutter_icon.png',
backGroundColor: Colors.deepOrange,
// backGroundColor: Color(0xfffc6042),
animationEffect: 'zoom-out',
logoSize: 200,
home: MyApp(),
customFunction: duringSplash,
duration: 2500,
type: AnimatedSplashType.StaticDuration,
outputAndHome: op,
),
));
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
// home: MyHomePage(title: 'Flutter Demo Home Page'),
home: Scaffold(
body: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/lamp-product.png"),
fit: BoxFit.cover,
),
),
child: null /* add child content here */,
),
)
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'You have pushed the button this many times(^^!):',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.display1,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}