submit_page.dart 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_tracker/model/config.dart';
  3. import 'package:flutter_tracker/utils/app_util.dart';
  4. class SubmitPage extends StatefulWidget {
  5. const SubmitPage({Key key}) : super(key: key);
  6. @override
  7. _SubmitPageState createState() => _SubmitPageState();
  8. }
  9. class _SubmitPageState extends State<SubmitPage> {
  10. Size get _size => MediaQuery.of(context).size;
  11. final TextEditingController _controllerUsn = TextEditingController();
  12. final TextEditingController _controllerTel = TextEditingController();
  13. final TextEditingController _controllerAddress = TextEditingController();
  14. final GlobalKey _formKey = GlobalKey<FormState>();
  15. String _userName = "";
  16. String _tel = "";
  17. String _addresds = "";
  18. @override
  19. Widget build(BuildContext context) {
  20. return Scaffold(
  21. appBar: AppBar(
  22. title: Text("疫情上报"),
  23. ),
  24. body: SizedBox(
  25. width: _size.width,
  26. child: SingleChildScrollView(
  27. child: Padding(
  28. padding:
  29. const EdgeInsets.symmetric(vertical: 16.0, horizontal: 24.0),
  30. child: Column(
  31. children: [
  32. TextFormField(
  33. autofocus: true,
  34. controller: _controllerUsn,
  35. decoration: const InputDecoration(
  36. labelText: "姓名:",
  37. hintText: "请输入真实姓名",
  38. icon: Icon(Icons.person)),
  39. // 校验用户名
  40. validator: (v) {
  41. return v.trim().length > 0 ? null : "姓名不能为空";
  42. },
  43. onChanged: (inputStr) {
  44. _userName = inputStr;
  45. },
  46. ),
  47. TextFormField(
  48. controller: _controllerTel,
  49. decoration: const InputDecoration(
  50. labelText: "电话:",
  51. hintText: "联系电话",
  52. icon: Icon(Icons.phone)),
  53. validator: (v) {
  54. return v.trim().length > 11 ? null : "手机号错误";
  55. },
  56. onChanged: (inputStr) {
  57. _tel = inputStr;
  58. },
  59. ),
  60. TextFormField(
  61. controller: _controllerAddress,
  62. decoration: const InputDecoration(
  63. labelText: "住址:",
  64. hintText: "请输入家庭住址",
  65. icon: Icon(Icons.house)),
  66. validator: (v) {
  67. return v.trim().length > 0 ? null : "请输入地址";
  68. },
  69. onChanged: (inputStr) {
  70. _addresds = inputStr;
  71. },
  72. ),
  73. SizedBox(
  74. height: 10,
  75. ),
  76. Align(
  77. child: Text(
  78. "健康状态:",
  79. style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
  80. ),
  81. alignment: Alignment.centerLeft,
  82. ),
  83. Row(
  84. children: [
  85. RadioListTile(
  86. title: Text("阴性"),
  87. value: 0,
  88. groupValue: 0,
  89. onChanged: (value) {},
  90. ),
  91. RadioListTile(
  92. title: Text("阳性"),
  93. value: 1,
  94. groupValue: 0,
  95. onChanged: (value) {},
  96. ),
  97. ],
  98. ),
  99. SizedBox(
  100. height: 10,
  101. ),
  102. Align(
  103. child: Text(
  104. "核酸检测:",
  105. style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
  106. ),
  107. alignment: Alignment.centerLeft,
  108. ),
  109. Text("请拍照上传清晰的核酸证明图片"),
  110. InkWell(
  111. onTap: () {
  112. chooseImg();
  113. },
  114. child: Container(
  115. child: Image.asset(
  116. "assets/images/add.png",
  117. width: 160,
  118. height: 160,
  119. ),
  120. ),
  121. ),
  122. SizedBox(
  123. height: 10,
  124. ),
  125. Container(
  126. width: 150,
  127. child: InkWell(
  128. onTap: () {
  129. // 登录
  130. submitInfo();
  131. },
  132. child: Container(
  133. width: double.infinity,
  134. height: AppUtil.height(80),
  135. padding: EdgeInsets.only(
  136. right: AppUtil.width(20), left: AppUtil.width(20)),
  137. decoration: BoxDecoration(
  138. gradient: const LinearGradient(colors: [
  139. ThemeColor.loignColor,
  140. ThemeColor.loignColor
  141. ]),
  142. borderRadius: BorderRadius.circular(10),
  143. boxShadow: const [
  144. BoxShadow(
  145. offset: Offset(1.0, 5.0),
  146. color: ThemeColor.loignColor,
  147. blurRadius: 5.0,
  148. )
  149. ]),
  150. child: const Center(
  151. child: Text(
  152. "登录",
  153. style: TextStyle(fontSize: 20, color: Colors.white),
  154. ),
  155. ),
  156. ),
  157. ),
  158. ),
  159. ],
  160. ),
  161. ),
  162. ),
  163. ),
  164. );
  165. }
  166. void submitInfo() {
  167. }
  168. void chooseImg() {
  169. }
  170. }