From b05b62e291c1cc733e3e815c3d93199340073775 Mon Sep 17 00:00:00 2001 From: "23028876916@qq.com" Date: Sat, 20 Feb 2021 11:35:59 +0800 Subject: [PATCH] =?UTF-8?q?0220=20=E6=B7=BB=E5=8A=A0=E5=95=86=E5=93=81?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2=E7=9A=84=E5=BA=97=E9=93=BA?= =?UTF-8?q?=E7=BD=91=E9=A1=B5=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store/model/store_model.dart | 6 ++- .../goods_details/store/store_widget.dart | 51 +++++++++++-------- lib/widgets/share/share_alert_select.dart | 2 + 3 files changed, 38 insertions(+), 21 deletions(-) diff --git a/lib/widgets/goods_details/store/model/store_model.dart b/lib/widgets/goods_details/store/model/store_model.dart index c8de870..138e2cf 100644 --- a/lib/widgets/goods_details/store/model/store_model.dart +++ b/lib/widgets/goods_details/store/model/store_model.dart @@ -33,6 +33,7 @@ class StoreModel { String heightPointIcon; String publicPointIcon; String lowPointIcon; + String shop_url; StoreModel({ this.description, @@ -65,7 +66,8 @@ class StoreModel { this.moreIcon, this.heightPointIcon, this.publicPointIcon, - this.lowPointIcon + this.lowPointIcon, + this.shop_url }); @@ -101,6 +103,7 @@ class StoreModel { heightPointIcon = json['height_point_icon']; publicPointIcon = json['public_point_icon']; lowPointIcon = json['low_point_icon']; + shop_url = json['shop_url']; } @@ -137,6 +140,7 @@ class StoreModel { data['height_point_icon'] = this.heightPointIcon; data['public_point_icon'] = this.publicPointIcon; data['low_point_icon'] = this.lowPointIcon; + data['shop_url'] = this.shop_url; return data; } diff --git a/lib/widgets/goods_details/store/store_widget.dart b/lib/widgets/goods_details/store/store_widget.dart index 7b5d33c..236d72b 100644 --- a/lib/widgets/goods_details/store/store_widget.dart +++ b/lib/widgets/goods_details/store/store_widget.dart @@ -20,7 +20,8 @@ class StoreWidget extends StatelessWidget { @override Widget build(BuildContext context) { return BlocProvider( - create: (_) => StoreBloc(repository: StoreRepository()), //..add(StoreInitEvent(model: model)), + create: (_) => StoreBloc(repository: StoreRepository()), + //..add(StoreInitEvent(model: model)), child: StoreContainer( model, key: UniqueKey(), @@ -49,12 +50,13 @@ class _StoreContainerState extends State { void _onMoreClick() {} /// 点击商家 - void _onStoreClick() { - print("点击了_onStoreClick"); + void _onStoreClick(StoreModel model) { + print("点击商家_onStoreClick"); Logger.log(widget.model['data']); - - // RouterUtil.openWebview(url, context); - + Logger.log("店铺:" + model.shop_url); + if (!EmptyUtil.isEmpty(model.shop_url)) { + RouterUtil.openWebview(model.shop_url, context); + } } @override @@ -80,22 +82,27 @@ class _StoreContainerState extends State { Widget _getMianWidget(StoreModel model) { return GestureDetector( onTap: () { - _onStoreClick(); + _onStoreClick(model); }, child: Container( width: double.infinity, height: 50 + 20.0 + 18, padding: const EdgeInsets.only(left: 12.5, right: 12.5, top: 20, bottom: 18), - margin: EdgeInsets.only(top: ParseUtil.stringParseDouble(model?.topMargin), left: ParseUtil.stringParseDouble(model?.leftRightMargin), right: ParseUtil.stringParseDouble(model?.leftRightMargin)), + margin: EdgeInsets.only( + top: ParseUtil.stringParseDouble(model?.topMargin), + left: ParseUtil.stringParseDouble(model?.leftRightMargin), + right: ParseUtil.stringParseDouble(model?.leftRightMargin)), decoration: BoxDecoration( - color: HexColor.fromHex(model?.bgColor), - borderRadius: BorderRadius.only( - topRight: Radius.circular(ParseUtil.stringParseDouble(model?.topRightRadius)), - topLeft: Radius.circular(ParseUtil.stringParseDouble(model?.topLeftRadius)), - bottomRight: Radius.circular(ParseUtil.stringParseDouble(model?.bottomRightRadius)), - bottomLeft: Radius.circular(ParseUtil.stringParseDouble(model?.bottomLeftRadius)), - ) - ), + color: HexColor.fromHex(model?.bgColor), + borderRadius: BorderRadius.only( + topRight: + Radius.circular(ParseUtil.stringParseDouble(model?.topRightRadius)), + topLeft: Radius.circular(ParseUtil.stringParseDouble(model?.topLeftRadius)), + bottomRight: + Radius.circular(ParseUtil.stringParseDouble(model?.bottomRightRadius)), + bottomLeft: + Radius.circular(ParseUtil.stringParseDouble(model?.bottomLeftRadius)), + )), child: Row( children: [ /// 商家图片 @@ -149,7 +156,8 @@ class _StoreContainerState extends State { /// 更多 TODO 暂时隐藏,等后台有数据后再打开 Visibility( visible: false, - child: Text(model?.moreText ?? '更多店铺优惠', style: TextStyle(color: HexColor.fromHex('#FF4242'), fontSize: 11))), + child: Text(model?.moreText ?? '更多店铺优惠', + style: TextStyle(color: HexColor.fromHex('#FF4242'), fontSize: 11))), ], ); } @@ -160,13 +168,16 @@ class _StoreContainerState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ /// 宝贝描述 5.0 - _getCoustomWidet(model?.description ?? '宝贝描述 5.0', model?.descTextColor1 ?? '#999999', model?.heightPointIcon ?? ''), + _getCoustomWidet(model?.description ?? '宝贝描述 5.0', + model?.descTextColor1 ?? '#999999', model?.heightPointIcon ?? ''), /// 物流服务 5.0 - _getCoustomWidet(model?.logistics ?? '宝贝描述 5.0', model?.descTextColor2 ?? '#999999', model?.publicPointIcon ?? ''), + _getCoustomWidet(model?.logistics ?? '宝贝描述 5.0', + model?.descTextColor2 ?? '#999999', model?.publicPointIcon ?? ''), /// 服务态度 1.0 - _getCoustomWidet(model?.service ?? '宝贝描述 5.0', model?.descTextColor3 ?? '#999999', model?.lowPointIcon ?? ''), + _getCoustomWidet(model?.service ?? '宝贝描述 5.0', model?.descTextColor3 ?? '#999999', + model?.lowPointIcon ?? ''), ], ); } diff --git a/lib/widgets/share/share_alert_select.dart b/lib/widgets/share/share_alert_select.dart index 1f82b99..bb3f86a 100644 --- a/lib/widgets/share/share_alert_select.dart +++ b/lib/widgets/share/share_alert_select.dart @@ -98,11 +98,13 @@ class _ShareAlertSelectState extends State { EventUtil.instance.fire(model); } + ///截图保存 Future _updateModel(GlobalKey _globalKey) async { ShareDataModel _shareModel = ShareDataModel(); BuildContext buildContext = _globalKey.currentContext; if (null != buildContext) { RenderRepaintBoundary boundary = buildContext.findRenderObject(); + ///pixelRatio是放大倍数 ui.Image image = await boundary.toImage(pixelRatio: 1); // 注意:png是压缩后格式,如果需要图片的原始像素数据,请使用rawRgba ByteData byteData = await image.toByteData(format: ui.ImageByteFormat.png);