welcome_page.dart 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/services.dart';
  3. import 'package:flutter_green/routes/Routes.dart';
  4. /// 欢迎页面:登录、注册,忘记密码
  5. class WelcomePage extends StatefulWidget {
  6. @override
  7. _WelcomePageState createState() => _WelcomePageState();
  8. }
  9. class _WelcomePageState extends State<WelcomePage> {
  10. @override
  11. Widget build(BuildContext context) {
  12. return Scaffold(
  13. body: AnnotatedRegion<SystemUiOverlayStyle>(
  14. value: SystemUiOverlayStyle.light,
  15. child: Container(
  16. width: double.infinity,
  17. height: double.infinity,
  18. decoration: BoxDecoration(
  19. image: DecorationImage(
  20. fit: BoxFit.fill,
  21. image: AssetImage("assets/images/background.jpg"),
  22. ),
  23. ),
  24. child: Column(
  25. crossAxisAlignment: CrossAxisAlignment.start,
  26. children: <Widget>[
  27. Expanded(
  28. flex: 3,
  29. child: Column(
  30. mainAxisAlignment: MainAxisAlignment.center,
  31. children: <Widget>[
  32. Container(
  33. width: 65,
  34. height: 65,
  35. margin: EdgeInsets.only(
  36. left: 30,
  37. ),
  38. padding: EdgeInsets.all(10),
  39. decoration: BoxDecoration(
  40. color: Colors.white,
  41. borderRadius: BorderRadius.circular(10),
  42. ),
  43. child: Image(
  44. image: AssetImage("assets/images/leaf.jpg"),
  45. ),
  46. ),
  47. ],
  48. ),
  49. ),
  50. Expanded(
  51. flex: 6,
  52. child: Container(
  53. padding: EdgeInsets.symmetric(horizontal: 28),
  54. child: Text(
  55. "Everyone should live with a little more green",
  56. overflow: TextOverflow.fade,
  57. style: TextStyle(
  58. color: Colors.white,
  59. fontSize: 41,
  60. fontWeight: FontWeight.bold),
  61. ),
  62. ),
  63. ),
  64. Expanded(
  65. flex: 3,
  66. child: Container(
  67. padding: EdgeInsets.symmetric(horizontal: 29),
  68. child: Column(
  69. crossAxisAlignment: CrossAxisAlignment.center,
  70. mainAxisAlignment: MainAxisAlignment.center,
  71. children: <Widget>[
  72. Expanded(
  73. flex: 4,
  74. child: GestureDetector(
  75. onTap: nextScreen,
  76. child: Container(
  77. decoration: BoxDecoration(
  78. color: Color(0xFf142e32).withOpacity(0.93),
  79. borderRadius: BorderRadius.circular(20)),
  80. width: double.infinity,
  81. child: Center(
  82. child: Text(
  83. "Sign up",
  84. style: TextStyle(
  85. color: Colors.white,
  86. fontSize: 30,
  87. fontWeight: FontWeight.bold),
  88. ),
  89. ),
  90. ),
  91. ),
  92. ),
  93. Expanded(
  94. flex: 2,
  95. child: Container(),
  96. ),
  97. Expanded(
  98. flex: 4,
  99. child: GestureDetector(
  100. onTap: () {
  101. Navigator.of(context).pushNamed(Routes.loginPage);
  102. },
  103. child: Container(
  104. decoration: BoxDecoration(
  105. color: Colors.white,
  106. borderRadius: BorderRadius.circular(20)),
  107. width: double.infinity,
  108. child: Center(
  109. child: Text(
  110. "Sign in",
  111. style: TextStyle(
  112. color: Color(0xFF265e59),
  113. fontSize: 30,
  114. fontWeight: FontWeight.bold),
  115. ),
  116. ),
  117. ),
  118. ),
  119. ),
  120. ],
  121. ),
  122. ),
  123. ),
  124. Expanded(
  125. flex: 2,
  126. child: Center(
  127. child: GestureDetector(
  128. onTap: nextScreen,
  129. child: Text(
  130. "Forgot password?",
  131. style: TextStyle(
  132. color: Colors.white,
  133. fontSize: 22,
  134. decoration: TextDecoration.underline),
  135. ),
  136. ),
  137. ),
  138. ),
  139. ],
  140. ),
  141. ),
  142. ),
  143. );
  144. }
  145. nextScreen() {
  146. Navigator.of(context).pushNamed(Routes.homePage);
  147. }
  148. }