page_crtacc.dart 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter/widgets.dart';
  4. import 'package:taskservice/Common/JXColors.dart';
  5. import 'package:taskservice/Model/JXServiceModel.dart';
  6. class CreateAccPage extends StatefulWidget {
  7. @override
  8. _CreateAccPageState createState() => _CreateAccPageState();
  9. }
  10. class _CreateAccPageState extends State<CreateAccPage> {
  11. List<JXServiceModel> services;
  12. @override
  13. void initState() {
  14. super.initState();
  15. services = [
  16. JXServiceModel()
  17. ..kind = '清洗'
  18. ..cycle = 3
  19. ..cycleUnit = '个月'
  20. ..remark = '备注1',
  21. JXServiceModel()
  22. ..kind = '清洗2'
  23. ..cycle = 1
  24. ..cycleUnit = '个月'
  25. ..remark = '备注11',
  26. JXServiceModel()
  27. ..kind = '清洗3'
  28. ..cycle = 2
  29. ..cycleUnit = '个月'
  30. ..remark = '备注1111',
  31. JXServiceModel()
  32. ..kind = '清洗4'
  33. ..cycle = 30
  34. ..cycleUnit = '个月'
  35. ..remark = '备注111111',
  36. JXServiceModel()
  37. ..kind = '清洗5'
  38. ..cycle = 12
  39. ..cycleUnit = '个月'
  40. ..remark = '备注111111',
  41. JXServiceModel()
  42. ..kind = '清洗6'
  43. ..cycle = 2
  44. ..cycleUnit = '个月'
  45. ..remark = '备注111111',
  46. ];
  47. }
  48. @override
  49. Widget build(BuildContext context) {
  50. return SafeArea(
  51. child: Scaffold(
  52. appBar: AppBar(
  53. centerTitle: true,
  54. title: Text('新建会员'),
  55. backgroundColor: JXColors.k1F2529,
  56. ),
  57. body: CustomScrollView(
  58. slivers: <Widget>[
  59. buildEditPart(),
  60. buildItemsPart(),
  61. SliverToBoxAdapter(
  62. child: Container(
  63. decoration: BoxDecoration(
  64. borderRadius: BorderRadius.circular(12),
  65. border: Border.all(
  66. width: 1,
  67. )),
  68. margin: EdgeInsets.symmetric(vertical: 12, horizontal: 80),
  69. child: InkWell(
  70. onTap: () => null,
  71. child: Container(
  72. padding: EdgeInsets.all(8),
  73. child: Text(
  74. '添加服务',
  75. textAlign: TextAlign.center,
  76. style: TextStyle(fontSize: 18),
  77. ),
  78. ),
  79. ),
  80. ),
  81. ),
  82. ],
  83. ),
  84. ));
  85. }
  86. SliverList buildItemsPart() {
  87. return SliverList(
  88. delegate: SliverChildBuilderDelegate((BuildContext context, int index) {
  89. if (index <= services.length - 1) {
  90. var service = services[index];
  91. return Container(
  92. padding: EdgeInsets.all(16),
  93. child: Column(
  94. children: <Widget>[
  95. Row(
  96. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  97. children: <Widget>[
  98. Text('类型: ${service.kind}'),
  99. Text('周期: ${service.cycle}${service.cycleUnit}'),
  100. ],
  101. ),
  102. Row(
  103. children: <Widget>[
  104. Text('备注 ${service.remark}'),
  105. ],
  106. ),
  107. Divider(
  108. height: 2,
  109. thickness: 2,
  110. ),
  111. ],
  112. ),
  113. );
  114. } else {
  115. return null;
  116. }
  117. }));
  118. }
  119. SliverList buildEditPart() {
  120. return SliverList(
  121. delegate: SliverChildListDelegate([
  122. Row(
  123. mainAxisSize: MainAxisSize.max,
  124. children: <Widget>[
  125. SizedBox(
  126. width: 20,
  127. ),
  128. Text(
  129. '姓名',
  130. style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
  131. ),
  132. Expanded(
  133. child: Padding(
  134. padding: const EdgeInsets.symmetric(horizontal: 20),
  135. child: TextField(),
  136. )),
  137. ],
  138. ),
  139. Row(
  140. mainAxisSize: MainAxisSize.max,
  141. children: <Widget>[
  142. SizedBox(
  143. width: 20,
  144. ),
  145. Text(
  146. '电话',
  147. style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
  148. ),
  149. Expanded(
  150. child: Padding(
  151. padding: const EdgeInsets.symmetric(horizontal: 20),
  152. child: TextField(),
  153. )),
  154. ],
  155. ),
  156. Row(
  157. mainAxisSize: MainAxisSize.max,
  158. children: <Widget>[
  159. SizedBox(
  160. width: 20,
  161. ),
  162. Text(
  163. '生日',
  164. style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
  165. ),
  166. Expanded(
  167. child: Padding(
  168. padding: const EdgeInsets.symmetric(horizontal: 20),
  169. child: TextField(),
  170. )),
  171. ],
  172. ),
  173. Container(
  174. height: 44,
  175. child: Row(
  176. mainAxisSize: MainAxisSize.max,
  177. children: <Widget>[
  178. SizedBox(
  179. width: 20,
  180. ),
  181. Text(
  182. '地址',
  183. style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
  184. ),
  185. Expanded(
  186. child: Padding(
  187. padding: const EdgeInsets.symmetric(horizontal: 20),
  188. child: Container(
  189. margin: EdgeInsets.only(bottom: 1),
  190. child: Text('省份/城市/区域')),
  191. )),
  192. ],
  193. ),
  194. ),
  195. Divider(
  196. height: 1,
  197. ),
  198. SizedBox(
  199. height: 12,
  200. ),
  201. Row(
  202. crossAxisAlignment: CrossAxisAlignment.start,
  203. children: <Widget>[
  204. SizedBox(
  205. width: 12,
  206. ),
  207. Container(
  208. margin: EdgeInsets.only(top: 8),
  209. width: 60,
  210. alignment: Alignment.center,
  211. child: Text(
  212. '详细地址',
  213. style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
  214. ),
  215. ),
  216. Expanded(
  217. child: Padding(
  218. padding: const EdgeInsets.symmetric(horizontal: 20),
  219. child: Container(
  220. decoration: BoxDecoration(
  221. border: Border.all(color: JXColors.kE6E6E6, width: 2),
  222. borderRadius: BorderRadius.circular(12)),
  223. height: 150,
  224. child: TextField(decoration: null)),
  225. )),
  226. ],
  227. ),
  228. SizedBox(
  229. height: 12,
  230. ),
  231. Row(
  232. crossAxisAlignment: CrossAxisAlignment.start,
  233. children: <Widget>[
  234. SizedBox(
  235. width: 12,
  236. ),
  237. Container(
  238. margin: EdgeInsets.only(top: 8),
  239. width: 60,
  240. alignment: Alignment.center,
  241. child: Text(
  242. '备注',
  243. style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
  244. ),
  245. ),
  246. Expanded(
  247. child: Padding(
  248. padding: const EdgeInsets.symmetric(horizontal: 20),
  249. child: Container(
  250. decoration: BoxDecoration(
  251. border: Border.all(color: JXColors.kE6E6E6, width: 2),
  252. borderRadius: BorderRadius.circular(12)),
  253. height: 150,
  254. child: TextField(decoration: null)),
  255. )),
  256. ],
  257. ),
  258. SizedBox(
  259. height: 12,
  260. ),
  261. Container(
  262. padding: EdgeInsets.all(12),
  263. decoration: BoxDecoration(color: JXColors.kE6E6E6),
  264. child: Text(
  265. '服务',
  266. style: TextStyle(color: JXColors.k2E3032),
  267. ),
  268. ),
  269. ]),
  270. );
  271. }
  272. }