“yanghuaxuan” преди 3 години
родител
ревизия
4083ca5981
променени са 26 файла, в които са добавени 1720 реда и са изтрити 575 реда
  1. +3
    -1
      lib/pages/custom_page/custom_item_page.dart
  2. +12
    -1
      lib/pages/goods_details_page/goods_details_page.dart
  3. +0
    -16
      lib/pages/goods_details_page/notifier/goods_details_page_notifier.dart
  4. +12
    -24
      lib/register.dart
  5. +0
    -61
      lib/widgets/goods_details/counpon_description/counpon_description_widget.dart
  6. +16
    -7
      lib/widgets/goods_details/coupon/counpon_widget.dart
  7. +96
    -48
      lib/widgets/goods_details/coupon/model/counpon_model.dart
  8. +13
    -16
      lib/widgets/goods_details/detail_img/goods_details_img.dart
  9. +91
    -19
      lib/widgets/goods_details/detail_img/model/goods_details_img_model.dart
  10. +34
    -15
      lib/widgets/goods_details/evaluate/goods_details_evaluate_widget.dart
  11. +86
    -18
      lib/widgets/goods_details/evaluate/model/goods_details_evaluate_model.dart
  12. +27
    -18
      lib/widgets/goods_details/footer/goods_details_footer_widget.dart
  13. +281
    -101
      lib/widgets/goods_details/footer/model/goods_details_footer_model.dart
  14. +3
    -3
      lib/widgets/goods_details/recommend/goods_detail_commend_creater.dart
  15. +72
    -0
      lib/widgets/goods_details/recommend_title/goods_details_recommend_title_widget.dart
  16. +80
    -0
      lib/widgets/goods_details/recommend_title/model/goods_details_recommend_titile_model.dart
  17. +19
    -10
      lib/widgets/goods_details/slide_banner/goods_details_slide_banner_widget.dart
  18. +116
    -31
      lib/widgets/goods_details/slide_banner/model/goods_details_silde_banner_model.dart
  19. +116
    -43
      lib/widgets/goods_details/store/model/store_model.dart
  20. +16
    -10
      lib/widgets/goods_details/store/store_widget.dart
  21. +64
    -0
      lib/widgets/goods_details/tag/goods_details_tag_widget.dart
  22. +128
    -0
      lib/widgets/goods_details/tag/model/goods_details_tag_model.dart
  23. +111
    -39
      lib/widgets/goods_details/title/goods_details_title_widget.dart
  24. +185
    -57
      lib/widgets/goods_details/title/model/goods_details_title_model.dart
  25. +116
    -24
      lib/widgets/goods_details/upgrade_tip/model/upgrade_tip_model.dart
  26. +23
    -13
      lib/widgets/goods_details/upgrade_tip/upgrade_tip_widget.dart

+ 3
- 1
lib/pages/custom_page/custom_item_page.dart Целия файл

@@ -61,7 +61,7 @@ class __CustomItemPageContainerState extends State<_CustomItemPageContainer> wit

ScrollController _controller;
RefreshController _refreshController;
final EventBus _eventBus = EventBus();
EventBus _eventBus;

