register.dart 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. import 'package:flutter/material.dart';
  2. import 'package:bot_toast/bot_toast.dart';
  3. import 'package:flutter/rendering.dart';
  4. import 'package:twong/router/index.dart';
  5. import 'package:twong/utils/index.dart';
  6. import 'package:twong/config/protocols.dart';
  7. import 'package:twong/widgets/round_check_box.dart';
  8. class RegisterPage extends StatefulWidget {
  9. @override
  10. State<StatefulWidget> createState() {
  11. return _RegisterPageState();
  12. }
  13. }
  14. class _RegisterPageState extends State<RegisterPage> {
  15. bool read = false;
  16. TextEditingController _controller = TextEditingController();
  17. _onGetCodeClick (String phone) {
  18. if(!read) {
  19. BotToast.showText(text:"请先阅读并勾选同意协议!");
  20. return;
  21. }
  22. if(phone.trim() == '') {
  23. BotToast.showText(text:"手机号不能为空!");
  24. return;
  25. }
  26. // Http.inst.getVerifyCode();
  27. }
  28. wechatLogin () {
  29. Utils.notOpen();
  30. }
  31. @override
  32. Widget build(BuildContext context) {
  33. return Scaffold(
  34. body: Container(
  35. decoration: BoxDecoration(
  36. image: DecorationImage(
  37. fit: BoxFit.cover,
  38. image: AssetImage('assets/images/launcher.png'),
  39. )
  40. ),
  41. child: Flex(
  42. direction: Axis.vertical,
  43. children: <Widget>[
  44. Container(
  45. padding: EdgeInsets.only(top: 24),
  46. alignment: Alignment.topRight,
  47. child: FlatButton(
  48. child: Text('跳过,看好货 >', style: TextStyle(color: Colors.white),),
  49. onPressed: () {
  50. Navigator.pop(context);
  51. },),
  52. ),
  53. Container(
  54. height: 100.px,
  55. margin: EdgeInsets.only(bottom: 60.px, top: 10.px),
  56. child: Center(
  57. child: Image.asset("assets/images/logo.png"),
  58. ),
  59. ), Container(
  60. padding: EdgeInsets.only(left: 30, right: 30, top: 10.px),
  61. child: TextField(
  62. autofocus: true,
  63. controller: _controller,
  64. textAlign: TextAlign.center,
  65. onSubmitted: _onGetCodeClick,
  66. keyboardType: TextInputType.phone,
  67. style: TextStyle(color: Colors.white),
  68. textInputAction: TextInputAction.done,
  69. decoration: InputDecoration(
  70. filled: true,
  71. hintText: '请输入手机号码',
  72. border: InputBorder.none,
  73. hintStyle: TextStyle(color: Colors.white70),
  74. enabledBorder: OutlineInputBorder(
  75. borderSide: BorderSide(color: Color(0x00FF00a0)),
  76. borderRadius: BorderRadius.all(
  77. Radius.circular(100),
  78. ),
  79. ),
  80. focusedBorder: OutlineInputBorder(
  81. borderSide: BorderSide(color: Color(0x000000a0)),
  82. borderRadius: BorderRadius.all(
  83. Radius.circular(100),
  84. ),
  85. ),
  86. contentPadding: EdgeInsets.all(10.px),
  87. ),
  88. )
  89. ),
  90. Container(
  91. width: 200.px,
  92. height: 50.px,
  93. padding: EdgeInsets.only(top: 10),
  94. child: RaisedButton(child: Text('获取验证码'), onPressed: () {
  95. _onGetCodeClick(_controller.text);
  96. },
  97. shape: StadiumBorder()
  98. ),
  99. ),
  100. Container(
  101. padding: EdgeInsets.only(right: 20, bottom: 20),
  102. alignment: Alignment.topRight,
  103. child: GestureDetector(
  104. child: Text('遇到问题?', style: TextStyle(color: Colors.white)),
  105. onTap: () {
  106. Utils.notOpen();
  107. }),
  108. ),
  109. Text('其他登录方式', style: TextStyle(color: Colors.white)),
  110. Expanded(child: Container(
  111. padding: EdgeInsets.only(top: 30),
  112. child: Flex(
  113. direction: Axis.horizontal,
  114. children: <Widget>[
  115. Spacer(),
  116. Container(width: 46, height: 46,
  117. child: GestureDetector(
  118. onTap: () => wechatLogin(),
  119. child: Image.asset("assets/images/wechat.png"),
  120. )
  121. ),
  122. Spacer(),
  123. ],
  124. ),
  125. )),
  126. Container(
  127. margin: EdgeInsets.only(bottom: 32.px),
  128. child: Row(
  129. mainAxisAlignment: MainAxisAlignment.center,
  130. children: <Widget>[
  131. Text("注册即视为已阅读并同意",
  132. style: TextStyle(fontSize: 12.px, color: Colors.white54)),
  133. GestureDetector(
  134. onTap: () {
  135. Navigator.pushNamed(context, RouteNames.protocol,
  136. arguments: ProtocolType.USER);
  137. },
  138. child: Text("《用户注册协议》",
  139. style: TextStyle(fontSize: 12.px, color: Colors.white)),
  140. ),
  141. Text(
  142. "和", style: TextStyle(fontSize: 12.px, color: Colors.white54)),
  143. GestureDetector(
  144. onTap: () {
  145. Navigator.pushNamed(context, RouteNames.protocol,
  146. arguments: ProtocolType.VIP);
  147. },
  148. child: Text("《天旺会员隐私政策》",
  149. style: TextStyle(fontSize: 12.px, color: Colors.white)),
  150. ),
  151. ],
  152. ),
  153. ),
  154. ],
  155. ),
  156. ),
  157. );
  158. }
  159. }