send_express_page.dart 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_screenutil/flutter_screenutil.dart';
  3. class SendExpressPage extends StatefulWidget {
  4. final Widget child;
  5. SendExpressPage({
  6. Key key,
  7. this.child
  8. }): super(key: key);
  9. _SendExpressPageState createState() => _SendExpressPageState();
  10. }
  11. class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeepAliveClientMixin{
  12. @override
  13. bool get wantKeepAlive => true;
  14. final Map < Object,
  15. String > sendInfo = {
  16. "icon": 'lib/images/icon_send.png',
  17. "title": "发件信息",
  18. "phone": "010-8788 6890",
  19. "code": "345678",
  20. "name": "朝阳门大阳汽贸",
  21. "address": "北京市朝阳区",
  22. "addressDetail": "朝阳门外大街28号"
  23. };
  24. final Map < Object,
  25. String > getInfo = {
  26. "icon": 'lib/images/icon_shoujian.png',
  27. "title": "收件信息",
  28. "name": "香河汽修厂",
  29. "phone": "010-6734 3426",
  30. "address": "河北省廊坊市",
  31. "addressDetail": "香河县东大街29号院18栋3单元206"
  32. };
  33. Map < String,
  34. String > _itemInfo = {
  35. "icon": "lib/images/icon_huowu.png",
  36. "title": "货物信息",
  37. "itemName": "汽车轮胎",
  38. "itemNo": "4",
  39. "expressPrice": "15",
  40. "collectionPrice": "15800",
  41. "supportPrice": "5000",
  42. "weight": "600",
  43. "itemDesc": "轮胎请核对数量轮胎请"
  44. };
  45. @override
  46. Widget build(BuildContext context) {
  47. return Container(
  48. child: Scaffold(
  49. appBar: AppBar(
  50. title: Text('发件', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(36)), ),
  51. centerTitle: true,
  52. backgroundColor: Color.fromRGBO(64, 98, 254, 1),
  53. // leading: GestureDetector(
  54. // child: Icon(Icons.arrow_back),
  55. // onTap: (){
  56. // Navigator.pushReplacement(context, MaterialPageRoute(builder: (context){
  57. // return HomePage();
  58. // }));
  59. // },
  60. // ),
  61. ),
  62. body: Container(
  63. color: Color.fromRGBO(246, 246, 254, 1),
  64. padding: EdgeInsets.fromLTRB(0, ScreenUtil.getInstance().setHeight(20), 0, ScreenUtil.getInstance().setHeight(20)),
  65. child: ListView(
  66. children: < Widget > [
  67. _sendInfo(sendInfo),
  68. _getInfo(getInfo),
  69. _itemInfoWidget(_itemInfo),
  70. _submitBtn()
  71. ],
  72. ),
  73. ),
  74. resizeToAvoidBottomPadding: false //键盘弹出,页面不跟随向上滑动,防止出现溢出错误
  75. ),
  76. );
  77. }
  78. Widget _sendInfo(Map str) {
  79. return Container(
  80. color: Colors.white,
  81. margin: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(20)),
  82. child: Column(
  83. children: < Widget > [
  84. _titleWidget(str['icon'], str['title']),
  85. _underLine(),
  86. _contentWiget('电话', str['phone']),
  87. _contentWiget('企业编码', str['code']),
  88. _contentWiget('企业名称', str['name']),
  89. _contentWiget('城市/区域', str['address']),
  90. _lastContentWiget('详细地址', str['addressDetail'])
  91. ],
  92. )
  93. );
  94. }
  95. Widget _getInfo(Map str) {
  96. return Container(
  97. color: Colors.white,
  98. margin: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(20)),
  99. child: Column(
  100. children: < Widget > [
  101. _titleWidget(str['icon'], str['title']),
  102. _underLine(),
  103. _contentWiget('企业名称', str['name']),
  104. _contentWiget('电话', str['phone']),
  105. _contentWiget('城市/区域', str['address']),
  106. _lastContentWiget('详细地址', str['addressDetail'])
  107. ],
  108. )
  109. );
  110. }
  111. Widget _itemInfoWidget(Map _itemInfo){
  112. return Container(
  113. child: Container(
  114. color: Colors.white,
  115. child: Column(
  116. crossAxisAlignment: CrossAxisAlignment.start,
  117. children: < Widget > [
  118. _titleWidget(_itemInfo['icon'], "货物信息"),
  119. _underLine(),
  120. _contentWiget("货物名称", _itemInfo["itemName"]),
  121. _contentWiget("数量", _itemInfo["itemNo"]),
  122. _contentWiget("运费", _itemInfo["expressPrice"]),
  123. _contentWiget("代收", _itemInfo["collectionPrice"]),
  124. _contentWiget("保价", _itemInfo["supportPrice"]),
  125. _contentWiget("重量", _itemInfo["weight"]),
  126. _descWidget(_itemInfo['itemDesc'])
  127. ],
  128. ),
  129. )
  130. );
  131. }
  132. Widget _titleWidget(String iconUrl, String str) {
  133. return Container(
  134. height: ScreenUtil.getInstance().setHeight(90),
  135. padding: EdgeInsets.only(left: ScreenUtil.getInstance().setWidth(30)),
  136. child: Center(
  137. child: Row(
  138. mainAxisAlignment: MainAxisAlignment.start,
  139. children: < Widget > [
  140. Padding(
  141. padding: EdgeInsets.only(right: ScreenUtil.getInstance().setHeight(20)),
  142. child: Image.asset(
  143. iconUrl,
  144. width: ScreenUtil.getInstance().setWidth(40),
  145. height: ScreenUtil.getInstance().setHeight(40),
  146. )
  147. ),
  148. Text(str, style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(32)), )
  149. ],
  150. ),
  151. ),
  152. );
  153. }
  154. Widget _underLine() {
  155. return Container(
  156. color: Color.fromRGBO(223, 223, 223, 1),
  157. height: ScreenUtil.getInstance().setHeight(1),
  158. );
  159. }
  160. Widget _contentWiget(String key, String value) {
  161. return Padding(
  162. padding: EdgeInsets.only(left: ScreenUtil.getInstance().setWidth(30)),
  163. child: Column(
  164. children: < Widget > [
  165. SizedBox(
  166. height: ScreenUtil.getInstance().setHeight(89),
  167. child: Center(
  168. child: Row(
  169. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  170. children: < Widget > [
  171. Expanded(
  172. flex: 0,
  173. child: Text('${key}', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(74, 74, 74, 1)), ),
  174. ),
  175. Expanded(
  176. child: Row(
  177. mainAxisAlignment: MainAxisAlignment.end,
  178. children: < Widget > [
  179. //Text('${value}', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(136, 136, 136, 1)), ),
  180. SizedBox(
  181. width: ScreenUtil.getInstance().setWidth(500),
  182. child:TextField(
  183. keyboardType: TextInputType.number,
  184. textAlign: TextAlign.end,
  185. decoration: InputDecoration(
  186. border: InputBorder.none
  187. ),
  188. ),
  189. ),
  190. Icon(Icons.keyboard_arrow_right,color:Color.fromRGBO(199,199,204,1) ,)
  191. ],
  192. )
  193. )
  194. ],
  195. ),
  196. )
  197. ),
  198. Expanded(
  199. flex: 0,
  200. child: _underLine()
  201. )
  202. ],
  203. )
  204. );
  205. }
  206. Widget _lastContentWiget(String key, String value) {
  207. return Padding(
  208. padding: EdgeInsets.only(left: ScreenUtil.getInstance().setWidth(30)),
  209. child: SizedBox(
  210. height: ScreenUtil.getInstance().setHeight(89),
  211. child: Center(
  212. child: Row(
  213. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  214. children: < Widget > [
  215. Expanded(
  216. flex: 0,
  217. child: Text('${key}', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(74, 74, 74, 1)), ),
  218. ),
  219. Expanded(
  220. child: Row(
  221. mainAxisAlignment: MainAxisAlignment.end,
  222. children: < Widget > [
  223. //Text('${value}', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(136, 136, 136, 1)), ),
  224. SizedBox(
  225. width: ScreenUtil.getInstance().setWidth(500),
  226. child:TextField(
  227. keyboardType: TextInputType.number,
  228. textAlign: TextAlign.end,
  229. decoration: InputDecoration(
  230. border: InputBorder.none
  231. ),
  232. ),
  233. ),
  234. Icon(Icons.keyboard_arrow_right,color:Color.fromRGBO(199,199,204,1) ,)
  235. ],
  236. )
  237. )
  238. ],
  239. ),
  240. )
  241. )
  242. );
  243. }
  244. Widget _descWidget(String str) {
  245. return
  246. Container(
  247. padding: EdgeInsets.all(ScreenUtil.getInstance().setWidth(30)),
  248. //child: Text(str, maxLines: 100, style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(74, 74, 74, 1)), ),
  249. child: TextField(
  250. maxLines: 3,
  251. decoration: InputDecoration(
  252. border: InputBorder.none,
  253. hintText: "请输入备注内容"
  254. ),
  255. ),
  256. );
  257. }
  258. Widget _submitBtn() {
  259. return GestureDetector(
  260. child: Container(
  261. margin: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(30), ScreenUtil.getInstance().setWidth(50), ScreenUtil.getInstance().setWidth(30), ScreenUtil.getInstance().setWidth(40)),
  262. height: ScreenUtil.getInstance().setHeight(88),
  263. decoration: BoxDecoration(
  264. borderRadius: BorderRadius.all(Radius.circular(4)),
  265. color: Color.fromRGBO(37, 102, 242, 1),
  266. ),
  267. child: Center(
  268. child: Text("提交", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(32), color: Colors.white), ),
  269. ),
  270. ),
  271. onTap: () {
  272. print('提交');
  273. },
  274. );
  275. }
  276. }