/// 回到顶点
void _scrollTop() {
@@ -89,6 +89,7 @@ class __CustomItemPageContainerState extends State<_CustomItemPageContainer> wit
@override
void initState() {
_controller = ScrollController();
_eventBus = EventBus();
_refreshController = RefreshController(initialRefresh: false);
_initEvent();_controller.addListener(() {
print(_controller.offset.toString());
@@ -103,6 +104,7 @@ class __CustomItemPageContainerState extends State<_CustomItemPageContainer> wit
void dispose() {
_controller?.dispose();
_refreshController?.dispose();
_eventBus?.destroy();
super.dispose();
}



+ 12
- 1
lib/pages/goods_details_page/goods_details_page.dart Целия файл

@@ -1,5 +1,6 @@
import 'dart:ui';

import 'package:event_bus/event_bus.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:provider/provider.dart';
@@ -7,8 +8,9 @@ import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:zhiying_base_widget/pages/goods_details_page/bloc/goods_details_page_bloc.dart';
import 'package:zhiying_base_widget/pages/goods_details_page/bloc/goods_details_page_repository.dart';
import 'package:zhiying_base_widget/pages/goods_details_page/goods_details_page_sk.dart';
import 'package:zhiying_base_widget/pages/goods_details_page/notifier/goods_details_page_notifier.dart';
import 'package:zhiying_base_widget/pages/main_page/notifier/main_page_notifier.dart';
import 'package:zhiying_base_widget/pages/main_page/notifier/main_page_bg_notifier.dart';
import 'package:zhiying_base_widget/widgets/goods_details/appbar/goods_details_appbar_widget.dart';
import 'package:zhiying_base_widget/widgets/goods_details/footer/goods_details_footer_widget.dart';
import 'package:zhiying_comm/zhiying_comm.dart';
@@ -36,6 +38,7 @@ class _GoodsDetailsPageState extends State<GoodsDetailsPage> {
return MultiProvider(
providers: [
/// 滑动通知
ChangeNotifierProvider.value(value: MainPageBgNotifier()),
ChangeNotifierProvider.value(value: MainPageNotifier()),
ChangeNotifierProvider.value(value: GoodsDetailsAppBarColorNotifier()),
],
@@ -62,6 +65,7 @@ class _GoodsDetailsContainerState extends State<GoodsDetailsContainer> {
ScrollController _controller;
RefreshController _refreshController;
final int BANNER_HEIGHT = 375 - 40;
EventBus _eventBus;

void _onLoading() async {
// await Future.delayed(Duration(milliseconds: 1000));
@@ -78,6 +82,7 @@ class _GoodsDetailsContainerState extends State<GoodsDetailsContainer> {

@override
void initState() {
_eventBus = EventBus();
_refreshController = RefreshController(initialRefresh: false);
_controller = ScrollController();
_controller.addListener(() {
@@ -104,6 +109,7 @@ class _GoodsDetailsContainerState extends State<GoodsDetailsContainer> {
@override
void dispose() {
_controller?.dispose();
_eventBus?.destroy();
_refreshController?.dispose();
super.dispose();
}
@@ -167,12 +173,17 @@ class _GoodsDetailsContainerState extends State<GoodsDetailsContainer> {

print('商品详情页面item.modName ${item.modName}');

if (item.modName == 'product') {
datas[i]['eventBus'] = _eventBus;
}

list.addAll(WidgetFactory.create(
item.modName,
isSliver: true,
model: datas[i],
));
}

if (list.length <= 0) {
list.add(SliverToBoxAdapter(
child: Container(


+ 0
- 16
lib/pages/goods_details_page/notifier/goods_details_page_notifier.dart Целия файл

@@ -1,16 +0,0 @@
import 'package:flutter/material.dart';

// class GoodsDetailsPageNotifier with ChangeNotifier {
// bool scrollEnd = false;
//
// // 加载更多数据
// void loadMore() {
// scrollEnd = true;
// notifyListeners();
// }
//
// void reset() {
// scrollEnd = false;
// notifyListeners();
// }
// }

+ 12
- 24
lib/register.dart Целия файл

@@ -44,8 +44,10 @@ import 'package:zhiying_base_widget/widgets/custom/search/custom_search_widget.d
import 'package:zhiying_base_widget/widgets/custom/slide_banner/custom_slide_banner_creater.dart';
import 'package:zhiying_base_widget/widgets/goods_details/footer/goods_details_footer_widget.dart';
import 'package:zhiying_base_widget/widgets/goods_details/price/goods_details_price_widget.dart';
import 'package:zhiying_base_widget/widgets/goods_details/recommend/goods_detail_commend_widget.dart';
import 'package:zhiying_base_widget/widgets/goods_details/slide_banner/goods_details_slide_banner_widget.dart';
import 'package:zhiying_base_widget/widgets/goods_details/store/store_widget.dart';
import 'package:zhiying_base_widget/widgets/goods_details/tag/goods_details_tag_widget.dart';
import 'package:zhiying_base_widget/widgets/goods_details/upgrade_tip/upgrade_tip_widget.dart';
import 'package:zhiying_base_widget/widgets/home/home_banner/home_banner_creater.dart';
import 'package:zhiying_base_widget/widgets/home/home_goods/home_goods_creater.dart';
@@ -81,6 +83,7 @@ import 'widgets/goods_details/coupon/counpon_widget.dart';
import 'widgets/goods_details/detail_img/goods_details_img.dart';
import 'widgets/goods_details/evaluate/goods_details_evaluate_widget.dart';
import 'widgets/goods_details/recommend/goods_detail_commend_creater.dart';
import 'widgets/goods_details/recommend_title/goods_details_recommend_title_widget.dart';
import 'widgets/goods_details/title/goods_details_title_widget.dart';
import 'widgets/home/home_auth/home_auth.dart';
import 'widgets/home/home_sreach/home_sreach_creater.dart';
@@ -270,23 +273,6 @@ class BaseWidgetRegister {
// WidgetFactory.regist('index_search',
// DefaultWidgetCreater((model) => HomeSreachWidget(model)));

/// 可滚动banner
WidgetFactory.regist('index_carousel', HomeSlideBannerCreater());

/// 首页商品推荐列表
WidgetFactory.regist('index_recommend_list', GoodsListCreater());

/// 首页快速入口
// WidgetFactory.regist('multi_nav', DefaultWidgetCreater((model) => HomeQuickEntry(model)));

/// 滚动公告
WidgetFactory.regist('index_placard', DefaultWidgetCreater((model) => CustomNoticeWidget(model)));

/// 不可以滚动banner
WidgetFactory.regist('index_banner_one', HomeBannerCreater());
WidgetFactory.regist('index_banner_two', HomeBannerCreater());
// WidgetFactory.regist('index_taobao_auth_tip', HomeAuthCreater());

/// ==================== 搜索页面 ==================== ///
// 搜索输入框
WidgetFactory.regist('search_index_input', DefaultWidgetCreater((model) => SearchInputWidget(model)));
@@ -339,11 +325,11 @@ class BaseWidgetRegister {
// 商品详情轮播图
WidgetFactory.regist('product_detail_carousel', DefaultWidgetCreater((model) => GoodsDetailsSlideBannerWidget(model)));
// 商品详情下载APP提示
WidgetFactory.regist('product_detail_download_tips', DefaultWidgetCreater((model) => UpgradeTipWidget(model)));
// 商品详情价格显示
WidgetFactory.regist('product_detail_price', DefaultWidgetCreater((model) => GoodsDetailsPriceWidget(model)));
// 商品详情标题
WidgetFactory.regist('product_detail_bulletin', DefaultWidgetCreater((model) => UpgradeTipWidget(model)));
// 商品详情标题(包括价格)
WidgetFactory.regist('product_detail_title', DefaultWidgetCreater((model) => GoodsDetailsTitleWidget(model)));
// 标签组件组件
WidgetFactory.regist('product_detail_tag', DefaultWidgetCreater((model) => GoodsDetailsTagWidget(model)));
// 商品详情优惠劵
WidgetFactory.regist('product_detail_coupon', DefaultWidgetCreater((model) => CounponWidget(model)));
// 商品详情店铺
@@ -351,9 +337,11 @@ class BaseWidgetRegister {
// 商品详情宝贝评价
WidgetFactory.regist('product_detail_comment', DefaultWidgetCreater((model) => GoodsDetailsEvaluateWidget(model)));
// 商品详情图片
WidgetFactory.regist('product_detail_img_list', DefaultWidgetCreater((model) => GoodsDetailsImgWidget(model)));
// 商品详情底部推荐列表
WidgetFactory.regist('product_detail_bottom_rec', GoodsDetailCommendCreater());
WidgetFactory.regist('product_detail_image', DefaultWidgetCreater((model) => GoodsDetailsImgWidget(model)));
// 商品推荐列表的小标题
WidgetFactory.regist('product_detail_recommend_title', DefaultWidgetCreater((model) => GoodsDetailsRecommendTitleWidget(model)));
// 商品详情底部推荐列表(改用首页的商品列表了)
// WidgetFactory.regist('product_detail_bottom_rec', GoodsDetailCommendCreater());
// 商品详情底部
WidgetFactory.regist('product_detail_bottom', DefaultWidgetCreater((model) => GoodsDetailsFooterWidget(model)));



+ 0
- 61
lib/widgets/goods_details/counpon_description/counpon_description_widget.dart Целия файл

@@ -1,61 +0,0 @@
import 'package:flutter/material.dart';
import 'package:zhiying_comm/zhiying_comm.dart';

///
/// 优惠券说明
///
class CounponDescriptionWidget extends StatelessWidget {
final Map<String, dynamic> model;

const CounponDescriptionWidget(this.model);

@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.symmetric(horizontal: 12.5),
width: double.infinity,
child:_getMainWidget(),
);
}

/// 主widget
Widget _getMainWidget() {
return Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[

/// 领券立减
Padding(padding: const EdgeInsets.only(right: 5), child: _getButtom1Widget()),


/// 收货后返现
Padding(padding: const EdgeInsets.only(right: 5), child: _getButtom2Widget()),


],
);
}

/// 领券立减
Widget _getButtom1Widget() {
return Container(
decoration: BoxDecoration(
color: HexColor.fromHex('#FFE0E0'),
borderRadius: BorderRadius.circular(50),
),
padding: const EdgeInsets.only(left: 14, right: 14, top: 3, bottom: 3),
child: Text('领券立减100元', style: TextStyle(color: HexColor.fromHex('#FF4242'), fontSize: 11)));
}


/// 收货后返现
Widget _getButtom2Widget() {
return Container(
decoration: BoxDecoration(
color: HexColor.fromHex('#FFEFDA'),
borderRadius: BorderRadius.circular(50),
),
padding: const EdgeInsets.only(left: 14, right: 14, top: 3, bottom: 3),
child: Text('收货后返现5.5元', style: TextStyle(color: HexColor.fromHex('#B78107'), fontSize: 11)));
}
}

+ 16
- 7
lib/widgets/goods_details/coupon/counpon_widget.dart Целия файл

@@ -89,8 +89,17 @@ class _CounponWidgetContainerState extends State<CounponWidgetContainer> {
behavior: HitTestBehavior.opaque,
child: Container(
width: double.infinity,
color: Colors.white,
padding: const EdgeInsets.only(left: 12.5, right: 12.5, top: 12),
decoration: BoxDecoration(
color: HexColor.fromHex(model?.bgColor),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(ParseUtil.stringParseDouble(model?.topLeftRadius)),
topRight: Radius.circular(ParseUtil.stringParseDouble(model?.topRightRadius)),
bottomLeft: Radius.circular(ParseUtil.stringParseDouble(model?.bottomLeftRadius)),
bottomRight: Radius.circular(ParseUtil.stringParseDouble(model?.bottomRightRadius))
)
),
margin: EdgeInsets.only(top: ParseUtil.stringParseDouble(model?.topMargin), left: ParseUtil.stringParseDouble(model?.leftRightMargin), right: ParseUtil.stringParseDouble(model?.leftRightMargin)),
padding: const EdgeInsets.only(left: 12.5, right: 12.5, top: 6, bottom: 6),
child: Container(
// color: Colors.red,
width: double.infinity,
@@ -98,7 +107,7 @@ class _CounponWidgetContainerState extends State<CounponWidgetContainer> {
decoration: BoxDecoration(
image: DecorationImage(
image: CachedNetworkImageProvider(
model?.bg_img ?? '',
model?.bgImage ?? '',
),
fit: BoxFit.fill)),
alignment: Alignment.centerLeft,
@@ -125,11 +134,11 @@ class _CounponWidgetContainerState extends State<CounponWidgetContainer> {
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
/// 价格类型
Text(model?.price_type ?? '¥ ', style: TextStyle(fontSize: 15, color: HexColor.fromHex(model?.price_type_color ?? '#FFFFFF'))),
Text('¥ ', style: TextStyle(fontSize: 15, color: HexColor.fromHex(model?.couponPriceColor ?? '#FFFFFF'))),

/// 价格
Text(model?.coupon_price ?? '100',
style: TextStyle(fontSize: 30, color: HexColor.fromHex(model?.coupon_price_color ?? '#FFFFFF'), fontFamily: 'Din', package: 'zhiying_comm')),
style: TextStyle(fontSize: 30, color: HexColor.fromHex(model?.couponPriceColor ?? '#FFFFFF'), fontFamily: 'Din', package: 'zhiying_comm')),
],
);
}
@@ -140,12 +149,12 @@ class _CounponWidgetContainerState extends State<CounponWidgetContainer> {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
/// 标题
Text(model?.coupon_title ?? '优惠券', style: TextStyle(fontSize: 17, color: HexColor.fromHex(model?.coupon_title_color ?? '#FFFFFF'))),
Text(model?.couponText ?? '优惠券', style: TextStyle(fontSize: 17, color: HexColor.fromHex(model?.couponTextColor ?? '#FFFFFF'))),

/// 到期时间
Visibility(
visible: !EmptyUtil.isEmpty(model?.coupon_endtime),
child: Text(model?.coupon_endtime ?? '有效期至2020-10-01', style: TextStyle(fontSize: 10, color: HexColor.fromHex(model?.coupon_time_color ?? '#FFFFFF'))))
child: Text(model?.coupon_endtime ?? '有效期至2020-10-01', style: TextStyle(fontSize: 10, color: HexColor.fromHex(model?.couponTimeColor ?? '#FFFFFF'))))
],
);
}


+ 96
- 48
lib/widgets/goods_details/coupon/model/counpon_model.dart Целия файл

@@ -1,77 +1,125 @@
class CounponModel {
String bg_img;
String coupon_endtime;
String coupon_price;
String coupon_price_color;
String coupon_time_color;
String coupon_title;
String coupon_title_color;
String coupon_url;
String price_type;
String price_type_color;
String buy_url;
String provider;
String good_id;

ConvertArgs convertArgs;
String commission;
String coupon_endtime;
String coupon_price;
String coupon_url;

String name;
String desc;
String moduleType;
String moduleKey;
String isTopMargin;
String isLeftRightMargin;
String isShow;
String topMargin;
String leftRightMargin;
String topLeftRadius;
String topRightRadius;
String bottomLeftRadius;
String bottomRightRadius;
String bgColor;
String couponText;
String couponTextColor;
String couponPriceColor;
String couponTimeColor;
String bgImage;

CounponModel({
this.good_id,
this.provider,
this.bg_img,
this.coupon_endtime,
this.coupon_price,
this.coupon_price_color,
this.coupon_time_color,
this.coupon_title,
this.coupon_title_color,
this.coupon_url,
this.price_type,
this.price_type_color,
this.buy_url,
this.convertArgs,
this.commission,

this.name,
this.desc,
this.moduleType,
this.moduleKey,
this.isTopMargin,
this.isLeftRightMargin,
this.isShow,
this.topMargin,
this.leftRightMargin,
this.topLeftRadius,
this.topRightRadius,
this.bottomLeftRadius,
this.bottomRightRadius,
this.bgColor,
this.couponText,
this.couponTextColor,
this.couponPriceColor,
this.couponTimeColor,
this.bgImage
});

factory CounponModel.fromJson(Map<String, dynamic> json) {
return CounponModel(
good_id: json['good_id'],
provider: json['provider'],
bg_img: json['bg_img'],
coupon_endtime: json['coupon_endtime'],
coupon_price: json['coupon_price'],
coupon_price_color: json['coupon_price_color'],
coupon_time_color: json['coupon_time_color'],
coupon_title: json['coupon_title'],
coupon_title_color: json['coupon_title_color'],
coupon_url: json['coupon_url'],
price_type: json['price_type'],
price_type_color: json['price_type_color'],
buy_url: json['buy_url'],
convertArgs: json['convert_args'] != null ? ConvertArgs.fromJson(json['convert_args']) : null,
commission: json['commission'],
);
CounponModel.fromJson(Map<String, dynamic> json) {
good_id = json['good_id'];
provider = json['provider'];
coupon_endtime = json['coupon_endtime'];
coupon_price = json['coupon_price'];
coupon_url = json['coupon_url'];
convertArgs = json['convert_args'] != null ? ConvertArgs.fromJson(json['convert_args']) : null;


name = json['name'];
desc = json['desc'];
moduleType = json['module_type'];
moduleKey = json['module_key'];
isTopMargin = json['is_top_margin'];
isLeftRightMargin = json['is_left_right_margin'];
isShow = json['is_show'];
topMargin = json['top_margin'];
leftRightMargin = json['left_right_margin'];
topLeftRadius = json['top_left_radius'];
topRightRadius = json['top_right_radius'];
bottomLeftRadius = json['bottom_left_radius'];
bottomRightRadius = json['bottom_right_radius'];
bgColor = json['bg_color'];
couponText = json['coupon_text'];
couponTextColor = json['coupon_text_color'];
couponPriceColor = json['coupon_price_color'];
couponTimeColor = json['coupon_time_color'];
bgImage = json['bg_image'];


}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['bg_img'] = this.bg_img;
data['coupon_endtime'] = this.coupon_endtime;
data['coupon_price'] = this.coupon_price;
data['coupon_price_color'] = this.coupon_price_color;
data['coupon_time_color'] = this.coupon_time_color;
data['coupon_title'] = this.coupon_title;
data['coupon_title_color'] = this.coupon_title_color;
data['coupon_url'] = this.coupon_url;
data['price_type'] = this.price_type;
data['price_type_color'] = this.price_type_color;
data['buy_url'] = this.buy_url;
data['provider'] = this.provider;
data['good_id'] = this.good_id;
if (this.convertArgs != null) {
data['convert_args'] = this.convertArgs.toJson();
}
data['commission'] = this.commission;

data['name'] = this.name;
data['desc'] = this.desc;
data['module_type'] = this.moduleType;
data['module_key'] = this.moduleKey;
data['is_top_margin'] = this.isTopMargin;
data['is_left_right_margin'] = this.isLeftRightMargin;
data['is_show'] = this.isShow;
data['top_margin'] = this.topMargin;
data['left_right_margin'] = this.leftRightMargin;
data['top_left_radius'] = this.topLeftRadius;
data['top_right_radius'] = this.topRightRadius;
data['bottom_left_radius'] = this.bottomLeftRadius;
data['bottom_right_radius'] = this.bottomRightRadius;
data['bg_color'] = this.bgColor;
data['coupon_text'] = this.couponText;
data['coupon_text_color'] = this.couponTextColor;
data['coupon_price_color'] = this.couponPriceColor;
data['coupon_time_color'] = this.couponTimeColor;
data['bg_image'] = this.bgImage;


return data;
}
}


+ 13
- 16
lib/widgets/goods_details/detail_img/goods_details_img.dart Целия файл

@@ -137,10 +137,18 @@ class _GoodsDetailsImgWidgetContainerState extends State<GoodsDetailsImgWidgetCo
/// 标题Widget
Widget _getTitleWidget(GoodsDetailsImgModel model) {
return Container(
color: Colors.white,
margin: const EdgeInsets.only(top: 6),
width: double.infinity,
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)),
)
),
margin: EdgeInsets.only(top: ParseUtil.stringParseDouble(model?.topMargin), left: ParseUtil.stringParseDouble(model?.leftRightMargin), right: ParseUtil.stringParseDouble(model?.leftRightMargin)),
padding: const EdgeInsets.only(top: 15, bottom: 15, left: 12.5, right: 12.5),
width: double.infinity,
child: _getLeftWidget(model),
);
}
@@ -153,9 +161,9 @@ class _GoodsDetailsImgWidgetContainerState extends State<GoodsDetailsImgWidgetCo
imageUrl: model?.icon ?? '',
width: 12,
),
const SizedBox(width: 2.5),
const SizedBox(width: 7),
Text(model?.title ?? '商品详情',
style: TextStyle(color: HexColor.fromHex(model?.title_color ?? '#333333'), fontSize: 12)),
style: TextStyle(color: HexColor.fromHex(model?.titleColor ?? '#333333'), fontSize: 12)),
],
);
}
@@ -165,17 +173,6 @@ class _GoodsDetailsImgWidgetContainerState extends State<GoodsDetailsImgWidgetCo

/// 骨架视图
Widget shimmerWidget({double width, double height, double radius = 0}) {
//返回骨架视图
// return Shimmer.fromColors(
// baseColor: Colors.grey[300],
// highlightColor: Colors.grey[100],
// child: Container(
// width: width,
// height: height,
// decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(radius)),
// ),
// );

//修改后返回默认图片
return Image.asset(
'assets/images/occupation_map/occupation_map.png',


+ 91
- 19
lib/widgets/goods_details/detail_img/model/goods_details_img_model.dart Целия файл

@@ -1,52 +1,124 @@
class GoodsDetailsImgModel {
List<String> image_detail_list;
String title;
String title_color;
String provider;
String good_id;

String name;
String desc;
String icon;
String title;
String moduleType;
String moduleKey;
String isTopMargin;
String isLeftRightMargin;
String isShow;
String topMargin;
String leftRightMargin;
String topLeftRadius;
String topRightRadius;
String bottomLeftRadius;
String bottomRightRadius;
String bgColor;
String titleColor;

GoodsDetailsImgModel({
this.image_detail_list,
this.title,
this.title_color,
this.provider,
this.good_id,
this.icon
this.name,
this.desc,
this.icon,
this.title,
this.moduleType,
this.moduleKey,
this.isTopMargin,
this.isLeftRightMargin,
this.isShow,
this.topMargin,
this.leftRightMargin,
this.topLeftRadius,
this.topRightRadius,
this.bottomLeftRadius,
this.bottomRightRadius,
this.bgColor,
this.titleColor,
});

factory GoodsDetailsImgModel.fromJson(Map<String, dynamic> json) {
return GoodsDetailsImgModel(
image_detail_list: json['image_detail_list'] != null ? new List<String>.from(json['image_detail_list']) : null,
title: json['title'],
title_color: json['title_color'],
provider: json['provider'],
good_id: json['good_id'],
icon: json['icon']
);
GoodsDetailsImgModel.fromJson(Map<String, dynamic> json) {
image_detail_list = json['image_detail_list'] != null ? new List<String>.from(json['image_detail_list']) : null;
provider = json['provider'];
good_id = json['good_id'];

name = json['name'];
desc = json['desc'];
icon = json['icon'];
title = json['title'];
moduleType = json['module_type'];
moduleKey = json['module_key'];
isTopMargin = json['is_top_margin'];
isLeftRightMargin = json['is_left_right_margin'];
isShow = json['is_show'];
topMargin = json['top_margin'];
leftRightMargin = json['left_right_margin'];
topLeftRadius = json['top_left_radius'];
topRightRadius = json['top_right_radius'];
bottomLeftRadius = json['bottom_left_radius'];
bottomRightRadius = json['bottom_right_radius'];
bgColor = json['bg_color'];
titleColor = json['title_color'];
}

GoodsDetailsImgModel copyWith(List<String> newImgs){
GoodsDetailsImgModel copyWith(List<String> newImgs) {
return GoodsDetailsImgModel(
image_detail_list: newImgs,
title: title,
title_color: title_color,
provider: provider,
good_id: good_id,
icon: icon,
titleColor: titleColor,
title: title,
name: name,
desc: desc,
moduleKey: moduleKey,
moduleType: moduleType,
isTopMargin: isTopMargin,
isLeftRightMargin: isLeftRightMargin,
isShow: isShow,
topMargin: topMargin,
leftRightMargin: leftRightMargin,
topLeftRadius: topLeftRadius,
topRightRadius: topRightRadius,
bottomLeftRadius: bottomLeftRadius,
bottomRightRadius: bottomRightRadius,
bgColor: bgColor,
);
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['title'] = this.title;
data['title_color'] = this.title_color;
if (this.image_detail_list != null) {
data['image_detail_list'] = this.image_detail_list;
}
data['provider'] = this.provider;
data['good_id'] = this.good_id;

data['name'] = this.name;
data['desc'] = this.desc;
data['icon'] = this.icon;
data['title'] = this.title;
data['module_type'] = this.moduleType;
data['module_key'] = this.moduleKey;
data['is_top_margin'] = this.isTopMargin;
data['is_left_right_margin'] = this.isLeftRightMargin;
data['is_show'] = this.isShow;
data['top_margin'] = this.topMargin;
data['left_right_margin'] = this.leftRightMargin;
data['top_left_radius'] = this.topLeftRadius;
data['top_right_radius'] = this.topRightRadius;
data['bottom_left_radius'] = this.bottomLeftRadius;
data['bottom_right_radius'] = this.bottomRightRadius;
data['bg_color'] = this.bgColor;
data['title_color'] = this.titleColor;

return data;
}
}

+ 34
- 15
lib/widgets/goods_details/evaluate/goods_details_evaluate_widget.dart Целия файл

@@ -13,12 +13,12 @@ import 'package:provider/provider.dart';
/// 商品详情评价Widget
///
class GoodsDetailsEvaluateWidget extends StatelessWidget {
final Map<String, dynamic> model;
GoodsDetailsEvaluateModel _modell;
final Map<String, dynamic> data;
GoodsDetailsEvaluateModel _model;

GoodsDetailsEvaluateWidget(this.model, {Key key}) : super(key: key) {
GoodsDetailsEvaluateWidget(this.data, {Key key}) : super(key: key) {
try {
_modell = GoodsDetailsEvaluateModel.fromJson(jsonDecode(model['data']));
_model = GoodsDetailsEvaluateModel.fromJson(jsonDecode(data['data']));
} catch (e) {
Logger.log('GoodsDetailsEvaluateWidget e = $e}');
}
@@ -40,11 +40,11 @@ class GoodsDetailsEvaluateWidget extends StatelessWidget {
return;
}
TradeResult result;
if (!EmptyUtil.isEmpty(_modell?.comment_url)) {
if (!EmptyUtil.isEmpty(_model?.comment_url)) {
if (Platform.isAndroid) {
result = await FlutterAlibc.openByUrl(url: _modell?.comment_url, backUrl: "alisdk://");
result = await FlutterAlibc.openByUrl(url: _model?.comment_url, backUrl: "alisdk://");
} else if (Platform.isIOS) {
result = await FlutterAlibc.openByUrl(url: _modell?.comment_url);
result = await FlutterAlibc.openByUrl(url: _model?.comment_url);
}
Logger.debug('${result.errorCode} ${result.errorMessage} ');
}
@@ -55,16 +55,24 @@ class GoodsDetailsEvaluateWidget extends StatelessWidget {
_user = Provider.of<UserInfoNotifier>(context).userInfo;

return Visibility(
visible: !EmptyUtil.isEmpty(_modell?.comment_url),
visible: !EmptyUtil.isEmpty(_model?.comment_url),
child: GestureDetector(
onTap: () => _openLookMore(context),
behavior: HitTestBehavior.opaque,
child: Container(
color: Colors.white,
margin: const EdgeInsets.only(top: 6),
decoration: BoxDecoration(
color: HexColor.fromHex(_model?.bgColor),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(ParseUtil.stringParseDouble(_model?.topLeftRadius)),
topRight: Radius.circular(ParseUtil.stringParseDouble(_model?.topRightRadius)),
bottomLeft: Radius.circular(ParseUtil.stringParseDouble(_model?.bottomLeftRadius)),
bottomRight: Radius.circular(ParseUtil.stringParseDouble(_model?.bottomRightRadius)),
)
),
margin: EdgeInsets.only(top: ParseUtil.stringParseDouble(_model?.topMargin), left: ParseUtil.stringParseDouble(_model?.leftRightMargin), right: ParseUtil.stringParseDouble(_model?.leftRightMargin)),
width: double.infinity,
padding: const EdgeInsets.only(top: 15, bottom: 15, left: 12.5, right: 12.5),
child: getMainWidget(_modell),
child: getMainWidget(_model),
),
),
);
@@ -76,7 +84,18 @@ class GoodsDetailsEvaluateWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
getLeftWidget(model),
Text(model?.more ?? '查看更多 >', style: TextStyle(color: HexColor.fromHex(model?.more_color ?? '#999999'), fontSize: 11)),
getRightWidget(model),
],
);
}

/// 查看更多
Widget getRightWidget(GoodsDetailsEvaluateModel model) {
return Row(
children: <Widget>[
Text(model?.moreText ?? '查看更多', style: TextStyle(color: HexColor.fromHex(model?.more_color ?? '#999999'), fontSize: 12)),
const SizedBox(width: 2.5,),
CachedNetworkImage(imageUrl: model?.moreIcon, width: 12),
],
);
}
@@ -86,11 +105,11 @@ class GoodsDetailsEvaluateWidget extends StatelessWidget {
return Row(
children: <Widget>[
CachedNetworkImage(
imageUrl: model?.icon ?? '',
imageUrl: model?.titleIcon ?? '',
width: 12,
),
const SizedBox(width: 2.5),
Text(model?.title ?? '宝贝评价', style: TextStyle(color: HexColor.fromHex(model?.title_color ?? '#333333'), fontSize: 12)),
const SizedBox(width: 7),
Text(model?.title ?? '宝贝评价', style: TextStyle(color: HexColor.fromHex(model?.titleColor ?? '#333333'), fontSize: 12)),
],
);
}


+ 86
- 18
lib/widgets/goods_details/evaluate/model/goods_details_evaluate_model.dart Целия файл

@@ -1,39 +1,107 @@
class GoodsDetailsEvaluateModel {
String comment_url;
String more;
String more_color;

String name;
String desc;
String title;
String title_color;
String icon;
String moduleType;
String moduleKey;
String isTopMargin;
String isLeftRightMargin;
String isShow;
String topMargin;
String leftRightMargin;
String topLeftRadius;
String topRightRadius;
String bottomLeftRadius;
String bottomRightRadius;
String bgColor;
String titleColor;
String titleIcon;
String moreText;
String moreIcon;
String moreTextColor;

GoodsDetailsEvaluateModel({
this.comment_url,
this.more,
this.more_color,
this.title,
this.title_color,
this.icon,
this.name,
this.desc,
this.moduleType,
this.moduleKey,
this.isTopMargin,
this.isLeftRightMargin,
this.isShow,
this.topMargin,
this.leftRightMargin,
this.topLeftRadius,
this.topRightRadius,
this.bottomLeftRadius,
this.bottomRightRadius,
this.bgColor,
this.titleColor,
this.titleIcon,
this.moreText,
this.moreIcon,
this.moreTextColor,
});

factory GoodsDetailsEvaluateModel.fromJson(Map<String, dynamic> json) {
return GoodsDetailsEvaluateModel(
comment_url: json['comment_url'],
more: json['more'],
more_color: json['more_color'],
title: json['title'],
title_color: json['title_color'],
icon: json['icon'],
);
GoodsDetailsEvaluateModel.fromJson(Map<String, dynamic> json) {
comment_url = json['comment_url'];
more_color = json['more_color'];
title = json['title'];

name = json['name'];
desc = json['desc'];
title = json['title'];
moduleType = json['module_type'];
moduleKey = json['module_key'];
isTopMargin = json['is_top_margin'];
isLeftRightMargin = json['is_left_right_margin'];
isShow = json['is_show'];
topMargin = json['top_margin'];
leftRightMargin = json['left_right_margin'];
topLeftRadius = json['top_left_radius'];
topRightRadius = json['top_right_radius'];
bottomLeftRadius = json['bottom_left_radius'];
bottomRightRadius = json['bottom_right_radius'];
bgColor = json['bg_color'];
titleColor = json['title_color'];
titleIcon = json['title_icon'];
moreText = json['more_text'];
moreIcon = json['more_icon'];
moreTextColor = json['more_text_color'];
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['comment_url'] = this.comment_url;
data['more'] = this.more;
data['more_color'] = this.more_color;
data['title'] = this.title;
data['title_color'] = this.title_color;
data['icon'] = this.icon;

data['name'] = this.name;
data['desc'] = this.desc;
data['title'] = this.title;
data['module_type'] = this.moduleType;
data['module_key'] = this.moduleKey;
data['is_top_margin'] = this.isTopMargin;
data['is_left_right_margin'] = this.isLeftRightMargin;
data['is_show'] = this.isShow;
data['top_margin'] = this.topMargin;
data['left_right_margin'] = this.leftRightMargin;
data['top_left_radius'] = this.topLeftRadius;
data['top_right_radius'] = this.topRightRadius;
data['bottom_left_radius'] = this.bottomLeftRadius;
data['bottom_right_radius'] = this.bottomRightRadius;
data['bg_color'] = this.bgColor;
data['title_color'] = this.titleColor;
data['title_icon'] = this.titleIcon;
data['more_text'] = this.moreText;
data['more_icon'] = this.moreIcon;
data['more_text_color'] = this.moreText;

return data;
}
}

+ 27
- 18
lib/widgets/goods_details/footer/goods_details_footer_widget.dart Целия файл

@@ -7,6 +7,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:provider/provider.dart';
import 'package:zhiying_base_widget/pages/goods_share_page/goods_share_page.dart';
import 'package:zhiying_base_widget/widgets/custom/multi_nav/cached_network_image_util.dart';
import 'package:zhiying_base_widget/widgets/goods_details/footer/bloc/goods_details_footer_bloc.dart';
import 'package:zhiying_base_widget/widgets/goods_details/footer/bloc/goods_details_footer_repository.dart';
import 'package:zhiying_base_widget/widgets/goods_details/footer/goods_details_footer_sk.dart';
@@ -137,7 +138,13 @@ class _GoodsDetailsFooterContainerState extends State<_GoodsDetailsFooterContain
// BoxShadow(color: Colors.grey[300], offset: Offset(0.0, 0.0), blurRadius: 5.0, spreadRadius: 2.0),
// BoxShadow(color: Colors.grey[300], offset: Offset(0.0, 0.0)),
// ],
color: Colors.white,
color: HexColor.fromHex(model?.bgColor),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(ParseUtil.stringParseDouble(model?.topLeftRadius)),
topRight: Radius.circular(ParseUtil.stringParseDouble(model?.topRightRadius)),
bottomLeft: Radius.circular(ParseUtil.stringParseDouble(model?.bottomLeftRadius)),
bottomRight: Radius.circular(ParseUtil.stringParseDouble(model?.bottomRightRadius)),
)
),
child: Container(height: 44, child: _getMainWidet(model)),
),
@@ -170,14 +177,14 @@ class _GoodsDetailsFooterContainerState extends State<_GoodsDetailsFooterContain
onTap: () => _openHome(),
child: Padding(
padding: const EdgeInsets.only(right: 35),
child: _getCustomWidget(model?.home ?? '首页', model?.home_color ?? '999999', model?.home_icon ?? ''),
child: _getCustomWidget(model?.listStyle?.leftIcon1?.text ?? '首页', model?.listStyle?.leftIcon1?.color ?? '999999', model?.listStyle?.leftIcon1?.beforeIcon ?? ''),
)),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () => _collectOnClick(model),
child: Padding(
padding: const EdgeInsets.only(right: 0),
child: _getCustomWidget(model?.collect ?? '收藏', model?.collect_color ?? '999999', model?.isFav == '0' ? model?.collect_icon ?? '' : model?.collected_icon ?? '')))
child: _getCustomWidget(model?.listStyle?.leftIcon2?.text ?? '收藏', model?.listStyle?.leftIcon2?.color ?? '999999', model?.isFav == '0' ? model?.listStyle?.leftIcon2?.beforeIcon ?? '' : model?.listStyle?.leftIcon2?.afterIcon ?? '')))
],
);
}
@@ -204,26 +211,27 @@ class _GoodsDetailsFooterContainerState extends State<_GoodsDetailsFooterContain
width: 110,
// padding: const EdgeInsets.only(left: 30, right: 30, top: 5, bottom: 5),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [HexColor.fromHex(model?.share_earn_bg1_color ?? '#FFCA66'), HexColor.fromHex(model?.share_earn_bg2_color ?? '#FFD961')],
begin: Alignment.centerLeft,
end: Alignment.centerRight),
// gradient: LinearGradient(
// colors: [HexColor.fromHex(/*model?.share_earn_bg1_color ??*/ '#FFCA66'), HexColor.fromHex(/*model?.share_earn_bg2_color ??*/ '#FFD961')],
// begin: Alignment.centerLeft,
// end: Alignment.centerRight),
image: DecorationImage(image: CachedNetworkImageProvider(model?.listStyle?.rightIcon1?.bgImage ?? ''), fit: BoxFit.fitWidth),
borderRadius: BorderRadius.only(bottomLeft: Radius.circular(25), topLeft: Radius.circular(25))),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RichText(
text: TextSpan(text: '¥ ', style: TextStyle(fontSize: 12, color: HexColor.fromHex(model?.share_earn_val_color ?? 'FFFFFF')), children: [
text: TextSpan(text: '¥ ', style: TextStyle(fontSize: 12, color: HexColor.fromHex(model?.listStyle?.rightIcon1?.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_comm')),
fontSize: 15, fontWeight: FontWeight.bold, color: HexColor.fromHex(model?.listStyle?.rightIcon1?.color ?? '#FFFFFF'), fontFamily: 'Din', package: 'zhiying_comm')),
]),
),
Text(
model?.share_earn ?? '分享赚',
style: TextStyle(color: HexColor.fromHex(model?.share_earn_color ?? '#FFFFFF'), fontSize: 12),
model?.listStyle?.rightIcon1?.text ?? '分享赚',
style: TextStyle(color: HexColor.fromHex(model?.listStyle?.rightIcon1?.color ?? '#FFFFFF'), fontSize: 12),
),
],
),
@@ -242,29 +250,30 @@ class _GoodsDetailsFooterContainerState extends State<_GoodsDetailsFooterContain
height: 44,
width: 110,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [HexColor.fromHex(model?.save_earn_bg1_color ?? '#FF6969'), HexColor.fromHex(model?.save_earn_bg2_color ?? '#FF4646')],
begin: Alignment.centerLeft,
end: Alignment.centerRight),
// gradient: LinearGradient(
// colors: [HexColor.fromHex(/*model?.save_earn_bg1_color ??*/ '#FF6969'), HexColor.fromHex(/*model?.save_earn_bg2_color ??*/ '#FF4646')],
// begin: Alignment.centerLeft,
// end: Alignment.centerRight),
image: DecorationImage(image: CachedNetworkImageProvider(model?.listStyle?.rightIcon2?.bgImage ?? ''), fit: BoxFit.fitWidth),
borderRadius: BorderRadius.only(bottomRight: Radius.circular(25), topRight: Radius.circular(25))),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RichText(
text: TextSpan(text: '¥ ', style: TextStyle(fontSize: 12, color: HexColor.fromHex(model?.save_earn_val_color ?? 'FFFFFF')), children: [
text: TextSpan(text: '¥ ', style: TextStyle(fontSize: 12, color: HexColor.fromHex(model?.listStyle?.rightIcon2?.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'),
color: HexColor.fromHex(model?.listStyle?.rightIcon2?.color ?? '#FFFFFF'),
fontFamily: 'Din',
package: 'zhiying_comm',
)),
]),
),
Text(model?.save_earn ?? '自购省', style: TextStyle(color: HexColor.fromHex(model?.save_earn_color ?? '#FFFFFF'), fontSize: 12))
Text(model?.listStyle?.rightIcon2?.text ?? '自购省', style: TextStyle(color: HexColor.fromHex(model?.listStyle?.rightIcon2?.color ?? '#FFFFFF'), fontSize: 12))
],
),
),


