Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. import 'package:agrocontabil/app/modules/home/home_page.dart';
  2. import 'package:agrocontabil/app/modules/splashscreen/components.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:flutter/services.dart';
  5.  
  6. class SplashScreenPage extends StatefulWidget {
  7. @override
  8. _SplashScreenPageState createState() => _SplashScreenPageState();
  9. }
  10.  
  11. class _SplashScreenPageState extends State<SplashScreenPage>
  12. with SingleTickerProviderStateMixin {
  13. AnimationController animationController;
  14. Animation animGreenContainer;
  15. @override
  16. void initState() {
  17. animationController = AnimationController(
  18. duration: Duration(seconds: 2),
  19. vsync: this,
  20. );
  21. animationController.forward();
  22. SystemChrome.setEnabledSystemUIOverlays([]);
  23. Future.delayed(Duration(seconds: 40000)).then((value) =>
  24. Navigator.pushReplacement(
  25. context, MaterialPageRoute(builder: (context) => HomePage())));
  26. super.initState();
  27. }
  28.  
  29. @override
  30. void didChangeDependencies() {
  31. animGreenContainer = Tween(
  32. begin: 3.0,
  33. end: 1.0,
  34. ).animate(animationController);
  35. super.didChangeDependencies();
  36. }
  37.  
  38. @override
  39. void dispose() {
  40. animationController.dispose();
  41. super.dispose();
  42. }
  43.  
  44. @override
  45. Widget build(BuildContext context) {
  46. return Container(
  47. color: Colors.white,
  48. child: Stack(
  49. children: <Widget>[
  50. Positioned(
  51. top: 45,
  52. left: 50,
  53. right: 50,
  54. child: Container(
  55. child: Image.asset('imagens/logo.png'),
  56. ),
  57. ),
  58. AnimatedBuilder(
  59. animation: animGreenContainer,
  60. child: ClipPath(
  61. clipper: Clipper(),
  62. child: Container(
  63. color: Colors.teal[300],
  64. height: MediaQuery.of(context).size.height / 1.6,
  65. width: MediaQuery.of(context).size.width,
  66. ),
  67. ),
  68. builder: (BuildContext context, Widget child) {
  69. return Align(
  70. alignment: Alignment(0, animGreenContainer.value),
  71. child: child,
  72. );
  73. }),
  74. ],
  75. ),
  76. );
  77. }
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement