Advertisement
Guest User

Untitled

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