+ 281
- 101
lib/widgets/goods_details/footer/model/goods_details_footer_model.dart Целия файл

@@ -1,21 +1,23 @@

import 'package:zhiying_comm/zhiying_comm.dart';

class GoodsDetailsFooterModel {
String collect;
String collect_color;
String collect_icon;
String collected_icon;
String home;
String home_color;
String home_icon;
String save_earn;
String save_earn_bg1_color;
String save_earn_bg2_color;
String save_earn_color;
String save_earn_val_color;
String share_earn;
String share_earn_bg1_color;
String share_earn_bg2_color;
String share_earn_color;
String share_earn_val_color;
String name;
String desc;
String moduleType;
String moduleKey;
String isTopMargin;
String isLeftRightMargin;
String isShow;
String topMargin;
String leftRightMargin;
String topLeftRadius;
String topRightRadius;
String bottomLeftRadius;
String bottomRightRadius;
String bgColor;
ListStyle listStyle;

String share_value;
String self_buy_value;

@@ -24,10 +26,40 @@ class GoodsDetailsFooterModel {
String shareUrl;
FavArgs favArgs;
ShareUrlArgs shareUrlArgs;
ConvertArgs convertArgs;
String provider;
String good_id;
ConvertArgs convertArgs;

factory GoodsDetailsFooterModel.fromJson(Map<String, dynamic> json) {
return GoodsDetailsFooterModel(
isFav: json['is_fav'],
buyUrl: json['buy_url'],
shareUrl: json['share_url'],
favArgs: json['fav_args'] != null ? new FavArgs.fromJson(json['fav_args']) : null,
shareUrlArgs: json['share_url_args'] != null ? new ShareUrlArgs.fromJson(json['share_url_args']) : null,
share_value: json['share_value'],
self_buy_value: json['self_buy_value'],
good_id: json['good_id'],
provider: json['provider'],
convertArgs: json['convert_args'] != null ? ConvertArgs.fromJson(json['convert_args']) : null,
// 修改
name: json['name'],
desc: json['desc'],
moduleType: json['module_type'],
moduleKey: json['module_key'],
isTopMargin: json['is_top_margin'],
isLeftRightMargin: json['is_left_right_margin'],
isShow: json['is_show'],
topMargin: json['top_margin'],
leftRightMargin: json['left_right_margin'],
topLeftRadius: json['top_left_radius'],
topRightRadius: json['top_right_radius'],
bottomLeftRadius: json['bottom_left_radius'],
bottomRightRadius: json['bottom_right_radius'],
bgColor : json['bg_color'],
listStyle : json['list_style'] != null? new ListStyle.fromJson(json['list_style']): null
);
}

GoodsDetailsFooterModel({
this.buyUrl,
@@ -35,84 +67,34 @@ class GoodsDetailsFooterModel {
this.isFav,
this.shareUrl,
this.shareUrlArgs,
this.collect,
this.collect_color,
this.collect_icon,
this.home,
this.home_color,
this.home_icon,
this.save_earn,
this.save_earn_bg1_color,
this.save_earn_bg2_color,
this.save_earn_color,
this.save_earn_val_color,
this.share_earn,
this.share_earn_bg1_color,
this.share_earn_bg2_color,
this.share_earn_color,
this.share_earn_val_color,
this.share_value,
this.self_buy_value,
this.collected_icon,
this.good_id,
this.provider,
this.convertArgs,
// 修改
this.name,
this.desc,
this.moduleType,
this.moduleKey,
this.isTopMargin,
this.isLeftRightMargin,
this.isShow,
this.topMargin,
this.leftRightMargin,
this.topLeftRadius,
this.topRightRadius,
this.bottomLeftRadius,
this.bottomRightRadius,
this.bgColor,
this.listStyle,
});

factory GoodsDetailsFooterModel.fromJson(Map<String, dynamic> json) {
return GoodsDetailsFooterModel(
isFav: json['is_fav'],
buyUrl: json['buy_url'],
shareUrl: json['share_url'],
favArgs: json['fav_args'] != null ? new FavArgs.fromJson(json['fav_args']) : null,
shareUrlArgs: json['share_url_args'] != null ? new ShareUrlArgs.fromJson(json['share_url_args']) : null,
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'],
collected_icon: json['collected_icon'],
good_id: json['good_id'],
provider: json['provider'],
convertArgs: json['convert_args'] != null ? ConvertArgs.fromJson(json['convert_args']) : null,
);
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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;
data['collected_icon'] = this.collected_icon;

data['is_fav'] = this.isFav;
data['buy_url'] = this.buyUrl;
data['share_url'] = this.shareUrl;
@@ -122,13 +104,30 @@ class GoodsDetailsFooterModel {
if (this.shareUrlArgs != null) {
data['share_url_args'] = this.shareUrlArgs.toJson();
}

data['provider'] = this.provider;
data['good_id'] = this.good_id;
if (this.convertArgs != null) {
data['convert_args'] = this.convertArgs.toJson();
}

data['name'] = this.name;
data['desc'] = this.desc;
data['module_type'] = this.moduleType;
data['module_key'] = this.moduleKey;
data['is_top_margin'] = this.isTopMargin;
data['is_left_right_margin'] = this.isLeftRightMargin;
data['is_show'] = this.isShow;
data['top_margin'] = this.topMargin;
data['left_right_margin'] = this.leftRightMargin;
data['top_left_radius'] = this.topLeftRadius;
data['top_right_radius'] = this.topRightRadius;
data['bottom_left_radius'] = this.bottomLeftRadius;
data['bottom_right_radius'] = this.bottomRightRadius;
data['bg_color'] = this.bgColor;
if (this.listStyle != null) {
data['list_style'] = this.listStyle.toJson();
}

return data;
}
}
@@ -148,20 +147,19 @@ class FavArgs {
String inorderCount;
Null detailData;

FavArgs(
{this.provider,
this.providerName,
this.goodId,
this.goodImage,
this.goodTitle,
this.shopName,
this.coupon,
this.couponUrl,
this.commission,
this.marketPrice,
this.currentPrice,
this.inorderCount,
this.detailData});
FavArgs({this.provider,
this.providerName,
this.goodId,
this.goodImage,
this.goodTitle,
this.shopName,
this.coupon,
this.couponUrl,
this.commission,
this.marketPrice,
this.currentPrice,
this.inorderCount,
this.detailData});

FavArgs.fromJson(Map<String, dynamic> json) {
provider = json['provider'];
@@ -268,3 +266,185 @@ class ConvertArgs {
return data;
}
}


class ListStyle {
LeftIcon1 leftIcon1;
LeftIcon1 leftIcon2;
RightIcon1 rightIcon1;
RightIcon1 rightIcon2;
BuyBubbleTip buyBubbleTip;
BuyBubbleTip buyShareTip;

ListStyle({this.leftIcon1,
this.leftIcon2,
this.rightIcon1,
this.rightIcon2,
this.buyBubbleTip,
this.buyShareTip});

ListStyle.fromJson(Map<String, dynamic> json) {
leftIcon1 = json['left_icon1'] != null
? new LeftIcon1.fromJson(json['left_icon1'])
: null;
leftIcon2 = json['left_icon2'] != null
? new LeftIcon1.fromJson(json['left_icon2'])
: null;
rightIcon1 = json['right_icon1'] != null
? new RightIcon1.fromJson(json['right_icon1'])
: null;
rightIcon2 = json['right_icon2'] != null
? new RightIcon1.fromJson(json['right_icon2'])
: null;
buyBubbleTip = json['buy_bubble_tip'] != null
? new BuyBubbleTip.fromJson(json['buy_bubble_tip'])
: null;
buyShareTip = json['buy_share_tip'] != null
? new BuyBubbleTip.fromJson(json['buy_share_tip'])
: null;
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.leftIcon1 != null) {
data['left_icon1'] = this.leftIcon1.toJson();
}
if (this.leftIcon2 != null) {
data['left_icon2'] = this.leftIcon2.toJson();
}
if (this.rightIcon1 != null) {
data['right_icon1'] = this.rightIcon1.toJson();
}
if (this.rightIcon2 != null) {
data['right_icon2'] = this.rightIcon2.toJson();
}
if (this.buyBubbleTip != null) {
data['buy_bubble_tip'] = this.buyBubbleTip.toJson();
}
if (this.buyShareTip != null) {
data['buy_share_tip'] = this.buyShareTip.toJson();
}
return data;
}
}

class LeftIcon1 extends SkipModel{
String text;
String color;
String beforeIcon;
String afterIcon;
String skipIdentifier;
String requiredLogin;
String requiredTaobaoAuth;
String isJump;

LeftIcon1({this.text,
this.color,
this.beforeIcon,
this.afterIcon,
this.skipIdentifier,
this.requiredLogin,
this.requiredTaobaoAuth,
this.isJump});

LeftIcon1.fromJson(Map<String, dynamic> json) {
super.fromJson(json);
text = json['text'];
color = json['color'];
beforeIcon = json['before_icon'];
afterIcon = json['after_icon'];
skipIdentifier = json['skip_identifier'];
requiredLogin = json['required_login'];
requiredTaobaoAuth = json['required_taobao_auth'];
isJump = json['is_jump'];
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = super.toJson();
data['text'] = this.text;
data['color'] = this.color;
data['before_icon'] = this.beforeIcon;
data['after_icon'] = this.afterIcon;
data['skip_identifier'] = this.skipIdentifier;
data['required_login'] = this.requiredLogin;
data['required_taobao_auth'] = this.requiredTaobaoAuth;
data['is_jump'] = this.isJump;
return data;
}
}

class RightIcon1 {
String text;
String color;
String btnStr;
String bgImage;
String functionType;
List<String> sourceList;

RightIcon1({this.text,
this.color,
this.btnStr,
this.bgImage,
this.functionType,
this.sourceList});

RightIcon1.fromJson(Map<String, dynamic> json) {
text = json['text'];
color = json['color'];
btnStr = json['btn_str'];
bgImage = json['bg_image'];
functionType = json['function_type'];
sourceList = json['source_list'].cast<String>();
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['text'] = this.text;
data['color'] = this.color;
data['btn_str'] = this.btnStr;
data['bg_image'] = this.bgImage;
data['function_type'] = this.functionType;
data['source_list'] = this.sourceList;
return data;
}
}

class BuyBubbleTip {
String textStr;
String textColor;
String priceIcon;
String bgImage;
String closeIcon;
String isShow;
List<String> sourceList;

BuyBubbleTip({this.textStr,
this.textColor,
this.priceIcon,
this.bgImage,
this.closeIcon,
this.isShow,
this.sourceList});

BuyBubbleTip.fromJson(Map<String, dynamic> json) {
textStr = json['text_str'];
textColor = json['text_color'];
priceIcon = json['price_icon'];
bgImage = json['bg_image'];
closeIcon = json['close_icon'];
isShow = json['is_show'];
sourceList = json['source_list'].cast<String>();
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['text_str'] = this.textStr;
data['text_color'] = this.textColor;
data['price_icon'] = this.priceIcon;
data['bg_image'] = this.bgImage;
data['close_icon'] = this.closeIcon;
data['is_show'] = this.isShow;
data['source_list'] = this.sourceList;
return data;
}
}

+ 3
- 3
lib/widgets/goods_details/recommend/goods_detail_commend_creater.dart Целия файл

@@ -50,9 +50,9 @@ class GoodsDetailCommendCreater extends WidgetCreater {
Logger.warn(model?.toString());

return [
SliverToBoxAdapter(
child: GoodsDetailsRecommendWidget(model),
),
// SliverToBoxAdapter(
// child: GoodsDetailsRecommendWidget(model),
// ),
GoodsDetailCommendList(
model,
provider: provider, // 猜你喜欢数据源暂无数据


+ 72
- 0
lib/widgets/goods_details/recommend_title/goods_details_recommend_title_widget.dart Целия файл

@@ -0,0 +1,72 @@
import 'dart:convert';

import 'package:flutter/material.dart';
import 'model/goods_details_recommend_titile_model.dart';
import 'package:zhiying_comm/zhiying_comm.dart';

///
/// 商品详情的推荐列表小标题
///
class GoodsDetailsRecommendTitleWidget extends StatelessWidget {
final Map<String, dynamic> data;
GoodsDetailsRecommendTitileModel model;

GoodsDetailsRecommendTitleWidget(this.data, {Key key}) : super(key: key) {
try {
model = GoodsDetailsRecommendTitileModel.fromJson(jsonDecode(data['data']));
} catch (e, s) {
Logger.error(e, s);
}
}

@override
Widget build(BuildContext context) {

if( null == model) return Container();

return Container(
width: double.infinity,
margin: EdgeInsets.only(top: ParseUtil.stringParseDouble(model?.topMargin, defVal: 0), left: ParseUtil.stringParseDouble(model?.leftRightMargin), right: ParseUtil.stringParseDouble(model?.leftRightMargin)),
padding: EdgeInsets.only(top: 15, bottom: 15),
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)),
)
),
child: _buildMainWidget(),
);
}

Widget _buildMainWidget() {
Widget rlt;
switch(model?.moduleType ?? '') {
case 'product_detail_recommend_title1':
rlt = _buildWidgetStyle1();
break;
default:
rlt = Container();
break;
}
return rlt;

}

// module_type = product_detail_recommend_title1
Widget _buildWidgetStyle1() {
return Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
CachedNetworkImage(imageUrl: model?.icon ?? '', width: 15),
const SizedBox(width: 7.5),
Text(model?.title, style: TextStyle(color: HexColor.fromHex(model?.titleColor), fontSize: 14, fontWeight: FontWeight.bold),)
],
),
);
}

}

