repair_add_page.dart 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. import 'package:deus_app/PhotoTool.dart';
  2. import 'package:deus_app/common/style/TitleBar.dart';
  3. import 'package:deus_app/common/style/gsy_style.dart';
  4. import 'package:deus_app/common/utils/ConstantString.dart';
  5. import 'package:deus_app/page/repair/repair_job_device_list.dart';
  6. import 'package:flutter/material.dart';
  7. import 'package:flutter/services.dart';
  8. import 'package:wechat_assets_picker/wechat_assets_picker.dart';
  9. class RepairAddPage extends StatefulWidget {
  10. const RepairAddPage({super.key});
  11. @override
  12. State<StatefulWidget> createState() {
  13. return _RepairAddPage();
  14. }
  15. }
  16. class _RepairAddPage extends State<RepairAddPage> {
  17. int groupValue = 1;
  18. String note='',theme='';
  19. List<AssetEntity> imageFiles = [];
  20. @override
  21. Widget build(BuildContext context) {
  22. return Scaffold(
  23. appBar: TitleBar().backAppbar("新建报修"),
  24. backgroundColor: const Color(0xfff2f2f2),
  25. body: Stack(children: [
  26. Column(
  27. children: [
  28. Expanded(
  29. // flex: 7,
  30. child: ListView(
  31. children: _Ws(),
  32. ),
  33. ),
  34. ],
  35. ),
  36. Positioned(
  37. left: 0,
  38. right: 0,
  39. bottom:0,
  40. // flex: 7,
  41. child:SizedBox(
  42. height: 50,
  43. width: double.infinity,
  44. child: TextButton(
  45. onPressed: () {
  46. },
  47. style: ButtonStyle(
  48. backgroundColor: MaterialStateProperty.all<Color>(
  49. Color(0xFF4875EC)),
  50. shape: MaterialStateProperty.all(
  51. BeveledRectangleBorder(
  52. borderRadius: BorderRadius.circular(0))),
  53. foregroundColor:
  54. MaterialStateProperty.all<Color>(Colors.white),
  55. ),
  56. child: const Text(ConstantString.submit),
  57. ),
  58. ),
  59. )
  60. ]));
  61. }
  62. List<Widget> _Ws() {
  63. List<Widget> ws = [];
  64. ws.add(_basicInformation());
  65. ws.add(_patrolAddTitle());
  66. // ws.add(_patrolAdd());
  67. ws.add(_notes());
  68. return ws;
  69. }
  70. Widget _notes(){
  71. return Container(
  72. child: Column(
  73. children: <Widget>[
  74. Container(
  75. height: 50,
  76. padding: EdgeInsets.only(left: 12),
  77. alignment: Alignment.centerLeft,
  78. child: Text('报修说明',style: TextStyle(
  79. color: Colors.black,
  80. fontSize: GSYConstant.TextSize15,
  81. )),
  82. ),
  83. Container(
  84. padding: EdgeInsets.only(left: 12,right: 12,bottom: 12),
  85. decoration: BoxDecoration(color: Colors.white),
  86. child: Column(
  87. children: [
  88. const SizedBox(
  89. height: 10,
  90. ),
  91. TextField(
  92. maxLines: 5,
  93. decoration: InputDecoration(border: OutlineInputBorder()),
  94. style: TextStyle(fontSize: 14),
  95. onChanged: (value) {
  96. note = value;
  97. },
  98. )
  99. ],
  100. ),
  101. ),
  102. Container(
  103. // padding: EdgeInsets.only(left: 12,right: 12),
  104. decoration: BoxDecoration(color: Colors.white),
  105. child: PhotoTool(imageCount: 5, lineCount: 5, addCall: (List<AssetEntity> _imageFiles){
  106. imageFiles.addAll(_imageFiles);
  107. }, removeCall:(int index){
  108. imageFiles.remove(index);
  109. }),
  110. )
  111. ],
  112. ),
  113. );
  114. }
  115. Widget _basicInformation() {
  116. return Column(children: [
  117. Container(
  118. height: 50,
  119. padding: EdgeInsets.only(left: 12),
  120. alignment: Alignment.centerLeft,
  121. child: const Text(
  122. '基本信息:',
  123. style: TextStyle(
  124. color: Colors.black,
  125. fontSize: GSYConstant.TextSize15,
  126. ),
  127. ),
  128. ),
  129. Container(
  130. color: Colors.white,
  131. padding: EdgeInsets.only(left: 12, right: 12),
  132. child: Column(
  133. children: [
  134. Row(
  135. children: [
  136. Text(
  137. '紧急程度:',
  138. style: TextStyle(
  139. color: GSYColors.primaryLightValue,
  140. fontSize: GSYConstant.TextSize15,
  141. ),
  142. ),
  143. Radio(
  144. value: 1,
  145. groupValue: groupValue,
  146. onChanged: (value) {
  147. // groupValue = value;
  148. setState(() {
  149. groupValue = value!;
  150. });
  151. },
  152. ),
  153. Text("一般",
  154. style: TextStyle(
  155. color: GSYColors.primaryLightValue,
  156. fontSize: GSYConstant.TextSize15,
  157. )),
  158. Radio(
  159. value: 2,
  160. groupValue: groupValue,
  161. onChanged: (value) {
  162. // groupValue = value;
  163. setState(() {
  164. groupValue = value!;
  165. });
  166. },
  167. ),
  168. Text("紧急",
  169. style: TextStyle(
  170. color: GSYColors.primaryLightValue,
  171. fontSize: GSYConstant.smallTextSize,
  172. ))
  173. ],
  174. ),
  175. const SizedBox(
  176. height: 10,
  177. ),
  178. Row(children: [
  179. Text(
  180. '报修主题:',
  181. style: TextStyle(
  182. color: GSYColors.primaryLightValue,
  183. fontSize: GSYConstant.TextSize15,
  184. ),
  185. ),
  186. const SizedBox(
  187. width: 15,
  188. ),
  189. Container(
  190. height: 40,
  191. width: MediaQuery.of(context).size.width / 2 +
  192. MediaQuery.of(context).size.width / 8,
  193. child: TextField(
  194. decoration: InputDecoration(
  195. border: OutlineInputBorder(),
  196. hintText: '请输入报修主题',
  197. contentPadding: EdgeInsets.only(
  198. bottom: 20, left: 10 // HERE THE IMPORTANT PART
  199. )),
  200. style: TextStyle(fontSize: 14),
  201. textAlignVertical: TextAlignVertical.center,
  202. textAlign: TextAlign.left,
  203. onChanged: (value) {
  204. theme=value;
  205. },
  206. ),
  207. )
  208. ]),
  209. const SizedBox(
  210. height: 10,
  211. ),
  212. ],
  213. ),
  214. )
  215. ]);
  216. }
  217. Widget _patrolAddTitle() {
  218. return Container(
  219. padding: EdgeInsets.fromLTRB(12, 0, 12, 0),
  220. height: 50,
  221. child: Row(
  222. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  223. children: [
  224. const Text(
  225. '报修设备:',
  226. style: TextStyle(
  227. color: Colors.black,
  228. fontSize: GSYConstant.TextSize15,
  229. ),
  230. ),
  231. Container(
  232. child: TextButton(
  233. onPressed: () {
  234. Navigator.push(
  235. context,
  236. MaterialPageRoute(
  237. builder: (context) =>
  238. new RepairJobDeviceList()));
  239. },
  240. child: Row(
  241. children: [
  242. new Icon(Icons.add),
  243. new Text(
  244. '选择设备',
  245. style: TextStyle(
  246. color: Colors.blue,
  247. fontSize: GSYConstant.TextSize15,
  248. ),
  249. textAlign: TextAlign.right,
  250. )
  251. ],
  252. ),
  253. ),
  254. ),
  255. ],
  256. ),
  257. );
  258. }
  259. Widget _patrolAdd() {
  260. return Container(
  261. padding: EdgeInsets.only(top: 12, bottom: 12, left: 12, right: 12),
  262. color: Colors.white,
  263. child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
  264. Container(
  265. child: Text(
  266. '',
  267. style: const TextStyle(
  268. color: Colors.black,
  269. fontSize: GSYConstant.middleTextWhiteSize,
  270. fontWeight: FontWeight.bold,
  271. ),
  272. ),
  273. ),
  274. Container(
  275. padding: EdgeInsets.only(top: 3, bottom: 3, left: 5, right: 5),
  276. child: Text(""
  277. // equipmentVOS[index].status == 0
  278. // ? '在线'
  279. // : equipmentVOS[index].status == 1
  280. // ? '离线'
  281. // : equipmentVOS[index].status == 2
  282. // ? '未激活'
  283. // : '未知',
  284. // textAlign: TextAlign.right,
  285. // style: TextStyle(
  286. // color: equipmentVOS[index].status == 0
  287. // ? Colors.blue
  288. // : equipmentVOS[index].status == 1
  289. // ? Colors.orange
  290. // : equipmentVOS[index].status == 2
  291. // ? Colors.red
  292. // : Colors.black,
  293. // fontSize: GSYConstant.minTextSize,
  294. // ),
  295. ),
  296. // decoration: BoxDecoration(
  297. // border: new Border.all(
  298. // color: equipmentVOS[index].status == 0
  299. // ? Colors.blue
  300. // : equipmentVOS[index].status == 1
  301. // ? Colors.orange
  302. // : equipmentVOS[index].status == 2
  303. // ? Colors.red
  304. // : Colors.black, //边框颜色
  305. // width: 1.0, //边框粗细
  306. // ),
  307. // borderRadius: const BorderRadius.all(
  308. // const Radius.circular(3.0)), //边框的弧度
  309. // ),
  310. )
  311. ]),
  312. );
  313. }
  314. }