Guest User

Untitled

a guest
Jun 21st, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. List<CameraDescription> cameras;
  2.  
  3. Future<Null> main() async {
  4. cameras = await availableCameras();
  5. runApp(new MaterialApp(
  6. debugShowCheckedModeBanner: false,
  7. theme: new ThemeData(
  8. brightness: Brightness.light,
  9. primaryColor: Colors.green,
  10. secondaryHeaderColor: Colors.green,
  11. accentColor: Color(0xFF73bc42),
  12. ),
  13. home: new SplashScreen(),
  14. routes: <String, WidgetBuilder>{
  15. '/screens/LoginScreen': (BuildContext context) => new LoginScreen(),
  16. '/screens/SignUpScreen': (BuildContext context) => new SignUpBasicScreen(cameras)
  17. },
  18. ));
  19. }
  20.  
  21. class SplashScreen extends StatefulWidget {
  22. @override
  23. _SplashScreenState createState() => new _SplashScreenState();
  24. }
  25.  
  26. class _SplashScreenState extends State<SplashScreen>
  27. with SingleTickerProviderStateMixin {
  28. AnimationController _logoAnimationController;
  29. Animation<double> _logoAnimation;
  30.  
  31. startTime() async {
  32. var _duration = new Duration(seconds: 3);
  33. return new Timer(_duration, navigationPage);
  34. }
  35.  
  36. void navigationPage() {
  37. Navigator.of(context).pushReplacementNamed('/screens/LoginScreen');
  38. }
  39.  
  40. @override
  41. void initState() {
  42. super.initState();
  43. _logoAnimationController = new AnimationController(
  44. vsync: this, duration: new Duration(milliseconds: 300));
  45. _logoAnimation = new CurvedAnimation(
  46. parent: _logoAnimationController, curve: Curves.easeOut);
  47. _logoAnimation.addListener(() => this.setState(() {}));
  48. _logoAnimationController.forward();
  49. startTime();
  50. }
  51.  
  52. @override
  53. Widget build(BuildContext context) {
  54. return new Scaffold(
  55. backgroundColor: Colors.white,
  56. body: new Stack(
  57. fit: StackFit.expand,
  58. children: <Widget>[
  59. new Column(
  60. mainAxisAlignment: MainAxisAlignment.center,
  61. crossAxisAlignment: CrossAxisAlignment.center,
  62. children: <Widget>[
  63. new Image.asset('images/ic_logo_name.png',
  64. width: _logoAnimation.value * 200.0,
  65. height: _logoAnimation.value * 100.0)
  66. ],
  67. )
  68. ],
  69. )
  70. );
  71. }
  72. }
Add Comment
Please, Sign In to add comment