+ 80
- 0
lib/widgets/goods_details/recommend_title/model/goods_details_recommend_titile_model.dart Целия файл

@@ -0,0 +1,80 @@
class GoodsDetailsRecommendTitileModel {
String name;
String desc;
String title;
String icon;
String moduleType;
String moduleKey;
String isTopMargin;
String isLeftRightMargin;
String isShow;
String topMargin;
String leftRightMargin;
String topLeftRadius;
String topRightRadius;
String bottomLeftRadius;
String bottomRightRadius;
String bgColor;
String titleColor;

GoodsDetailsRecommendTitileModel(
{this.name,
this.desc,
this.title,
this.icon,
this.moduleType,
this.moduleKey,
this.isTopMargin,
this.isLeftRightMargin,
this.isShow,
this.topMargin,
this.leftRightMargin,
this.topLeftRadius,
this.topRightRadius,
this.bottomLeftRadius,
this.bottomRightRadius,
this.bgColor,
this.titleColor});

GoodsDetailsRecommendTitileModel.fromJson(Map<String, dynamic> json) {
name = json['name'];
desc = json['desc'];
title = json['title'];
icon = json['icon'];
moduleType = json['module_type'];
moduleKey = json['module_key'];
isTopMargin = json['is_top_margin'];
isLeftRightMargin = json['is_left_right_margin'];
isShow = json['is_show'];
topMargin = json['top_margin'];
leftRightMargin = json['left_right_margin'];
topLeftRadius = json['top_left_radius'];
topRightRadius = json['top_right_radius'];
bottomLeftRadius = json['bottom_left_radius'];
bottomRightRadius = json['bottom_right_radius'];
bgColor = json['bg_color'];
titleColor = json['title_color'];
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['name'] = this.name;
data['desc'] = this.desc;
data['title'] = this.title;
data['icon'] = this.icon;
data['module_type'] = this.moduleType;
data['module_key'] = this.moduleKey;
data['is_top_margin'] = this.isTopMargin;
data['is_left_right_margin'] = this.isLeftRightMargin;
data['is_show'] = this.isShow;
data['top_margin'] = this.topMargin;
data['left_right_margin'] = this.leftRightMargin;
data['top_left_radius'] = this.topLeftRadius;
data['top_right_radius'] = this.topRightRadius;
data['bottom_left_radius'] = this.bottomLeftRadius;
data['bottom_right_radius'] = this.bottomRightRadius;
data['bg_color'] = this.bgColor;
data['title_color'] = this.titleColor;
return data;
}
}

