From 31782bcb94936bb921f2d05218e3b310b0513712 Mon Sep 17 00:00:00 2001 From: Weller <1812208341@qq.com> Date: Fri, 23 Oct 2020 18:27:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=95=86=E5=93=81=E8=AF=A6?= =?UTF-8?q?=E6=83=85=EF=BC=8C=E8=87=AA=E8=B4=AD=E7=9C=81=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=94=99=E8=AF=AFbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../footer/goods_details_footer_widget.dart | 125 +++++++++------ .../model/goods_details_footer_model.dart | 147 ++++++++++-------- 2 files changed, 163 insertions(+), 109 deletions(-) diff --git a/lib/widgets/goods_details/footer/goods_details_footer_widget.dart b/lib/widgets/goods_details/footer/goods_details_footer_widget.dart index 3968c51..dcf400d 100644 --- a/lib/widgets/goods_details/footer/goods_details_footer_widget.dart +++ b/lib/widgets/goods_details/footer/goods_details_footer_widget.dart @@ -30,7 +30,8 @@ class GoodsDetailsFooterWidget extends StatelessWidget { visible: !EmptyUtil.isEmpty(model), replacement: GoodsDetailsFooterSkeleton(), child: BlocProvider( - create: (_) => GoodsDetailsFooterBloc(repository: GoodsDetailsFooterRepository()), + create: (_) => + GoodsDetailsFooterBloc(repository: GoodsDetailsFooterRepository()), //..add(GoodsDetailsFooterInitEvent(model: model)), child: GooddsDetailsFooterContainer( model, @@ -47,16 +48,18 @@ class GooddsDetailsFooterContainer extends StatefulWidget { const GooddsDetailsFooterContainer(this.model, {Key key}) : super(key: key); @override - _GooddsDetailsFooterContainerState createState() => _GooddsDetailsFooterContainerState(); + _GooddsDetailsFooterContainerState createState() => + _GooddsDetailsFooterContainerState(); } -class _GooddsDetailsFooterContainerState extends State { - +class _GooddsDetailsFooterContainerState + extends State { UserInfoModel _user; @override void initState() { - BlocProvider.of(context).add(GoodsDetailsFooterInitEvent(model: widget?.model)); + BlocProvider.of(context) + .add(GoodsDetailsFooterInitEvent(model: widget?.model)); super.initState(); } @@ -64,7 +67,9 @@ class _GooddsDetailsFooterContainerState extends State PageFactory.create('homePage', null)), + CupertinoPageRoute( + builder: (BuildContext context) => + PageFactory.create('homePage', null)), (Route route) => false, ); } @@ -100,7 +105,8 @@ class _GooddsDetailsFooterContainerState extends State GoodsSharePage(widget.model))); + Navigator.of(context).push(CupertinoPageRoute( + builder: (context) => GoodsSharePage(widget.model))); } } @@ -170,7 +176,8 @@ class _GooddsDetailsFooterContainerState extends State 10 ? 0 : 8), top: 8, left: 21, right: 12.5), + padding: EdgeInsets.only( + bottom: (height > 10 ? 0 : 8), top: 8, left: 21, right: 12.5), decoration: BoxDecoration( // boxShadow: [ // BoxShadow(color: Colors.grey[300], offset: Offset(0.0, 0.0), blurRadius: 5.0, spreadRadius: 2.0), @@ -209,12 +216,18 @@ class _GooddsDetailsFooterContainerState extends State _openHome(), child: Padding( padding: const EdgeInsets.only(right: 35), - child: _getCustomWidget(model?.home ?? '首页', model?.home_color ?? '999999', model?.home_icon ?? ''), + child: _getCustomWidget(model?.home ?? '首页', + model?.home_color ?? '999999', model?.home_icon ?? ''), )), GestureDetector( behavior: HitTestBehavior.opaque, onTap: () => _collectOnClick(), - child: Padding(padding: const EdgeInsets.only(right: 0), child: _getCustomWidget(model?.collect ?? '收藏', model?.collect_color ?? '999999', model?.collect_icon ?? ''))) + child: Padding( + padding: const EdgeInsets.only(right: 0), + child: _getCustomWidget( + model?.collect ?? '收藏', + model?.collect_color ?? '999999', + model?.collect_icon ?? ''))) ], ); } @@ -241,30 +254,40 @@ class _GooddsDetailsFooterContainerState extends State[ RichText( - text: TextSpan(text: '¥ ', style: TextStyle(fontSize: 12, color: HexColor.fromHex(model?.share_earn_val_color ?? 'FFFFFF')), children: [ - TextSpan( - text: model?.share_value ?? '0.0', - style: TextStyle( - fontSize: 15, - fontWeight: FontWeight.bold, - color: HexColor.fromHex(model?.share_earn_color ?? '#FFFFFF'), - fontFamily: 'Din', - package: 'zhiying_base_widget')), - ]), + text: TextSpan( + text: '¥ ', + style: TextStyle( + fontSize: 12, + color: HexColor.fromHex( + model?.share_earn_val_color ?? 'FFFFFF')), + children: [ + TextSpan( + text: model?.share_value ?? '0.0', + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold, + color: HexColor.fromHex( + model?.share_earn_color ?? '#FFFFFF'), + fontFamily: 'Din', + package: 'zhiying_base_widget')), + ]), ), Text( model?.share_earn ?? '分享赚', - style: TextStyle(color: HexColor.fromHex(model?.share_earn_color ?? '#FFFFFF'), fontSize: 12), + style: TextStyle( + color: HexColor.fromHex(model?.share_earn_color ?? '#FFFFFF'), + fontSize: 12), ), ], ), @@ -283,29 +306,42 @@ class _GooddsDetailsFooterContainerState extends State[ RichText( - text: TextSpan(text: '¥ ', style: TextStyle(fontSize: 12, color: HexColor.fromHex(model?.save_earn_val_color ?? 'FFFFFF')), children: [ - TextSpan( - text: model?.slef_buy_value ?? '0.0', - style: TextStyle( - fontSize: 15, - fontWeight: FontWeight.bold, - color: HexColor.fromHex(model?.save_earn_val_color ?? '#FFFFFF'), - fontFamily: 'Din', - package: 'zhiying_base_widget', - )), - ]), + text: TextSpan( + text: '¥ ', + style: TextStyle( + fontSize: 12, + color: HexColor.fromHex( + model?.save_earn_val_color ?? 'FFFFFF')), + children: [ + TextSpan( + text: model?.self_buy_value ?? '0.0', + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold, + color: HexColor.fromHex( + model?.save_earn_val_color ?? '#FFFFFF'), + fontFamily: 'Din', + package: 'zhiying_base_widget', + )), + ]), ), - Text(model?.save_earn ?? '自购省', style: TextStyle(color: HexColor.fromHex(model?.save_earn_color ?? '#FFFFFF'), fontSize: 12)) + Text(model?.save_earn ?? '自购省', + style: TextStyle( + color: + HexColor.fromHex(model?.save_earn_color ?? '#FFFFFF'), + fontSize: 12)) ], ), ), @@ -328,7 +364,8 @@ class _GooddsDetailsFooterContainerState extends State json) { - return GoodsDetailsFooterModel( - collect: json['collect'], - collect_color: json['collect_color'], - collect_icon: json['collect_icon'], - home: json['home'], - home_color: json['home_color'], - home_icon: json['home_icon'], - save_earn: json['save_earn'], - save_earn_bg1_color: json['save_earn_bg1_color'], - save_earn_bg2_color: json['save_earn_bg2_color'], - save_earn_color: json['save_earn_color'], - save_earn_val_color: json['save_earn_val_color'], - share_earn: json['share_earn'], - share_earn_bg1_color: json['share_earn_bg1_color'], - share_earn_bg2_color: json['share_earn_bg2_color'], - share_earn_color: json['share_earn_color'], - share_earn_val_color: json['share_earn_val_color'], - share_value: json['share_value'], - slef_buy_value: json['slef_buy_value'], - ); - } + factory GoodsDetailsFooterModel.fromJson(Map json) { + return GoodsDetailsFooterModel( + collect: json['collect'], + collect_color: json['collect_color'], + collect_icon: json['collect_icon'], + home: json['home'], + home_color: json['home_color'], + home_icon: json['home_icon'], + save_earn: json['save_earn'], + save_earn_bg1_color: json['save_earn_bg1_color'], + save_earn_bg2_color: json['save_earn_bg2_color'], + save_earn_color: json['save_earn_color'], + save_earn_val_color: json['save_earn_val_color'], + share_earn: json['share_earn'], + share_earn_bg1_color: json['share_earn_bg1_color'], + share_earn_bg2_color: json['share_earn_bg2_color'], + share_earn_color: json['share_earn_color'], + share_earn_val_color: json['share_earn_val_color'], + share_value: json['share_value'], + self_buy_value: json['self_buy_value'], + ); + } - Map toJson() { - final Map data = new Map(); - data['collect'] = this.collect; - data['collect_color'] = this.collect_color; - data['collect_icon'] = this.collect_icon; - data['home'] = this.home; - data['home_color'] = this.home_color; - data['home_icon'] = this.home_icon; - data['save_earn'] = this.save_earn; - data['save_earn_bg1_color'] = this.save_earn_bg1_color; - data['save_earn_bg2_color'] = this.save_earn_bg2_color; - data['save_earn_color'] = this.save_earn_color; - data['save_earn_val_color'] = this.save_earn_val_color; - data['share_earn'] = this.share_earn; - data['share_earn_bg1_color'] = this.share_earn_bg1_color; - data['share_earn_bg2_color'] = this.share_earn_bg2_color; - data['share_earn_color'] = this.share_earn_color; - data['share_earn_val_color'] = this.share_earn_val_color; - data['share_value'] = this.share_value; - data['slef_buy_value'] = this.slef_buy_value; - return data; - } -} \ No newline at end of file + Map toJson() { + final Map data = new Map(); + data['collect'] = this.collect; + data['collect_color'] = this.collect_color; + data['collect_icon'] = this.collect_icon; + data['home'] = this.home; + data['home_color'] = this.home_color; + data['home_icon'] = this.home_icon; + data['save_earn'] = this.save_earn; + data['save_earn_bg1_color'] = this.save_earn_bg1_color; + data['save_earn_bg2_color'] = this.save_earn_bg2_color; + data['save_earn_color'] = this.save_earn_color; + data['save_earn_val_color'] = this.save_earn_val_color; + data['share_earn'] = this.share_earn; + data['share_earn_bg1_color'] = this.share_earn_bg1_color; + data['share_earn_bg2_color'] = this.share_earn_bg2_color; + data['share_earn_color'] = this.share_earn_color; + data['share_earn_val_color'] = this.share_earn_val_color; + data['share_value'] = this.share_value; + data['self_buy_value'] = this.self_buy_value; + return data; + } +}