order_detail_page.dart 10 KB

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