+ 19
- 10
lib/widgets/goods_details/slide_banner/goods_details_slide_banner_widget.dart Целия файл

@@ -48,8 +48,7 @@ class _GoodsDetailsSlideBannerContainerState
void _itemOnClick(String model, List<String> images, int index) {
print('点击了 $model');
if (images != null) {
PhotoPreview.showPhotoPreviewByimages(context, images,
currentIndex: index, heroTagSuffix: "top");
PhotoPreview.showPhotoPreviewByimages(context, images, currentIndex: index, heroTagSuffix: "top");
}
}

@@ -103,6 +102,16 @@ class _GoodsDetailsSlideBannerContainerState
Widget _getMainWidget(GoodsDetailsSlideBannerModel datas) {
return Container(
width: double.infinity,
margin: EdgeInsets.only(top: ParseUtil.stringParseDouble(datas?.topMargin), left: ParseUtil.stringParseDouble(datas?.leftRightMargin), right: ParseUtil.stringParseDouble(datas?.leftRightMargin)),
decoration: BoxDecoration(
color: HexColor.fromHex(datas?.bgColor),
borderRadius: BorderRadius.only(
topRight: Radius.circular(ParseUtil.stringParseDouble(datas?.topRightRadius)),
topLeft: Radius.circular(ParseUtil.stringParseDouble(datas?.topLeftRadius)),
bottomLeft: Radius.circular(ParseUtil.stringParseDouble(datas?.bottomLeftRadius)),
bottomRight: Radius.circular(ParseUtil.stringParseDouble(datas?.bottomRightRadius)),
)
),
height: MediaQuery.of(context).size.width,
child: Swiper(
controller: _control,
@@ -150,20 +159,20 @@ class _GoodsDetailsSlideBannerContainerState
/// 获取进度样式
SwiperPlugin _getSwiperStyleByType(
GoodsDetailsSlideBannerModel model, int pageCount) {
if ('1' != model.pagination_open) {
return null;
}
// if ('1' != model.pagination_open) {
// return null;
// }
if ('type_number' == model.pagination) {
return _getNumswiperPlugin(pageCount, model.pagination_select_color,
model.pagination_unselect_color);
return _getNumswiperPlugin(pageCount, model.paginationSelectColor,
model.paginationUnselectColor);
}
if ('type_point' == model.pagination) {
return _swiperCustomPaginationDito(pageCount,
model.pagination_select_color, model.pagination_unselect_color);
model.paginationSelectColor, model.paginationUnselectColor);
}
if ('type_bar' == model.pagination) {
return _swiperCustomPagination(pageCount, model.pagination_select_color,
model.pagination_unselect_color);
return _swiperCustomPagination(pageCount, model.paginationSelectColor,
model.paginationUnselectColor);
}
return null;
}


+ 116
- 31
lib/widgets/goods_details/slide_banner/model/goods_details_silde_banner_model.dart Целия файл

@@ -1,36 +1,121 @@
class GoodsDetailsSlideBannerModel {
List<String> image_list;
String pagination;
String pagination_open;
List<String> pagination_options;
String pagination_select_color;
String pagination_unselect_color;
List<String> image_list;

GoodsDetailsSlideBannerModel({this.image_list, this.pagination, this.pagination_open, this.pagination_options, this.pagination_select_color, this.pagination_unselect_color});
String name;
String desc;
String pagination;
String moduleType;
String moduleKey;
String isTopMargin;
String isLeftRightMargin;
String isShow;
String carouselType;
String paginationSelectColor;
String paginationUnselectColor;
String barWidthHeightRatio;
String bgWidthHeightRatio;
String carouselTime;
String topMargin;
String leftRightMargin;
String topLeftRadius;
String topRightRadius;
String bottomLeftRadius;
String bottomRightRadius;
String bgColor;
String hasVideo;
// List<Null> indexCarouselList;

factory GoodsDetailsSlideBannerModel.fromJson(Map<String, dynamic> json) {
return GoodsDetailsSlideBannerModel(
image_list: json['image_list'] != null ? new List<String>.from(json['image_list']) : null,
pagination: json['pagination'],
pagination_open: json['pagination_open'],
pagination_options: json['pagination_options'] != null ? new List<String>.from(json['pagination_options']) : null,
pagination_select_color: json['pagination_select_color'],
pagination_unselect_color: json['pagination_unselect_color'],
);
}
GoodsDetailsSlideBannerModel({
this.image_list,
this.name,
this.desc,
this.pagination,
this.moduleType,
this.moduleKey,
this.isTopMargin,
this.isLeftRightMargin,
this.isShow,
this.carouselType,
this.paginationSelectColor,
this.paginationUnselectColor,
this.barWidthHeightRatio,
this.bgWidthHeightRatio,
this.carouselTime,
this.topMargin,
this.leftRightMargin,
this.topLeftRadius,
this.topRightRadius,
this.bottomLeftRadius,
this.bottomRightRadius,
this.bgColor,
this.hasVideo,
// this.indexCarouselList,
});

GoodsDetailsSlideBannerModel.fromJson(Map<String, dynamic> json) {
image_list = json['image_list'] != null ? new List<String>.from(json['image_list']) : null;

name = json['name'];
desc = json['desc'];
pagination = json['pagination'];
moduleType = json['module_type'];
moduleKey = json['module_key'];
isTopMargin = json['is_top_margin'];
isLeftRightMargin = json['is_left_right_margin'];
isShow = json['is_show'];
carouselType = json['carousel_type'];
paginationSelectColor = json['pagination_select_color'];
paginationUnselectColor = json['pagination_unselect_color'];
barWidthHeightRatio = json['bar_width_height_ratio'];
bgWidthHeightRatio = json['bg_width_height_ratio'];
carouselTime = json['carousel_time'];
topMargin = json['top_margin'];
leftRightMargin = json['left_right_margin'];
topLeftRadius = json['top_left_radius'];
topRightRadius = json['top_right_radius'];
bottomLeftRadius = json['bottom_left_radius'];
bottomRightRadius = json['bottom_right_radius'];
bgColor = json['bg_color'];
hasVideo = json['has_video'];
// if (json['index_carousel_list'] != null) {
// indexCarouselList = new List<Null>();
// json['index_carousel_list'].forEach((v) {
// indexCarouselList.add(new Null.fromJson(v));
// });
// }
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['pagination'] = this.pagination;
data['pagination_open'] = this.pagination_open;
data['pagination_select_color'] = this.pagination_select_color;
data['pagination_unselect_color'] = this.pagination_unselect_color;
if (this.image_list != null) {
data['image_list'] = this.image_list;
}
if (this.pagination_options != null) {
data['pagination_options'] = this.pagination_options;
}
return data;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.image_list != null) {
data['image_list'] = this.image_list;
}
}
data['name'] = this.name;
data['desc'] = this.desc;
data['pagination'] = this.pagination;
data['module_type'] = this.moduleType;
data['module_key'] = this.moduleKey;
data['is_top_margin'] = this.isTopMargin;
data['is_left_right_margin'] = this.isLeftRightMargin;
data['is_show'] = this.isShow;
data['carousel_type'] = this.carouselType;
data['pagination_select_color'] = this.paginationSelectColor;
data['pagination_unselect_color'] = this.paginationUnselectColor;
data['bar_width_height_ratio'] = this.barWidthHeightRatio;
data['bg_width_height_ratio'] = this.bgWidthHeightRatio;
data['carousel_time'] = this.carouselTime;
data['top_margin'] = this.topMargin;
data['left_right_margin'] = this.leftRightMargin;
data['top_left_radius'] = this.topLeftRadius;
data['top_right_radius'] = this.topRightRadius;
data['bottom_left_radius'] = this.bottomLeftRadius;
data['bottom_right_radius'] = this.bottomRightRadius;
data['bg_color'] = this.bgColor;
data['has_video'] = this.hasVideo;
// if (this.indexCarouselList != null) {
// data['index_carousel_list'] =
// this.indexCarouselList.map((v) => v.toJson()).toList();
// }
return data;
}
}

