Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.42 KB | None | 0 0
  1. import 'package:balta/pages/account/reset-password.page.dart';
  2. import 'package:balta/pages/account/signup.page.dart';
  3. import 'package:balta/pages/content/course-list.page.dart';
  4. import 'package:flutter/material.dart';
  5.  
  6. class LoginPage extends StatefulWidget {
  7. @override
  8. _LoginPageState createState() => _LoginPageState();
  9. }
  10.  
  11. class _LoginPageState extends State<LoginPage>
  12. with SingleTickerProviderStateMixin {
  13. AnimationController _animationController;
  14.  
  15. @override
  16. void initState() {
  17. super.initState();
  18. _animationController = new AnimationController(
  19. vsync: this,
  20. duration: Duration(seconds: 2),
  21. );
  22. }
  23.  
  24. @override
  25. void dispose() {
  26. _animationController.dispose();
  27. super.dispose();
  28. }
  29.  
  30. @override
  31. Widget build(BuildContext context) {
  32. return Scaffold(
  33. body: Container(
  34. padding: EdgeInsets.all(20),
  35. decoration: BoxDecoration(
  36. gradient: LinearGradient(
  37. begin: Alignment.topCenter,
  38. end: Alignment.bottomCenter,
  39. stops: [0, 0.8],
  40. colors: [
  41. Color(0XFFC66CD6),
  42. Color(0xFF3228B1),
  43. ],
  44. ),
  45. ),
  46. child: Column(
  47. children: <Widget>[
  48. SizedBox(
  49. height: 60,
  50. ),
  51. Container(
  52. alignment: Alignment.center,
  53. child: Container(
  54. height: 128,
  55. width: 128,
  56. alignment: Alignment.center,
  57. decoration: BoxDecoration(
  58. color: Color(0xFFBABABA),
  59. border: Border.all(
  60. width: 4.0,
  61. color: Color.fromRGBO(255, 255, 255, 0.2),
  62. ),
  63. borderRadius: BorderRadius.all(
  64. Radius.circular(128),
  65. ),
  66. ),
  67. ),
  68. ),
  69. SizedBox(
  70. height: 40,
  71. ),
  72. Container(
  73. padding: EdgeInsets.only(
  74. left: 20,
  75. ),
  76. decoration: BoxDecoration(
  77. color: Color.fromRGBO(255, 255, 255, 0.1),
  78. borderRadius: BorderRadius.all(
  79. Radius.circular(128),
  80. ),
  81. ),
  82. child: TextFormField(
  83. keyboardType: TextInputType.number,
  84. decoration: InputDecoration(
  85. border: InputBorder.none,
  86. labelText: "CPF",
  87. labelStyle: TextStyle(
  88. color: Colors.white,
  89. fontWeight: FontWeight.w100,
  90. fontSize: 16,
  91. ),
  92. ),
  93. style: TextStyle(
  94. fontSize: 20,
  95. color: Colors.white,
  96. ),
  97. ),
  98. ),
  99. SizedBox(
  100. height: 10,
  101. ),
  102. Container(
  103. padding: EdgeInsets.only(left: 20),
  104. decoration: BoxDecoration(
  105. color: Color.fromRGBO(255, 255, 255, 0.1),
  106. borderRadius: BorderRadius.all(
  107. Radius.circular(128),
  108. ),
  109. ),
  110. child: TextFormField(
  111. keyboardType: TextInputType.text,
  112. obscureText: true,
  113. decoration: InputDecoration(
  114. border: InputBorder.none,
  115. labelText: "Senha",
  116. labelStyle: TextStyle(
  117. color: Colors.white,
  118. fontWeight: FontWeight.w100,
  119. fontSize: 16,
  120. ),
  121. ),
  122. style: TextStyle(
  123. fontSize: 20,
  124. color: Colors.white,
  125. ),
  126. ),
  127. ),
  128. SizedBox(
  129. height: 10,
  130. ),
  131. StaggerAnimation(controller: _animationController),
  132. SizedBox(
  133. height: 20,
  134. ),
  135. FlatButton(
  136. child: Text(
  137. "Esqueci minha senha",
  138. style: TextStyle(color: Colors.white),
  139. ),
  140. onPressed: () {
  141. Navigator.push(
  142. context,
  143. MaterialPageRoute(
  144. builder: (context) => ResetPasswordPage(),
  145. ),
  146. );
  147. },
  148. ),
  149. SizedBox(
  150. height: 70,
  151. ),
  152. FlatButton(
  153. child: Text(
  154. "QUERO SER ALUNO",
  155. style: TextStyle(
  156. color: Colors.white,
  157. fontSize: 16,
  158. ),
  159. ),
  160. onPressed: () {
  161. Navigator.push(
  162. context,
  163. MaterialPageRoute(
  164. builder: (context) => SignupPage(),
  165. ),
  166. );
  167. },
  168. ),
  169. ],
  170. ),
  171. ),
  172. );
  173. }
  174. }
  175.  
  176. class StaggerAnimation extends StatelessWidget {
  177. final AnimationController controller;
  178. final Animation<double> buttonSizeAnim;
  179. final Animation<double> buttonOpacityAnim;
  180.  
  181. StaggerAnimation({this.controller})
  182. : buttonSizeAnim = Tween(
  183. begin: 320.0,
  184. end: 60.0,
  185. ).animate(
  186. CurvedAnimation(
  187. parent: controller,
  188. curve: Interval(0.0, 0.2),
  189. ),
  190. ),
  191. buttonOpacityAnim = Tween(
  192. begin: 1.0,
  193. end: 0.0,
  194. ).animate(
  195. CurvedAnimation(
  196. parent: controller,
  197. curve: Interval(0.15, 0.3),
  198. ),
  199. );
  200.  
  201. Widget _buildAnimation(context, child) {
  202. return Container(
  203. height: 60,
  204. width: buttonSizeAnim.value,
  205. decoration: BoxDecoration(
  206. color: Color(0xFFFF508F).withOpacity(buttonOpacityAnim.value),
  207. borderRadius: BorderRadius.all(
  208. Radius.circular(128),
  209. ),
  210. ),
  211. child: FlatButton(
  212. child: Text(
  213. "Entrar",
  214. style: TextStyle(
  215. color: Colors.white,
  216. ),
  217. ),
  218. onPressed: () {
  219. controller.forward();
  220. // Navigator.push(
  221. // context,
  222. // MaterialPageRoute(
  223. // builder: (context) => CourseListPage(),
  224. // ),
  225. // );
  226. },
  227. ),
  228. );
  229. }
  230.  
  231. @override
  232. Widget build(BuildContext context) {
  233. return AnimatedBuilder(
  234. builder: _buildAnimation,
  235. animation: controller,
  236. );
  237. }
  238. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement