register.dart 5.9 KB

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