+ 116
- 43
lib/widgets/goods_details/store/model/store_model.dart Целия файл

@@ -1,70 +1,143 @@
class StoreModel {
String description;
String description_color;
String description_leve_icon;
String logistics;
String logistics_color;
String logistics_leve_icon;
String more;
String service;
String service_color;
String service_leve_icon;
String shop_id;
String shop_name;
String shop_name_color;
String shop_avatar;
// 宝贝描述
String description;
// 物流服务
String logistics;
// 服务态度
String service;

String name;
String desc;
String moduleType;
String moduleKey;
String isTopMargin;
String isLeftRightMargin;
String isShow;
String topMargin;
String leftRightMargin;
String topLeftRadius;
String topRightRadius;
String bottomLeftRadius;
String bottomRightRadius;
String bgColor;
String shopTextColor;
String descTextColor1;
String descTextColor2;
String descTextColor3;
String moreText;
String moreTextColor;
String moreIcon;
String heightPointIcon;
String publicPointIcon;
String lowPointIcon;

StoreModel({
this.description,
this.description_color,
this.description_leve_icon,
this.logistics,
this.logistics_color,
this.logistics_leve_icon,
this.more,
this.service,
this.service_color,
this.service_leve_icon,
this.shop_id,
this.shop_name,
this.shop_name_color,
this.shop_avatar,

this.name,
this.desc,
this.moduleType,
this.moduleKey,
this.isTopMargin,
this.isLeftRightMargin,
this.isShow,
this.topMargin,
this.leftRightMargin,
this.topLeftRadius,
this.topRightRadius,
this.bottomLeftRadius,
this.bottomRightRadius,
this.bgColor,
this.shopTextColor,
this.descTextColor1,
this.descTextColor2,
this.descTextColor3,
this.moreText,
this.moreTextColor,
this.moreIcon,
this.heightPointIcon,
this.publicPointIcon,
this.lowPointIcon

});

factory StoreModel.fromJson(Map<String, dynamic> json) {
return StoreModel(
description: json['description'],
description_color: json['description_color'],
description_leve_icon: json['description_leve_icon'],
logistics: json['logistics'],
logistics_color: json['logistics_color'],
logistics_leve_icon: json['logistics_leve_icon'],
more: json['more'],
service: json['service'],
service_color: json['service_color'],
service_leve_icon: json['service_leve_icon'],
shop_id: json['shop_id'],
shop_name: json['shop_name'],
shop_name_color: json['shop_name_color'],
shop_avatar: json['shop_avatar']);
StoreModel.fromJson(Map<String, dynamic> json) {
description = json['description'];
logistics = json['logistics'];
service = json['service'];
shop_id = json['shop_id'];
shop_name = json['shop_name'];
shop_avatar = json['shop_avatar'];

name = json['name'];
desc = json['desc'];
moduleType = json['module_type'];
moduleKey = json['module_key'];
isTopMargin = json['is_top_margin'];
isLeftRightMargin = json['is_left_right_margin'];
isShow = json['is_show'];
topMargin = json['top_margin'];
leftRightMargin = json['left_right_margin'];
topLeftRadius = json['top_left_radius'];
topRightRadius = json['top_right_radius'];
bottomLeftRadius = json['bottom_left_radius'];
bottomRightRadius = json['bottom_right_radius'];
bgColor = json['bg_color'];
shopTextColor = json['shop_text_color'];
descTextColor1 = json['desc_text_color1'];
descTextColor2 = json['desc_text_color2'];
descTextColor3 = json['desc_text_color3'];
moreText = json['more_text'];
moreTextColor = json['more_text_color'];
moreIcon = json['more_icon'];
heightPointIcon = json['height_point_icon'];
publicPointIcon = json['public_point_icon'];
lowPointIcon = json['low_point_icon'];

}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['description'] = this.description;
data['description_color'] = this.description_color;
data['description_leve_icon'] = this.description_leve_icon;
data['logistics'] = this.logistics;
data['logistics_color'] = this.logistics_color;
data['logistics_leve_icon'] = this.logistics_leve_icon;
data['more'] = this.more;
data['service'] = this.service;
data['service_color'] = this.service_color;
data['service_leve_icon'] = this.service_leve_icon;
data['shop_id'] = this.shop_id;
data['shop_name'] = this.shop_name;
data['shop_name_color'] = this.shop_name_color;
data['shop_avatar'] = this.shop_avatar;

data['name'] = this.name;
data['desc'] = this.desc;
data['module_type'] = this.moduleType;
data['module_key'] = this.moduleKey;
data['is_top_margin'] = this.isTopMargin;
data['is_left_right_margin'] = this.isLeftRightMargin;
data['is_show'] = this.isShow;
data['top_margin'] = this.topMargin;
data['left_right_margin'] = this.leftRightMargin;
data['top_left_radius'] = this.topLeftRadius;
data['top_right_radius'] = this.topRightRadius;
data['bottom_left_radius'] = this.bottomLeftRadius;
data['bottom_right_radius'] = this.bottomRightRadius;
data['bg_color'] = this.bgColor;
data['shop_text_color'] = this.shopTextColor;
data['desc_text_color1'] = this.descTextColor1;
data['desc_text_color2'] = this.descTextColor2;
data['desc_text_color3'] = this.descTextColor3;
data['more_text'] = this.moreText;
data['more_text_color'] = this.moreTextColor;
data['more_icon'] = this.moreIcon;
data['height_point_icon'] = this.heightPointIcon;
data['public_point_icon'] = this.publicPointIcon;
data['low_point_icon'] = this.lowPointIcon;

return data;
}
}

+ 16
- 10
lib/widgets/goods_details/store/store_widget.dart Целия файл

@@ -83,10 +83,19 @@ class _StoreContainerState extends State<StoreContainer> {
_onStoreClick();
},
child: Container(
color: Colors.white,
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)),
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)),
)
),
child: Row(
children: <Widget>[
/// 商家图片
@@ -131,16 +140,16 @@ class _StoreContainerState extends State<StoreContainer> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
/// 商店名称
Text(model?.shop_name ?? '品胜京东自营旗舰店',
Text(model?.shop_name ?? '',
style: TextStyle(
color: HexColor.fromHex(model?.shop_name_color ?? '#333333'),
color: HexColor.fromHex(model?.shopTextColor ?? '#333333'),
fontSize: 13,
fontWeight: FontWeight.bold)),

/// 更多 TODO 暂时隐藏,等后台有数据后再打开
Visibility(
visible: false,
child: Text(model?.more ?? '更多店铺优惠 >', style: TextStyle(color: HexColor.fromHex('#FF4242'), fontSize: 11))),
child: Text(model?.moreText ?? '更多店铺优惠', style: TextStyle(color: HexColor.fromHex('#FF4242'), fontSize: 11))),
],
);
}
@@ -151,16 +160,13 @@ class _StoreContainerState extends State<StoreContainer> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
/// 宝贝描述 5.0
_getCoustomWidet(model?.description ?? '宝贝描述 5.0', model?.description_color ?? '#999999',
model?.description_leve_icon ?? ''),
_getCoustomWidet(model?.description ?? '宝贝描述 5.0', model?.descTextColor1 ?? '#999999', model?.heightPointIcon ?? ''),

/// 物流服务 5.0
_getCoustomWidet(
model?.logistics ?? '宝贝描述 5.0', model?.logistics_color ?? '#999999', model?.logistics_leve_icon ?? ''),
_getCoustomWidet(model?.logistics ?? '宝贝描述 5.0', model?.descTextColor2 ?? '#999999', model?.publicPointIcon ?? ''),

/// 服务态度 1.0
_getCoustomWidet(
model?.service ?? '宝贝描述 5.0', model?.service_color ?? '#999999', model?.service_leve_icon ?? ''),
_getCoustomWidet(model?.service ?? '宝贝描述 5.0', model?.descTextColor3 ?? '#999999', model?.lowPointIcon ?? ''),
],
);
}


+ 64
- 0
lib/widgets/goods_details/tag/goods_details_tag_widget.dart Целия файл

@@ -0,0 +1,64 @@
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:zhiying_base_widget/widgets/goods_details/tag/model/goods_details_tag_model.dart';
import 'package:zhiying_comm/zhiying_comm.dart';

class GoodsDetailsTagWidget extends StatelessWidget {
final Map<String, dynamic> data;
GoodsDetailsTagModel _model;

GoodsDetailsTagWidget(this.data, {Key key}) : super(key: key) {
try {
_model = GoodsDetailsTagModel.fromJson(jsonDecode(data['data']));
} catch(e, s) {
Logger.error(e, s);
}
}

@override
Widget build(BuildContext context) {
if(null == _model) return Container();
return Container(
width: double.infinity,
margin: EdgeInsets.only(top: ParseUtil.stringParseDouble(_model?.topMargin), left: ParseUtil.stringParseDouble(_model?.leftRightMargin), right: ParseUtil.stringParseDouble(_model?.leftRightMargin)),
padding: const EdgeInsets.only(left: 12.5, right: 12.5, top: 6, bottom: 6),
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)),
)
),
child: _buildMainWidget(),
);
}

Widget _buildMainWidget() {
return Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
/// 领券立减100元 widget
Visibility(visible: !EmptyUtil.isEmpty(_model?.couponText), child: _getCoumstonButtomWidget(_model?.couponText, _model?.tagList[1]?.textColor ?? '#FF4242', _model?.tagList[1]?.bgColor ?? '#FFE0E0')),

/// 收货后返现5.5元
Visibility(visible: !EmptyUtil.isEmpty(_model?.commissionText), child: _getCoumstonButtomWidget(_model?.commissionText, _model?.tagList[0]?.textColor ?? '#B78107', _model?.tagList[0]?.bgColor ?? '#FFEFDA')),
],
);
}


Widget _getCoumstonButtomWidget(String text, String textColor, String bg) {
return Container(
margin: const EdgeInsets.only(right: 5),
padding: const EdgeInsets.only(left: 13.5, right: 14.5, top: 2.5, bottom: 2.5),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(30), color: HexColor.fromHex(bg)),
child: Text(
text ?? '',
style: TextStyle(color: HexColor.fromHex(textColor), fontSize: 11),
),
);
}
}

+ 128
- 0
lib/widgets/goods_details/tag/model/goods_details_tag_model.dart Целия файл

@@ -0,0 +1,128 @@
class GoodsDetailsTagModel {
String name;
String desc;
String moduleType;
String moduleKey;
String isTopMargin;
String isLeftRightMargin;
String isShow;
String topMargin;
String leftRightMargin;
String topLeftRadius;
String topRightRadius;
String bottomLeftRadius;
String bottomRightRadius;
String bgColor;
List<TagList> tagList;
List<String> sourceList;

// data
String commissionText;
String couponText;
String providerName;
String title;

GoodsDetailsTagModel({
this.name,
this.desc,
this.moduleType,
this.moduleKey,
this.isTopMargin,
this.isLeftRightMargin,
this.isShow,
this.topMargin,
this.leftRightMargin,
this.topLeftRadius,
this.topRightRadius,
this.bottomLeftRadius,
this.bottomRightRadius,
this.bgColor,
this.tagList,
this.sourceList,

this.commissionText,
this.couponText,
this.providerName,
this.title,
});

GoodsDetailsTagModel.fromJson(Map<String, dynamic> json) {
name = json['name'];
desc = json['desc'];
moduleType = json['module_type'];
moduleKey = json['module_key'];
isTopMargin = json['is_top_margin'];
isLeftRightMargin = json['is_left_right_margin'];
isShow = json['is_show'];
topMargin = json['top_margin'];
leftRightMargin = json['left_right_margin'];
topLeftRadius = json['top_left_radius'];
topRightRadius = json['top_right_radius'];
bottomLeftRadius = json['bottom_left_radius'];
bottomRightRadius = json['bottom_right_radius'];
bgColor = json['bg_color'];
if (json['tag_list'] != null) {
tagList = new List<TagList>();
json['tag_list'].forEach((v) {
tagList.add(new TagList.fromJson(v));
});
}
sourceList = json['source_list'].cast<String>();

commissionText = json['commission_text'];
couponText = json['coupon_text'];
providerName = json['provider_name'];
title = json['title'];
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['name'] = this.name;
data['desc'] = this.desc;
data['module_type'] = this.moduleType;
data['module_key'] = this.moduleKey;
data['is_top_margin'] = this.isTopMargin;
data['is_left_right_margin'] = this.isLeftRightMargin;
data['is_show'] = this.isShow;
data['top_margin'] = this.topMargin;
data['left_right_margin'] = this.leftRightMargin;
data['top_left_radius'] = this.topLeftRadius;
data['top_right_radius'] = this.topRightRadius;
data['bottom_left_radius'] = this.bottomLeftRadius;
data['bottom_right_radius'] = this.bottomRightRadius;
data['bg_color'] = this.bgColor;
if (this.tagList != null) {
data['tag_list'] = this.tagList.map((v) => v.toJson()).toList();
}
data['source_list'] = this.sourceList;

data['commission_text'] = this.commissionText;
data['coupon_text'] = this.couponText;
data['provider_name'] = this.providerName;
data['title'] = this.title;

return data;
}
}

class TagList {
String name;
String textColor;
String bgColor;

TagList({this.name, this.textColor, this.bgColor});

TagList.fromJson(Map<String, dynamic> json) {
name = json['name'];
textColor = json['text_color'];
bgColor = json['bg_color'];
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['name'] = this.name;
data['text_color'] = this.textColor;
data['bg_color'] = this.bgColor;
return data;
}
}

+ 111
- 39
lib/widgets/goods_details/title/goods_details_title_widget.dart Целия файл

@@ -23,8 +23,17 @@ class GoodsDetailsTitleWidget extends StatelessWidget {
Widget build(BuildContext context) {
return Container(
width: double.infinity,
color: Colors.white,
padding: const EdgeInsets.only(left: 12.5, right: 12.5, top: 6.5),
padding: const EdgeInsets.only(left: 12.5, right: 12.5, top: 6, bottom: 6),
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(
topLeft: Radius.circular(ParseUtil.stringParseDouble(_model?.topLeftRadius)),
topRight: Radius.circular(ParseUtil.stringParseDouble(_model?.topRightRadius)),
bottomRight: Radius.circular(ParseUtil.stringParseDouble(_model?.bottomRightRadius)),
bottomLeft: Radius.circular(ParseUtil.stringParseDouble(_model?.bottomLeftRadius)),
)
),
child: _getMaiWidget(_model),
);
}
@@ -35,21 +44,99 @@ class GoodsDetailsTitleWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RichText(
maxLines: 2,
overflow: TextOverflow.ellipsis,
text: TextSpan(children: [
WidgetSpan(child: _getGoodsTypeIcon(model)),
_getGoodsTitle(model),
]),
),

/// 优惠卷说明
Padding(padding: const EdgeInsets.only(top: 12.5), child: _getCounponDestrWidget(model)),
_buildPriceWidget(model),
const SizedBox(height: 6.5),
_buildTitleWidget(model)
],
);
}

/// 价格
Widget _buildPriceWidget(GoodsDetailsTitleModel model) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
_getLeftWidget(model),

/// 右边widget
_getBuyNumberWidget(model),
],
);
}

/// 左边的wiget 包括价格等
Widget _getLeftWidget(GoodsDetailsTitleModel model) {
return Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
/// 价格
_getPriceWidget(model),
const SizedBox(width: 5),

/// 券后
_getQhPriceWidget(model),
const SizedBox(width: 5),

/// 积分
Visibility(
visible: !EmptyUtil.isEmpty(model?.point),
child: _getPointsWidget(model))
],
);
}

/// 价格
Widget _getPriceWidget(GoodsDetailsTitleModel model) {
return Row(
children: <Widget>[
Text('¥ ', style: TextStyle(color: HexColor.fromHex( model?.newPriceColor ??'#FF4242'), fontSize: 15)),
Text(model?.currentPrice ?? '0', style: TextStyle(color: HexColor.fromHex(model?.newPriceColor ?? '#FF4242'), fontSize: 30, fontFamily: 'Din', package: 'zhiying_comm', fontWeight: FontWeight.bold)),
],
);
}

/// 积分
Widget _getPointsWidget(GoodsDetailsTitleModel model) {
return Container(
decoration: BoxDecoration(color: HexColor.fromHex(model?.rewardBgColor ?? '#FFEFDA'), borderRadius: BorderRadius.circular(5)),
padding: const EdgeInsets.only(left: 4, right: 7.5, top: 4, bottom: 4),
child: Text(model?.point ?? '+ 0.00 积分', style: TextStyle(color: HexColor.fromHex( model?.rewardTextColor ?? '#B78107'), fontSize: 9, fontFamily: 'Din', package: 'zhiying_comm')),
);
}

/// 券后价格
Widget _getQhPriceWidget(GoodsDetailsTitleModel model) {
return Column(
children: <Widget>[
Text( model?.isCoupon == '1' ? model?.couponText ?? '券后' : /*model?.hand_price_text ??*/ '到手价', style: TextStyle(color: HexColor.fromHex(model?.couponTextColor ?? '#FF4242'), fontSize: 11)),
Text('¥ ${model?.marketPrice}' ?? '¥ 0', style: TextStyle(color: HexColor.fromHex(model?.saleTextColor ?? '#999999'), fontSize: 10, fontFamily: 'Din', package: 'zhiying_comm', decoration: TextDecoration.lineThrough)),
],
);
}

/// 购买人数
Widget _getBuyNumberWidget(GoodsDetailsTitleModel model) {
// 考拉和唯品会不展示
if(model?.provider == GlobalConfig.PROVIDER_VIP || model?.provider == GlobalConfig.PROVIDER_KL){
return Container();
}
return Text('${model?.soldCount?? 0}${model?.goBuyText ?? '人已购买'}' ?? '99999人已购买', style: TextStyle(color: HexColor.fromHex(model?.goBuyColor ?? '#999999'), fontSize: 12.5));
}


/// 标题
Widget _buildTitleWidget(GoodsDetailsTitleModel model) {
return RichText(
maxLines: 2,
overflow: TextOverflow.ellipsis,
text: TextSpan(children: [
WidgetSpan(child: _getGoodsTypeIcon(model)),
_getGoodsTitle(model),
]),
);
}

/// 商品类型图标
Widget _getGoodsTypeIcon(GoodsDetailsTitleModel model) {
return Container(
@@ -57,8 +144,8 @@ class GoodsDetailsTitleWidget extends StatelessWidget {
// width: 32,
padding: const EdgeInsets.only(left: 7.5, right: 7.5, bottom: 2, top: 3),
margin: const EdgeInsets.only(right: 4),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(2.5), color: HexColor.fromHex(model?.provider_bg_color)),
child: Text(model?.provider_name, textAlign: TextAlign.center, style: TextStyle(color: HexColor.fromHex(model?.provider_name_color), fontSize: 9)),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(2.5), color: HexColor.fromHex(getPlatformCssByPvd()?.bgColor)),
child: Text(getPlatformCssByPvd()?.name ?? '', textAlign: TextAlign.center, style: TextStyle(color: HexColor.fromHex(getPlatformCssByPvd()?.textColor ?? ''), fontSize: 9)),
);
}

@@ -69,33 +156,18 @@ class GoodsDetailsTitleWidget extends StatelessWidget {
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: HexColor.fromHex(model?.good_title_color ?? '#FF333333'),
color: HexColor.fromHex(model?.titleTextColor ?? '#FF333333'),
));
}

/// 优惠卷说明
Widget _getCounponDestrWidget(GoodsDetailsTitleModel model) {
return Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
/// 领券立减100元 widget
Visibility(visible: !EmptyUtil.isEmpty(model?.couponPrice), child: _getCoumstonButtomWidget(model?.coupon_text, model?.coupon_text_color, model?.coupon_bg_color)),

/// 收货后返现5.5元
Visibility(visible: !EmptyUtil.isEmpty(model?.commission), child: _getCoumstonButtomWidget(model?.commission_text, model?.commission_text_color, model?.commission_bg_color)),
],
);
PlatformCss getPlatformCssByPvd() {
PlatformCss rlt = null;
this._model.platformCss.forEach((element) {
if(element.type == this._model.provider) {
rlt = element;
}
});
return rlt;
}

Widget _getCoumstonButtomWidget(String text, String textColor, String bg) {
return Container(
margin: const EdgeInsets.only(right: 5),
padding: const EdgeInsets.only(left: 13.5, right: 14.5, top: 2.5, bottom: 2.5),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(30), color: HexColor.fromHex(bg)),
child: Text(
text,
style: TextStyle(color: HexColor.fromHex(textColor), fontSize: 11),
),
);
}
}

+ 185
- 57
lib/widgets/goods_details/title/model/goods_details_title_model.dart Целия файл

