From 6d9f8f40fbbeeec94f550e1acf84995b05a2220f Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Fri, 29 Jan 2021 17:46:31 +0800 Subject: [PATCH] fixed some issues --- lib/model/manager/goods_out_model.dart | 41 ++++++++++++++++++- .../deto_create_page/deto_create_page.dart | 9 ++-- .../widget/goods_info_card.dart | 11 +++-- 3 files changed, 53 insertions(+), 8 deletions(-) diff --git a/lib/model/manager/goods_out_model.dart b/lib/model/manager/goods_out_model.dart index de53666b..9f326fec 100644 --- a/lib/model/manager/goods_out_model.dart +++ b/lib/model/manager/goods_out_model.dart @@ -6,6 +6,7 @@ class GoodsOutModel { int approach; int status; String movingCompanyTel; + List imgUrl; GoodsOutModel( {this.id, @@ -14,7 +15,8 @@ class GoodsOutModel { this.expectedTime, this.approach, this.status, - this.movingCompanyTel}); + this.movingCompanyTel, + this.imgUrl}); GoodsOutModel.fromJson(Map json) { id = json['id']; @@ -24,6 +26,12 @@ class GoodsOutModel { approach = json['approach']; status = json['status']; movingCompanyTel = json['movingCompanyTel']; + if (json['imgUrl'] != null) { + imgUrl = new List(); + json['imgUrl'].forEach((v) { + imgUrl.add(new ImgUrl.fromJson(v)); + }); + } } Map toJson() { @@ -35,6 +43,37 @@ class GoodsOutModel { data['approach'] = this.approach; data['status'] = this.status; data['movingCompanyTel'] = this.movingCompanyTel; + if (this.imgUrl != null) { + data['imgUrl'] = this.imgUrl.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class ImgUrl { + String url; + String size; + int longs; + int paragraph; + int sort; + + ImgUrl({this.url, this.size, this.longs, this.paragraph, this.sort}); + + ImgUrl.fromJson(Map json) { + url = json['url']; + size = json['size']; + longs = json['longs']; + paragraph = json['paragraph']; + sort = json['sort']; + } + + Map toJson() { + final Map data = new Map(); + data['url'] = this.url; + data['size'] = this.size; + data['longs'] = this.longs; + data['paragraph'] = this.paragraph; + data['sort'] = this.sort; return data; } } diff --git a/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart b/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart index 119b1a6d..51ff6971 100644 --- a/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart +++ b/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart @@ -340,7 +340,7 @@ class _DetoCreatePageState extends State { setState(() {}); } - Widget _getMovingCompany(String movingCompany) { + Widget _getMovingCompany() { return Container( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -350,12 +350,15 @@ class _DetoCreatePageState extends State { InkWell( onTap: () async { _selectTel = await SelectMoveCompanyPage().to(); + setState(() { + + }); }, child: Padding( padding: EdgeInsets.symmetric(vertical: 30.w), child: Row( children: [ - (movingCompany.isEmptyOrNull ? '请选择搬家公司' : movingCompany) + (_selectTel.isEmptyOrNull ? '请选择搬家公司' : _selectTel) .text .color(ktextSubColor) .size(36.sp) @@ -412,7 +415,7 @@ class _DetoCreatePageState extends State { _showItmePicker(); }), _getApproach(), - _selectApproach == 0 ? SizedBox() : _getMovingCompany(''), + _selectApproach == 0 ? SizedBox() : _getMovingCompany(), Container( margin: EdgeInsets.only(top: 54.w, bottom: 24.w), child: Text( diff --git a/lib/pages/goods_deto_page/widget/goods_info_card.dart b/lib/pages/goods_deto_page/widget/goods_info_card.dart index f7988b0a..3d6dcce8 100644 --- a/lib/pages/goods_deto_page/widget/goods_info_card.dart +++ b/lib/pages/goods_deto_page/widget/goods_info_card.dart @@ -2,6 +2,7 @@ import 'package:akuCommunity/base/base_style.dart'; import 'package:akuCommunity/model/manager/goods_out_model.dart'; import 'package:akuCommunity/utils/bee_map.dart'; +import 'package:akuCommunity/widget/views/horizontal_image_view.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -36,7 +37,7 @@ class GoodsInfoCard extends StatelessWidget { ); } -Color _getColor(int state) { + Color _getColor(int state) { switch (state) { case 1: case 2: @@ -51,6 +52,7 @@ Color _getColor(int state) { return kDangerColor; } } + @override Widget build(BuildContext context) { return Container( @@ -135,14 +137,15 @@ Color _getColor(int state) { children: [ Container( alignment: Alignment.centerLeft, - margin: EdgeInsets.only(bottom: 25.w), + margin: EdgeInsets.only(bottom: 8.w), child: Text( '图片信息', style: TextStyle( fontSize: 28.sp, color: Color(0xff333333)), ), ), - ImageHorizontalList(imageUrl: []), + HorizontalImageView( + model.imgUrl.map((e) => e.url).toList()), ], ), ), @@ -150,7 +153,7 @@ Color _getColor(int state) { ), ), GoodsInfoCardButton( - id:model.id, + id: model.id, tel: model.movingCompanyTel, ) ],