LoginFirst.dart 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/cupertino.dart';
  3. import '../styles/colors.dart';
  4. import 'dart:ui';
  5. import '../styles/totast.dart';
  6. import 'LoginSecond.dart';
  7. import '../utils/Utils.dart';
  8. import '../widget/LinearButton.dart';
  9. class LoginFirst extends StatefulWidget {
  10. @override
  11. LoginFirstState createState() => LoginFirstState();
  12. }
  13. class LoginFirstState extends State<LoginFirst> {
  14. String inputVal;
  15. @override
  16. Widget build(BuildContext context) {
  17. return WillPopScope(
  18. child: Scaffold(
  19. body: Container(
  20. color: BG_SUB_COLOR,
  21. child: CustomScrollView(
  22. slivers: <Widget>[
  23. SliverAppBar(
  24. backgroundColor: BG_SUB_COLOR,
  25. centerTitle: true,
  26. elevation: 0,
  27. leading: Container(),
  28. ),
  29. SliverToBoxAdapter(
  30. child: Container(
  31. width: double.infinity,
  32. padding: EdgeInsets.symmetric(vertical: 20, horizontal: 15),
  33. color: BG_SUB_COLOR,
  34. child: Column(
  35. crossAxisAlignment: CrossAxisAlignment.start,
  36. children: <Widget>[
  37. // Text(
  38. // 'LOGO',
  39. // style: TextStyle(
  40. // color: Colors.white,
  41. // fontSize: 64,
  42. // ),
  43. // ),
  44. Image.asset('images/icon_logo.png'),
  45. Container(
  46. margin: EdgeInsets.only(top: 30),
  47. child: Text('手机快捷登录', style: TextStyle(color: Colors.white, fontSize: 28, fontWeight: FontWeight.w500)),
  48. ),
  49. Container(
  50. margin: EdgeInsets.only(top: 20),
  51. child: TextField(
  52. autofocus: true,
  53. keyboardType: TextInputType.phone,
  54. maxLength: 11,
  55. style: TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.w500),
  56. decoration: InputDecoration(
  57. hintText: '输入手机号',
  58. hintStyle: TextStyle(
  59. fontSize: 16,
  60. color: Color(0xFF727785),
  61. ),
  62. prefixIcon: Container(
  63. padding: EdgeInsets.all(10),
  64. // color: PRIMARY_COLOR,
  65. child: Image.asset(
  66. 'images/list_icon_shouji.png',
  67. width: 20,
  68. ),
  69. ),
  70. // suffixIcon:Container(
  71. // padding: EdgeInsets.all(10),
  72. // // color: PRIMARY_COLOR,
  73. // child: Image.asset(
  74. // 'images/list_icon_shouji.png',
  75. // width: 20,
  76. // ),
  77. // ),
  78. counterStyle: TextStyle(color: BG_SUB_COLOR, fontSize: 0)),
  79. onChanged: (value) {
  80. inputVal = value;
  81. })),
  82. Text('未注册的手机号验证后自动创建账户', style: TextStyle(color: Color(0xFF727785), fontSize: 13)),
  83. Container(height: 20,),
  84. LinearButton(
  85. btntext: '下一步',
  86. onTapHomeMenu: () {
  87. if (!checkPhone(inputVal)) {
  88. Toast.show(context, '手机号格式错误', 1500, 'info');
  89. } else {
  90. Navigator.push(
  91. context,
  92. CupertinoPageRoute(
  93. builder: (context) =>
  94. LoginSecond(phone: inputVal),
  95. ),
  96. );
  97. }
  98. }
  99. ),
  100. // FlatButton(
  101. // textColor: Colors.white,
  102. // color: PRIMARY_COLOR,
  103. // highlightColor: Color(0xFF763434),
  104. // child: Text('下一步'),
  105. // onPressed: () {
  106. // if (!checkPhone(inputVal)) {
  107. // Toast.show(context, '手机号格式错误', 1500, 'info');
  108. // } else {
  109. // Navigator.push(
  110. // context,
  111. // CupertinoPageRoute(
  112. // builder: (context) => LoginSecond(phone: inputVal),
  113. // ),
  114. // );
  115. // }
  116. // },
  117. // ),
  118. ],
  119. ),
  120. ),
  121. )
  122. ],
  123. ),
  124. )),
  125. onWillPop: () {
  126. Toast.hide();
  127. // Navigator.pop(context);
  128. return Future.value(false);
  129. });
  130. }
  131. }