submit_page.dart 6.0 KB

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