@@ -1,67 +1,195 @@
class GoodsDetailsTitleModel {
String commission_bg_color;
String commission_text;
String commission_text_color;
String coupon_bg_color;
String coupon_text;
String coupon_text_color;
String good_title_color;
String provider_bg_color;
String provider_name;
String provider_name_color;
String name;
String desc;
String moduleType;
String moduleKey;
String isTopMargin;
String isLeftRightMargin;
String isShow;
String topMargin;
String leftRightMargin;
String topLeftRadius;
String topRightRadius;
String bottomLeftRadius;
String bottomRightRadius;
String bgColor;
String newPriceColor;
String originalPriceColor;
String couponText;
String couponTextColor;
String saleTextColor;
String titleTextColor;
String rewardBgColor;
String rewardTextColor;
String rewardStr;
List<PlatformCss> platformCss;
List<String> sourceList;
String goBuyText;
String goBuyColor;


String currentPrice;
String isCoupon;
String marketPrice;
String point;
String soldCount;
String title;
String commission;
String couponPrice;

GoodsDetailsTitleModel({
this.commission_bg_color,
this.commission_text,
this.commission_text_color,
this.coupon_bg_color,
this.coupon_text,
this.coupon_text_color,
this.good_title_color,
this.provider_bg_color,
this.provider_name,
this.provider_name_color,
this.title,
this.commission,
this.couponPrice,
});

factory GoodsDetailsTitleModel.fromJson(Map<String, dynamic> json) {
return GoodsDetailsTitleModel(
commission_bg_color: json['commission_bg_color'],
commission_text: json['commission_text'],
commission_text_color: json['commission_text_color'],
coupon_bg_color: json['coupon_bg_color'],
coupon_text: json['coupon_text'],
coupon_text_color: json['coupon_text_color'],
good_title_color: json['good_title_color'],
provider_bg_color: json['provider_bg_color'],
provider_name: json['provider_name'],
provider_name_color: json['provider_name_color'],
title: json['title'],
commission: json['commission'],
couponPrice: json['coupon_price'],
);

String provider;
String good_id;

GoodsDetailsTitleModel(
{this.name,
this.desc,
this.moduleType,
this.moduleKey,
this.isTopMargin,
this.isLeftRightMargin,
this.isShow,
this.topMargin,
this.leftRightMargin,
this.topLeftRadius,
this.topRightRadius,
this.bottomLeftRadius,
this.bottomRightRadius,
this.bgColor,
this.newPriceColor,
this.originalPriceColor,
this.couponText,
this.couponTextColor,
this.saleTextColor,
this.titleTextColor,
this.rewardBgColor,
this.rewardTextColor,
this.rewardStr,
this.platformCss,
this.sourceList,
this.goBuyText,
this.goBuyColor,

this.currentPrice,
this.isCoupon,
this.marketPrice,
this.point,
this.soldCount,
this.title,

this.good_id,
this.provider,
});

GoodsDetailsTitleModel.fromJson(Map<String, dynamic> json) {
name = json['name'];
desc = json['desc'];
moduleType = json['module_type'];
moduleKey = json['module_key'];
isTopMargin = json['is_top_margin'];
isLeftRightMargin = json['is_left_right_margin'];
isShow = json['is_show'];
topMargin = json['top_margin'];
leftRightMargin = json['left_right_margin'];
topLeftRadius = json['top_left_radius'];
topRightRadius = json['top_right_radius'];
bottomLeftRadius = json['bottom_left_radius'];
bottomRightRadius = json['bottom_right_radius'];
bgColor = json['bg_color'];
newPriceColor = json['new_price_color'];
originalPriceColor = json['original_price_color'];
couponText = json['coupon_text'];
couponTextColor = json['coupon_text_color'];
saleTextColor = json['sale_text_color'];
titleTextColor = json['title_text_color'];
rewardBgColor = json['reward_bg_color'];
rewardTextColor = json['reward_text_color'];
rewardStr = json['reward_str'];
if (json['platform_css'] != null) {
platformCss = new List<PlatformCss>();
json['platform_css'].forEach((v) {
platformCss.add(new PlatformCss.fromJson(v));
});
}
sourceList = json['source_list'].cast<String>();
goBuyText = json['go_buy_text'];
goBuyColor = json['go_buy_text_color'];

currentPrice = json['current_price'];
isCoupon = json['is_coupon'];
marketPrice = json['market_price'];
point = json['point'];
soldCount = json['sold_count'];
title = json['title'];

good_id = json['good_id'];
provider = json['provider'];
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['commission_bg_color'] = this.commission_bg_color;
data['commission_text'] = this.commission_text;
data['commission_text_color'] = this.commission_text_color;
data['coupon_bg_color'] = this.coupon_bg_color;
data['coupon_text'] = this.coupon_text;
data['coupon_text_color'] = this.coupon_text_color;
data['good_title_color'] = this.good_title_color;
data['provider_bg_color'] = this.provider_bg_color;
data['provider_name'] = this.provider_name;
data['provider_name_color'] = this.provider_name_color;
data['name'] = this.name;
data['desc'] = this.desc;
data['module_type'] = this.moduleType;
data['module_key'] = this.moduleKey;
data['is_top_margin'] = this.isTopMargin;
data['is_left_right_margin'] = this.isLeftRightMargin;
data['is_show'] = this.isShow;
data['top_margin'] = this.topMargin;
data['left_right_margin'] = this.leftRightMargin;
data['top_left_radius'] = this.topLeftRadius;
data['top_right_radius'] = this.topRightRadius;
data['bottom_left_radius'] = this.bottomLeftRadius;
data['bottom_right_radius'] = this.bottomRightRadius;
data['bg_color'] = this.bgColor;
data['new_price_color'] = this.newPriceColor;
data['original_price_color'] = this.originalPriceColor;
data['coupon_text'] = this.couponText;
data['coupon_text_color'] = this.couponTextColor;
data['sale_text_color'] = this.saleTextColor;
data['title_text_color'] = this.titleTextColor;
data['reward_bg_color'] = this.rewardBgColor;
data['reward_text_color'] = this.rewardTextColor;
data['reward_str'] = this.rewardStr;
if (this.platformCss != null) {
data['platform_css'] = this.platformCss.map((v) => v.toJson()).toList();
}
data['source_list'] = this.sourceList;
data['go_buy_text'] = this.goBuyText;
data['go_buy_text_color'] = this.goBuyColor;

data['current_price'] = this.currentPrice;
data['is_coupon'] = this.isCoupon;
data['market_price'] = this.marketPrice;
data['point'] = this.point;
data['sold_count'] = this.soldCount;
data['title'] = this.title;
data['coupon_price'] = this.couponPrice;
data['commission'] = this.commission;

data['provider'] = this.provider;
data['good_id'] = this.good_id;

return data;
}
}

class PlatformCss {
String name;
String type;
String textColor;
String bgColor;

PlatformCss({this.name, this.type, this.textColor, this.bgColor});

PlatformCss.fromJson(Map<String, dynamic> json) {
name = json['name'];
type = json['type'];
textColor = json['text_color'];
bgColor = json['bg_color'];
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['name'] = this.name;
data['type'] = this.type;
data['text_color'] = this.textColor;
data['bg_color'] = this.bgColor;
return data;
}
}

+ 116
- 24
lib/widgets/goods_details/upgrade_tip/model/upgrade_tip_model.dart Целия файл

@@ -1,44 +1,136 @@
import 'package:zhiying_comm/zhiying_comm.dart';

class UpgradeTipModel extends SkipModel {
String bg_color;
String go_text;
String go_text_color;
String icon;
String text;
String text_color;
class UpgradeTipModel {

String url;

String name;
String desc;
String icon;
String moduleType;
String moduleKey;
String isTopMargin;
String isLeftRightMargin;
String isShow;
String topMargin;
String leftRightMargin;
String topLeftRadius;
String topRightRadius;
String bottomLeftRadius;
String bottomRightRadius;
String bgColor;
String bulletinText;
String bulletinBgColor;
String bulletinTextColor;
String goText;
GoSkip goSkip;

UpgradeTipModel({
this.bg_color,
this.go_text,
this.go_text_color,
this.name,
this.desc,
this.icon,
this.text,
this.text_color,
this.moduleType,
this.moduleKey,
this.isTopMargin,
this.isLeftRightMargin,
this.isShow,
this.topMargin,
this.leftRightMargin,
this.topLeftRadius,
this.topRightRadius,
this.bottomLeftRadius,
this.bottomRightRadius,
this.bgColor,
this.bulletinText,
this.bulletinBgColor,
this.bulletinTextColor,
this.goText,
this.goSkip,
this.url,
});

UpgradeTipModel.fromJson(Map<String, dynamic> json) {
super.fromJson(json);
bg_color = json['bg_color'];
go_text = json['go_text'];
go_text_color = json['go_text_color'];
name = json['name'];
desc = json['desc'];
icon = json['icon'];
text = json['text'];
text_color = json['text_color'];
moduleType = json['module_type'];
moduleKey = json['module_key'];
isTopMargin = json['is_top_margin'];
isLeftRightMargin = json['is_left_right_margin'];
isShow = json['is_show'];
topMargin = json['top_margin'];
leftRightMargin = json['left_right_margin'];
topLeftRadius = json['top_left_radius'];
topRightRadius = json['top_right_radius'];
bottomLeftRadius = json['bottom_left_radius'];
bottomRightRadius = json['bottom_right_radius'];
bgColor = json['bg_color'];
bulletinText = json['bulletin_text'];
bulletinBgColor = json ['bulletin_bg_color'];
bulletinTextColor = json['bulletin_text_color'];
goText = json['go_text'];
goSkip =
json['go_skip'] != null ? new GoSkip.fromJson(json['go_skip']) : null;

url = json['url'];
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = super.toJson();
data['bg_color'] = this.bg_color;
data['go_text'] = this.go_text;
data['go_text_color'] = this.go_text_color;
final Map<String, dynamic> data = new Map<String, dynamic>();
data['name'] = this.name;
data['desc'] = this.desc;
data['icon'] = this.icon;
data['text'] = this.text;
data['text_color'] = this.text_color;
data['module_type'] = this.moduleType;
data['module_key'] = this.moduleKey;
data['is_top_margin'] = this.isTopMargin;
data['is_left_right_margin'] = this.isLeftRightMargin;
data['is_show'] = this.isShow;
data['top_margin'] = this.topMargin;
data['left_right_margin'] = this.leftRightMargin;
data['top_left_radius'] = this.topLeftRadius;
data['top_right_radius'] = this.topRightRadius;
data['bottom_left_radius'] = this.bottomLeftRadius;
data['bottom_right_radius'] = this.bottomRightRadius;
data['bg_color'] = this.bgColor;
data['bulletin_text'] = this.bulletinText;
data['bulletin_bg_color'] = this.bulletinBgColor;
data['bulletin_text_color'] = this.bulletinTextColor;
data['go_text'] = this.goText;
if (this.goSkip != null) {
data['go_skip'] = this.goSkip.toJson();
}

data['url'] = this.url;
return data;
}

}

class GoSkip extends SkipModel {
String requiredLogin;
String requiredTaobaoAuth;
String isJump;
String skipIdentifier;

GoSkip({this.requiredLogin,
this.requiredTaobaoAuth,
this.isJump,
this.skipIdentifier});

GoSkip.fromJson(Map<String, dynamic> json) {
super.fromJson(json);
requiredLogin = json['required_login'];
requiredTaobaoAuth = json['required_taobao_auth'];
isJump = json['is_jump'];
skipIdentifier = json['skip_identifier'];
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = super.toJson();
data['required_login'] = this.requiredLogin;
data['required_taobao_auth'] = this.requiredTaobaoAuth;
data['is_jump'] = this.isJump;
data['skip_identifier'] = this.skipIdentifier;
return data;
}
}

+ 23
- 13
lib/widgets/goods_details/upgrade_tip/upgrade_tip_widget.dart Целия файл

@@ -9,20 +9,21 @@ import 'package:cached_network_image/cached_network_image.dart';
/// 更新提示widget
///
class UpgradeTipWidget extends StatelessWidget {
final Map<String, dynamic> model;
UpgradeTipModel _upgradeTipModel;
final Map<String, dynamic> data;
UpgradeTipModel _model;

UpgradeTipWidget(this.model, {Key key}) : super(key: key) {
UpgradeTipWidget(this.data, {Key key}) : super(key: key) {
try {
_upgradeTipModel = UpgradeTipModel.fromJson(jsonDecode(model['data']));
_model = UpgradeTipModel.fromJson(jsonDecode(data['data']));
} catch (e) {
Logger.log('UpgradeTipWidget e = $e');
}
}

/// 点击事件
void _onClickListener(context) {
if (!EmptyUtil.isEmpty(_upgradeTipModel)) {
RouterUtil.route(_upgradeTipModel, _upgradeTipModel.toJson(), context);
if (!EmptyUtil.isEmpty(_model) && !EmptyUtil.isEmpty(_model?.goSkip)) {
RouterUtil.route(_model?.goSkip, _model?.goSkip?.toJson(), context);
}
}

@@ -30,23 +31,32 @@ class UpgradeTipWidget extends StatelessWidget {
Widget build(BuildContext context) {
return Container(
width: double.infinity,
padding: const EdgeInsets.only(left: 12.5, right: 12.5, top: 12.5),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.only(topLeft: Radius.circular(7.5), topRight: Radius.circular(7.5))),
margin: EdgeInsets.only(top: ParseUtil.stringParseDouble(_model?.topMargin), left: ParseUtil.stringParseDouble(_model?.leftRightMargin), right: ParseUtil.stringParseDouble(_model?.leftRightMargin)),
padding: const EdgeInsets.only(left: 12.5, right: 12.5, top: 6, bottom: 6),
decoration: BoxDecoration(
color: HexColor.fromHex(_model?.bgColor),
// color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(ParseUtil.stringParseDouble(_model?.topLeftRadius)),
topRight: Radius.circular(ParseUtil.stringParseDouble(_model?.topLeftRadius)),
bottomRight: Radius.circular(ParseUtil.stringParseDouble(_model?.bottomRightRadius)),
bottomLeft: Radius.circular(ParseUtil.stringParseDouble(_model?.topLeftRadius)),
)),
child: GestureDetector(
onTap: () => _onClickListener(context),
behavior: HitTestBehavior.opaque,
child: Container(
decoration: BoxDecoration(
/// 背景颜色
color: HexColor.fromHex(_upgradeTipModel?.bg_color ?? '#FFEFDA'),
color: HexColor.fromHex(_model?.bulletinBgColor ?? '#FFEFDA'),
borderRadius: BorderRadius.circular(30),
),
padding: const EdgeInsets.only(left: 10, right: 13, top: 10, bottom: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
_geLeftWidget(_upgradeTipModel),
_getRightWidget(_upgradeTipModel),
_geLeftWidget(_model),
_getRightWidget(_model),
],
),
),
@@ -68,14 +78,14 @@ class UpgradeTipWidget extends StatelessWidget {
const SizedBox(width: 7.5),

/// 文字
Text(model?.text ?? '下载APP升级运营商,享受更多收益', style: TextStyle(color: HexColor.fromHex(model?.text_color ?? '#C09023'), fontSize: 11))
Text(model?.bulletinText ?? '下载APP升级运营商,享受更多收益', style: TextStyle(color: HexColor.fromHex(model?.bulletinTextColor ?? '#C09023'), fontSize: 11))
],
);
}

/// 右边的视图
Widget _getRightWidget(UpgradeTipModel model) {
return Text(model?.go_text ?? '前往下载', style: TextStyle(color: HexColor.fromHex(model?.go_text_color ?? '#C09023'), fontSize: 11));
return Text(model?.goText ?? '前往下载', style: TextStyle(color: HexColor.fromHex(model?.bulletinTextColor ?? '#C09023'), fontSize: 11));
// return Row(
// children: <Widget>[
// Text(model?.go_text ??'前往下载', style: TextStyle(color: HexColor.fromHex('#C09023'), fontSize: 11)),


Зареждане…
Отказ
Запис