Bladeren bron

修复首页列表数据格式错误问题

tags/0.0.1
Weller 4 jaren geleden
bovenliggende
commit
d51f35aed3
12 gewijzigde bestanden met toevoegingen van 571 en 662 verwijderingen
  1. +1
    -1
      .dart_tool/package_config.json
  2. +6
    -3
      lib/pages/goods_share_page/goods_share_editor/goods_share_editor.dart
  3. +48
    -49
      lib/pages/goods_share_page/goods_share_image/goods_share_image.dart
  4. +20
    -6
      lib/pages/goods_share_page/goods_share_link/goods_share_link.dart
  5. +3
    -5
      lib/widgets/goods_details/recommend/goods_detail_commend_creater.dart
  6. +36
    -44
      lib/widgets/goods_details/recommend/goods_detail_commend_list.dart
  7. +40
    -24
      lib/widgets/home/home_goods/home_goods_header.dart
  8. +62
    -38
      lib/widgets/home/home_goods/home_goods_item.dart
  9. +70
    -46
      lib/widgets/home/home_goods/home_goods_item_single.dart
  10. +5
    -17
      lib/widgets/home/home_goods/models/home_goods_header_model.dart
  11. +229
    -0
      lib/widgets/home/home_goods/models/home_goods_list_style_model.dart
  12. +51
    -429
      lib/widgets/home/home_goods/models/home_goods_style_model.dart

+ 1
- 1
.dart_tool/package_config.json Bestand weergeven

@@ -614,7 +614,7 @@
"languageVersion": "2.1"
}
],
"generated": "2020-10-13T08:45:20.936142Z",
"generated": "2020-10-14T02:50:46.733318Z",
"generator": "pub",
"generatorVersion": "2.8.2"
}

+ 6
- 3
lib/pages/goods_share_page/goods_share_editor/goods_share_editor.dart Bestand weergeven

@@ -1,9 +1,14 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:zhiying_base_widget/pages/goods_share_page/goods_share_editor/goods_share_preview.dart';
import 'package:zhiying_base_widget/pages/goods_share_page/goods_share_image/goods_share_image_model.dart';
import 'package:zhiying_comm/zhiying_comm.dart';

class GoodsShareEditor extends StatefulWidget {
final GoodsShareImageModel style;

const GoodsShareEditor(this.style, {Key key}) : super(key: key);

@override
_GoodsShareEditorState createState() => _GoodsShareEditorState();
}
@@ -13,9 +18,7 @@ class _GoodsShareEditorState extends State<GoodsShareEditor> {

@override
void initState() {
_controller = TextEditingController(
text:
'{标题}\n原价】{原价}元\n【券后价】{券后价}元\n【用嗨如意再省】{补贴省}元\n -------------\n 復製{淘口令},\n 用【Tao·寳】下单\n -------------\n 【商品链接】\n {商品链接}');
_controller = TextEditingController(text: widget.style?.content ?? '');
super.initState();
}



+ 48
- 49
lib/pages/goods_share_page/goods_share_image/goods_share_image.dart Bestand weergeven

@@ -8,6 +8,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:save_image/save_image.dart';
import 'package:zhiying_base_widget/pages/goods_share_page/goods_share_editor/goods_share_editor.dart';
import 'package:zhiying_base_widget/pages/goods_share_page/goods_share_image/goods_share_image_model.dart';
@@ -24,8 +25,6 @@ import 'package:zhiying_base_widget/widgets/public/custom_button/custom_button_m
import 'package:zhiying_base_widget/widgets/share/models/share_data_model.dart';
import 'package:zhiying_base_widget/widgets/share/share_alert.dart';

import 'package:permission_handler/permission_handler.dart';

class GoodsShareImage extends StatefulWidget {
final Map<String, dynamic> model;
final GoodsShareTempDataModel datas;
@@ -83,8 +82,10 @@ class _GoodsShareImageState extends State<GoodsShareImage>
onEditorClick: () {
Fluttertoast.showToast(msg: '正在开发中');
return;
Navigator.push(context,
MaterialPageRoute(builder: (context) => GoodsShareEditor()));
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => GoodsShareEditor(_style)));
},
onTempChange: (temp) {
setState(() {
@@ -197,51 +198,51 @@ class _GoodsShareImageState extends State<GoodsShareImage>
btnCopy == null
? Container()
: GestureDetector(
child: Container(
width: 95,
height: 36,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(18),
child: Container(
width: 95,
height: 36,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(18),
),
child: CustomButton(btnCopy)),
onTap: () {
Clipboard.setData(ClipboardData(text: _content));
Fluttertoast.showToast(msg: '文案已复制');
},
),
child: CustomButton(btnCopy)),
onTap: () {
Clipboard.setData(ClipboardData(text: _content));
Fluttertoast.showToast(msg: '文案已复制');
},
),
btnSave == null
? Container()
: GestureDetector(
child: Container(
margin: EdgeInsets.only(left: 5),
width: 95,
height: 36,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(18),
),
child: CustomButton(btnSave),
),
onTap: () {
_saveImages();
},
),
child: Container(
margin: EdgeInsets.only(left: 5),
width: 95,
height: 36,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(18),
),
child: CustomButton(btnSave),
),
onTap: () {
_saveImages();
},
),
btnShare == null
? Container()
: Expanded(
child: GestureDetector(
child: Container(
margin: EdgeInsets.only(left: 5),
// width: 95,
height: 36,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(18),
child: GestureDetector(
child: Container(
margin: EdgeInsets.only(left: 5),
// width: 95,
height: 36,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(18),
),
child: CustomButton(btnShare)),
onTap: () {
_showShareAlert();
},
),
child: CustomButton(btnShare)),
onTap: () {
_showShareAlert();
},
),
),
),
],
),
),
@@ -289,7 +290,6 @@ class _GoodsShareImageState extends State<GoodsShareImage>
return null;
}


bool isSaveSuccess = false;
if (_shareModel.poster != null) {
isSaveSuccess = await SaveImage.save(imageBytes: _shareModel.poster);
@@ -314,7 +314,7 @@ class _GoodsShareImageState extends State<GoodsShareImage>
ui.Image image = await boundary.toImage(pixelRatio: 2.0);
// 注意:png是压缩后格式,如果需要图片的原始像素数据,请使用rawRgba
ByteData byteData =
await image.toByteData(format: ui.ImageByteFormat.png);
await image.toByteData(format: ui.ImageByteFormat.png);
Uint8List pngBytes = byteData.buffer.asUint8List();
_shareModel.poster = pngBytes;
}
@@ -351,12 +351,11 @@ class _GoodsShareImageState extends State<GoodsShareImage>

showCupertinoModalPopup(
context: context,
builder: (context) =>
ShareAlert(
_shareModel,
'pub.flutter.share_icon',
// child: GoodsShareAlertContent(),
),
builder: (context) => ShareAlert(
_shareModel,
'pub.flutter.share_icon',
// child: GoodsShareAlertContent(),
),
);
}
}

+ 20
- 6
lib/pages/goods_share_page/goods_share_link/goods_share_link.dart Bestand weergeven

@@ -2,6 +2,7 @@ import 'dart:convert' as convert;

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:zhiying_base_widget/pages/goods_share_page/goods_share_editor/goods_share_editor.dart';
import 'package:zhiying_base_widget/pages/goods_share_page/goods_share_image/goods_share_image_model.dart';
@@ -32,6 +33,8 @@ class _GoodsShareLinkState extends State<GoodsShareLink>
GoodsShareImageModel _style;
Map<int, String> _images = Map();
List<Widget> widgets = List();
String _content = '';
bool _isContentSelected = false;

// 分享数据
final ShareDataModel _shareModel = ShareDataModel();
@@ -45,6 +48,7 @@ class _GoodsShareLinkState extends State<GoodsShareLink>
String data = widget.model['data'];
var d = convert.jsonDecode(data);
_style = GoodsShareImageModel.fromJson(Map<String, dynamic>.from(d));
_content = widget.datas.shareContent;
super.initState();
}

@@ -68,22 +72,32 @@ class _GoodsShareLinkState extends State<GoodsShareLink>
imgHeader: _style.cssList.headerImage,
imgCheck: _style.cssList.unChooseImage,
imgCheckSelected: _style.cssList.chooseImage,
enabled: false,
child: GoodsShareEdit(
_style.content,
_content,
widget.datas,
imgCheck: _style.cssList.unChooseImage,
imgCheckSelected: _style.cssList.chooseImage,
onCopyClick: () {
Fluttertoast.showToast(msg: '复制成功');
Clipboard.setData(ClipboardData(text: _content));
Fluttertoast.showToast(msg: '文案已复制');
},
onEditorClick: () {
Fluttertoast.showToast(msg: '正在开发中');
return;
Navigator.push(context,
MaterialPageRoute(builder: (context) => GoodsShareEditor()));
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => GoodsShareEditor(_style)));
},
onTempChange: (temp) {
setState(() {
_content = widget.datas.shareContent + temp;
});
},
),
onSelected: (isSelected) {
_shareModel.content = isSelected ? '' : _style.content;
_isContentSelected = isSelected;
// _shareModel.content = isSelected ? _content : '';
},
));
for (String message in _style.customContent) {


+ 3
- 5
lib/widgets/goods_details/recommend/goods_detail_commend_creater.dart Bestand weergeven

@@ -29,11 +29,9 @@ class GoodsDetailCommendCreater extends WidgetCreater {
SliverToBoxAdapter(
child: GoodsDetailsRecommendWidget(model),
),
SliverToBoxAdapter(
child: GoodsDetailCommendList(
model,
provider: style.recType, // 猜你喜欢数据源暂无数据
),
GoodsDetailCommendList(
model,
provider: 'taobao', // 猜你喜欢数据源暂无数据
),
];
}


+ 36
- 44
lib/widgets/goods_details/recommend/goods_detail_commend_list.dart Bestand weergeven

@@ -51,7 +51,6 @@ class _GoodsDetailCommendListContainer extends StatefulWidget {
class _GoodsDetailCommendListContainerState
extends State<_GoodsDetailCommendListContainer> {
HomeGoodsBloc _bloc;
String _provider = '';
HomeGoodsStyleModel _style;

@override
@@ -72,12 +71,10 @@ class _GoodsDetailCommendListContainerState
super.didChangeDependencies();
print('didChangeDependencies');
bool isNeedLoadMore =
Provider
.of<GoodsDetailsPageNotifier>(context)
.scrollEnd;
if (isNeedLoadMore && _provider != '') {
Provider.of<GoodsDetailsPageNotifier>(context).scrollEnd;
if (isNeedLoadMore && widget.provider != '') {
print('HomeGoods loadmore...');
_bloc.loadMore(_provider);
_bloc.loadMore(widget.provider);
}
}

@@ -86,47 +83,42 @@ class _GoodsDetailCommendListContainerState
return StreamBuilder<List<HomeGoodsModel>>(
stream: _bloc.outData,
builder: (BuildContext context, AsyncSnapshot snapshot) {
// if (snapshot.data == null) {
// return Container();
// }

List<HomeGoodsModel> goods = snapshot.data;
int column = 2;
int count = ((goods?.length ?? 0) / column).ceil();
return SliverList(
delegate: SliverChildBuilderDelegate((context, index) {
if (column == 1) {
return HomeGoodsItemSingle(
goods[index],
_style,
data: widget.data,
);
} else {
// return Container(color: Colors.red, height: 126,margin: EdgeInsets.all(10),);
return Padding(
padding: const EdgeInsets.only(left: 5, right: 5),
child: Row(
children: List.generate(column, (c) {
int i = index * column + c;
return Expanded(
child: i < goods.length
? HomeGoodsItem(
goods[i],
_style,
data: widget.data,
)
: Container(),
);
}).toList(),
),
);
}
}, childCount
:
count
,
),);
}
);
delegate: SliverChildBuilderDelegate(
(context, index) {
if (column == 1) {
return HomeGoodsItemSingle(
goods[index],
_style,
data: widget.data,
);
} else {
// return Container(color: Colors.red, height: 126,margin: EdgeInsets.all(10),);
return Padding(
padding: const EdgeInsets.only(left: 5, right: 5),
child: Row(
children: List.generate(column, (c) {
int i = index * column + c;
return Expanded(
child: i < goods.length
? HomeGoodsItem(
goods[i],
_style,
data: widget.data,
)
: Container(),
);
}).toList(),
),
);
}
},
childCount: count,
),
);
});
}
}

+ 40
- 24
lib/widgets/home/home_goods/home_goods_header.dart Bestand weergeven

@@ -1,4 +1,5 @@
import 'dart:convert' as convert;
import 'dart:ui' as ui;

import 'package:event_bus/event_bus.dart';
import 'package:flutter/cupertino.dart';
@@ -77,7 +78,7 @@ class _HomeGoodsHeaderState extends State<_HomeGoodsHeader>
_style = HomeGoodsStyleModel.fromJson(Map<String, dynamic>.from(json));

_tabController =
TabController(length: _style?.recommendList?.length?? 0, vsync: this);
TabController(length: _style?.recommendList?.length ?? 0, vsync: this);
if (_style.recommendList.first != null) {
widget.eventBus
.fire(HomeGoodsHeaderEvent(_style.recommendList.first.type));
@@ -88,10 +89,19 @@ class _HomeGoodsHeaderState extends State<_HomeGoodsHeader>
@override
Widget build(BuildContext context) {
_widgets.clear();

for (int index = 0; index < _style.recommendList.length; index++) {
_widgets.add(_HomeGoodsHeaderItem(
_style.recommendList[index],
isSelected: index == _currentIndex,
titleTextColor: index == _currentIndex
? (HexColor.fromHex(_style.tilteTextSelectedColor ?? '#FF4242'))
: (HexColor.fromHex(_style.tilteTextColor ?? '#333333')),
subtitleTextColor: index == _currentIndex
? (HexColor.fromHex(_style.subtitleTextSelectedColor ?? '#ffffff'))
: (HexColor.fromHex(_style.subtitleTextColor ?? '#999999')),
subtitleBgColor: index == _currentIndex
? HexColor.fromHex(_style.subtitleBgColor ?? '#FF4242')
: Colors.transparent,
));
}

@@ -117,11 +127,18 @@ class _HomeGoodsHeaderState extends State<_HomeGoodsHeader>
}

class _HomeGoodsHeaderItem extends StatelessWidget {
final bool isSelected;
final HomeGoodsHeaderModel model;
final ui.Color titleTextColor;
final ui.Color subtitleTextColor;
final ui.Color subtitleBgColor;

const _HomeGoodsHeaderItem(this.model, {Key key, this.isSelected = false})
: super(key: key);
const _HomeGoodsHeaderItem(
this.model, {
Key key,
this.titleTextColor,
this.subtitleBgColor,
this.subtitleTextColor,
}) : super(key: key);

@override
Widget build(BuildContext context) {
@@ -135,28 +152,27 @@ class _HomeGoodsHeaderItem extends StatelessWidget {
Text(
model.title,
style: TextStyle(
color: HexColor.fromHex(model.tilteTextColor),
color: titleTextColor ?? ui.Color(0xff333333),
fontSize: 17,
fontWeight: FontWeight.bold),
),
Container(
margin: EdgeInsets.only(top: 4),
padding: EdgeInsets.only(left: 6, right: 6, top: 2, bottom: 2),
decoration: BoxDecoration(
color: isSelected
? HexColor.fromHex(model.subtitleBgColor)
: Colors.transparent,
borderRadius: BorderRadius.circular(18)),
child: Text(
model.subtitle,
style: TextStyle(
fontSize: 10,
color: isSelected
? HexColor.fromHex(model.subtitleTextColor)
: Color(0xff999999)),
textAlign: TextAlign.center,
),
),
model.subtitle == null || model.subtitle == ''
? Container()
: Container(
margin: EdgeInsets.only(top: 4),
padding:
EdgeInsets.only(left: 6, right: 6, top: 2, bottom: 2),
decoration: BoxDecoration(
color: subtitleBgColor ?? Colors.transparent,
borderRadius: BorderRadius.circular(18)),
child: Text(
model.subtitle ?? '',
style: TextStyle(
fontSize: 10,
color: subtitleTextColor ?? Color(0xff999999)),
textAlign: TextAlign.center,
),
),
],
),
));


+ 62
- 38
lib/widgets/home/home_goods/home_goods_item.dart Bestand weergeven

@@ -4,6 +4,7 @@ import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:zhiying_base_widget/pages/goods_details_page/goods_details_page.dart';
import 'package:zhiying_base_widget/widgets/home/home_goods/models/home_goods_list_style_model.dart';
import 'package:zhiying_base_widget/widgets/home/home_goods/models/home_goods_model.dart';
import 'package:zhiying_base_widget/widgets/home/home_goods/models/home_goods_style_model.dart';
import 'package:zhiying_comm/zhiying_comm.dart';
@@ -14,7 +15,8 @@ class HomeGoodsItem extends StatelessWidget {
final HomeGoodsStyleModel style;
Map<String, dynamic> data;

HomeGoodsItem(this.goods, this.style, {Key key, this.data}) : super(key: key) {
HomeGoodsItem(this.goods, this.style, {Key key, this.data})
: super(key: key) {
if (this.data != null && this.data.containsKey('data')) {
String data = this.data['data'];
Map<String, dynamic> json = Map<String, dynamic>.from(jsonDecode(data));
@@ -24,7 +26,8 @@ class HomeGoodsItem extends StatelessWidget {

/// 跳到商品详情
void _onJumpGoodsDetails(BuildContext context, HomeGoodsModel goods) {
Navigator.push(context, CupertinoPageRoute(builder: (_) => GoodsDetailsPage(goods.toJson())));
Navigator.push(context,
CupertinoPageRoute(builder: (_) => GoodsDetailsPage(goods.toJson())));
}

@override
@@ -33,7 +36,9 @@ class HomeGoodsItem extends StatelessWidget {
onTap: () => _onJumpGoodsDetails(context, goods),
child: Container(
margin: EdgeInsets.only(top: 4, bottom: 4, left: 5, right: 5),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(7.5))),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(7.5))),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
@@ -41,9 +46,11 @@ class HomeGoodsItem extends StatelessWidget {
width: double.infinity,
margin: EdgeInsets.only(right: 0),
child: ClipRRect(
borderRadius: BorderRadius.only(topLeft: Radius.circular(7.5), topRight: Radius.circular(7.5)),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(7.5),
topRight: Radius.circular(7.5)),
child: CachedNetworkImage(
imageUrl: goods.goodImage,
imageUrl: goods?.goodImage ?? '',
fit: BoxFit.fitWidth,
),
),
@@ -76,10 +83,10 @@ class HomeGoodsItem extends StatelessWidget {
List<InlineSpan> list = List();
if (goods.providerName != null && goods.providerName != '') {
HomeGoodsStyleModelProviders providers;
int providersLength = style?.providers?.length ?? 0;
if(providersLength > 0) {
for (int i = 0; i < style.providers.length; i++) {
HomeGoodsStyleModelProviders item = style.providers[i];
int providersLength = style?.listStyle?.providers?.length ?? 0;
if (providersLength > 0) {
for (int i = 0; i < style?.listStyle?.providers?.length; i++) {
HomeGoodsStyleModelProviders item = style?.listStyle?.providers[i];
if (goods.provider == item.type) {
providers = item;
break;
@@ -109,7 +116,10 @@ class HomeGoodsItem extends StatelessWidget {
}
list.add(TextSpan(
text: goods.goodTitle,
style: TextStyle(fontSize: 15, color: HexColor.fromHex('#333333'), fontWeight: FontWeight.bold),
style: TextStyle(
fontSize: 15,
color: HexColor.fromHex('#333333'),
fontWeight: FontWeight.bold),
));
return RichText(
maxLines: 2,
@@ -129,7 +139,7 @@ class HomeGoodsItem extends StatelessWidget {
height: 15,
margin: EdgeInsets.only(right: 2),
child: CachedNetworkImage(
imageUrl: style.shopIcon,
imageUrl: style?.listStyle?.shopIcon ?? '',
fit: BoxFit.fitHeight,
),
),
@@ -137,7 +147,10 @@ class HomeGoodsItem extends StatelessWidget {
child: Text(
goods.shopName,
maxLines: 1,
style: TextStyle(color: HexColor.fromHex(style.shopNameColor), fontSize: 11, fontWeight: FontWeight.w400),
style: TextStyle(
color: HexColor.fromHex(style?.listStyle?.shopNameColor),
fontSize: 11,
fontWeight: FontWeight.w400),
))
],
),
@@ -147,15 +160,18 @@ class HomeGoodsItem extends StatelessWidget {
Widget _createCupone() {
List<Widget> widgets = List();
if (goods.coupon != null && goods.coupon != '') {
var couponDe = style?.couponCommission?.coupon?.isImg == '1'
var couponDe = style?.listStyle?.couponCommission?.coupon?.isImg == '1'
? BoxDecoration(
image: DecorationImage(
image: CachedNetworkImageProvider(style?.couponCommission?.coupon?.couponBgImg ?? ''),
image: CachedNetworkImageProvider(
style?.listStyle?.couponCommission?.coupon?.couponBgImg ??
''),
),
borderRadius: BorderRadius.circular(2.5),
)
: BoxDecoration(
color: HexColor.fromHex(style?.couponCommission?.coupon?.couponBgColor),
color: HexColor.fromHex(
style?.listStyle?.couponCommission?.coupon?.couponBgColor),
borderRadius: BorderRadius.circular(2.5),
);

@@ -186,15 +202,18 @@ class HomeGoodsItem extends StatelessWidget {
style: TextStyle(
height: 1,
fontSize: 11,
color: HexColor.fromHex(style?.couponCommission?.coupon?.couponFontColor),
color: HexColor.fromHex(style
?.listStyle?.couponCommission?.coupon?.couponFontColor),
),
children: [
TextSpan(
text: '${style?.couponCommission?.coupon?.couonText ?? '元劵'}',
text:
'${style?.listStyle?.couponCommission?.coupon?.couonText ?? '元劵'}',
style: TextStyle(
height: 1,
fontSize: 11,
color: HexColor.fromHex(style?.couponCommission?.coupon?.couponFontColor),
color: HexColor.fromHex(style
?.listStyle?.couponCommission?.coupon?.couponFontColor),
),
)
]),
@@ -203,18 +222,21 @@ class HomeGoodsItem extends StatelessWidget {
}

if (goods.commission != null || goods.commission != '') {

var commissionDe = style?.couponCommission?.commission?.isImg == '1'
? BoxDecoration(
image: DecorationImage(
image: CachedNetworkImageProvider(style?.couponCommission?.commission?.commissionBgImg ?? ''),
),
borderRadius: BorderRadius.circular(2.5),
)
: BoxDecoration(
color: HexColor.fromHex(style?.couponCommission?.commission?.commissionBgColor),
borderRadius: BorderRadius.circular(2.5),
);
var commissionDe =
style?.listStyle?.couponCommission?.commission?.isImg == '1'
? BoxDecoration(
image: DecorationImage(
image: CachedNetworkImageProvider(style?.listStyle
?.couponCommission?.commission?.commissionBgImg ??
''),
),
borderRadius: BorderRadius.circular(2.5),
)
: BoxDecoration(
color: HexColor.fromHex(style?.listStyle?.couponCommission
?.commission?.commissionBgColor),
borderRadius: BorderRadius.circular(2.5),
);

widgets.add(Container(
margin: EdgeInsets.only(right: 5),
@@ -228,11 +250,13 @@ class HomeGoodsItem extends StatelessWidget {
maxLines: 1,
textAlign: TextAlign.center,
text: TextSpan(
text: '${style?.couponCommission?.commission?.commissionText ?? ''}',
text:
'${style?.listStyle?.couponCommission?.commission?.commissionText ?? ''}',
style: TextStyle(
height: 1,
fontSize: 11,
color: HexColor.fromHex(style?.couponCommission?.commission?.commissionFontColor),
color: HexColor.fromHex(style?.listStyle?.couponCommission
?.commission?.commissionFontColor),
),
children: [
TextSpan(
@@ -240,11 +264,11 @@ class HomeGoodsItem extends StatelessWidget {
style: TextStyle(
height: 1,
fontSize: 11,
color: HexColor.fromHex(style?.couponCommission?.commission?.commissionFontColor),
color: HexColor.fromHex(style?.listStyle?.couponCommission
?.commission?.commissionFontColor),
),
)
]
),
]),
),
));
}
@@ -278,7 +302,7 @@ class HomeGoodsItem extends StatelessWidget {
text: '¥',
style: TextStyle(
fontSize: 10,
color: HexColor.fromHex(style.currentPriceColor),
color: HexColor.fromHex(style?.listStyle?.currentPriceColor),
fontWeight: FontWeight.bold,
fontFamily: 'Din',
package: 'zhiying_base_widget',
@@ -288,7 +312,7 @@ class HomeGoodsItem extends StatelessWidget {
text: goods.currentPrice,
style: TextStyle(
fontSize: 20,
color: HexColor.fromHex(style.currentPriceColor),
color: HexColor.fromHex(style?.listStyle?.currentPriceColor),
fontWeight: FontWeight.bold,
fontFamily: 'Din',
package: 'zhiying_base_widget',
@@ -306,7 +330,7 @@ class HomeGoodsItem extends StatelessWidget {
style: TextStyle(
fontSize: 11,
height: 1,
color: HexColor.fromHex(style.marketPriceColor),
color: HexColor.fromHex(style?.listStyle?.marketPriceColor),
fontWeight: FontWeight.normal,
fontFamily: 'Din',
package: 'zhiying_base_widget',


+ 70
- 46
lib/widgets/home/home_goods/home_goods_item_single.dart Bestand weergeven

@@ -4,6 +4,7 @@ import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:zhiying_base_widget/pages/goods_details_page/goods_details_page.dart';
import 'package:zhiying_base_widget/widgets/home/home_goods/models/home_goods_list_style_model.dart';
import 'package:zhiying_base_widget/widgets/home/home_goods/models/home_goods_model.dart';
import 'package:zhiying_base_widget/widgets/home/home_goods/models/home_goods_style_model.dart';
import 'package:zhiying_comm/zhiying_comm.dart';
@@ -14,7 +15,8 @@ class HomeGoodsItemSingle extends StatelessWidget {
final HomeGoodsStyleModel style;
Map<String, dynamic> data;

HomeGoodsItemSingle(this.goods, this.style, {Key key, this.data}) : super(key: key) {
HomeGoodsItemSingle(this.goods, this.style, {Key key, this.data})
: super(key: key) {
if (this.data != null && this.data.containsKey('data')) {
String data = this.data['data'];
Map<String, dynamic> json = Map<String, dynamic>.from(jsonDecode(data));
@@ -24,7 +26,8 @@ class HomeGoodsItemSingle extends StatelessWidget {

/// 跳到商品详情
void _onJumpGoodsDetails(BuildContext context, HomeGoodsModel goods) {
Navigator.push(context, CupertinoPageRoute(builder: (_) => GoodsDetailsPage(goods.toJson())));
Navigator.push(context,
CupertinoPageRoute(builder: (_) => GoodsDetailsPage(goods.toJson())));
}

@override
@@ -34,7 +37,9 @@ class HomeGoodsItemSingle extends StatelessWidget {
child: Container(
margin: EdgeInsets.only(left: 12.5, right: 12.5, top: 4, bottom: 4),
padding: EdgeInsets.all(7.5),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(7.5))),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(7.5))),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
@@ -79,10 +84,10 @@ class HomeGoodsItemSingle extends StatelessWidget {
List<InlineSpan> list = List();
if (goods.providerName != null && goods.providerName != '') {
HomeGoodsStyleModelProviders providers;
int providersLength = style?.providers?.length ?? 0;
int providersLength = style?.listStyle?.providers?.length ?? 0;
if (providersLength > 0) {
for (int i = 0; i < style?.providers?.length ?? 0; i++) {
HomeGoodsStyleModelProviders item = style.providers[i];
for (int i = 0; i < style?.listStyle?.providers?.length ?? 0; i++) {
HomeGoodsStyleModelProviders item = style.listStyle?.providers[i];
if (goods.provider == item.type) {
providers = item;
break;
@@ -112,7 +117,10 @@ class HomeGoodsItemSingle extends StatelessWidget {
}
list.add(TextSpan(
text: goods.goodTitle,
style: TextStyle(fontSize: 15, color: HexColor.fromHex('#333333'), fontWeight: FontWeight.bold),
style: TextStyle(
fontSize: 15,
color: HexColor.fromHex('#333333'),
fontWeight: FontWeight.bold),
));
return RichText(
maxLines: 2,
@@ -132,7 +140,7 @@ class HomeGoodsItemSingle extends StatelessWidget {
height: 15,
margin: EdgeInsets.only(right: 2),
child: CachedNetworkImage(
imageUrl: style.shopIcon,
imageUrl: style?.listStyle?.shopIcon ?? '',
fit: BoxFit.fitHeight,
),
),
@@ -140,7 +148,11 @@ class HomeGoodsItemSingle extends StatelessWidget {
child: Text(
goods.shopName,
maxLines: 1,
style: TextStyle(color: HexColor.fromHex(style.shopNameColor), fontSize: 11, fontWeight: FontWeight.w400),
style: TextStyle(
color: HexColor.fromHex(
style?.listStyle?.shopNameColor ?? '#666666'),
fontSize: 11,
fontWeight: FontWeight.w400),
))
],
),
@@ -150,15 +162,18 @@ class HomeGoodsItemSingle extends StatelessWidget {
Widget _createCupone() {
List<Widget> widgets = List();
if (goods.coupon != null && goods.coupon != '') {
var couponDe = style?.couponCommission?.coupon?.isImg == '1'
var couponDe = style?.listStyle?.couponCommission?.coupon?.isImg == '1'
? BoxDecoration(
image: DecorationImage(
image: CachedNetworkImageProvider(style?.couponCommission?.coupon?.couponBgImg ?? ''),
image: CachedNetworkImageProvider(
style?.listStyle?.couponCommission?.coupon?.couponBgImg ??
''),
),
borderRadius: BorderRadius.circular(2.5),
)
: BoxDecoration(
color: HexColor.fromHex(style?.couponCommission?.coupon?.couponBgColor),
color: HexColor.fromHex(
style?.listStyle?.couponCommission?.coupon?.couponBgColor),
borderRadius: BorderRadius.circular(2.5),
);

@@ -190,15 +205,18 @@ class HomeGoodsItemSingle extends StatelessWidget {
style: TextStyle(
height: 1,
fontSize: 11,
color: HexColor.fromHex(style?.couponCommission?.coupon?.couponFontColor),
color: HexColor.fromHex(style
?.listStyle?.couponCommission?.coupon?.couponFontColor),
),
children: [
TextSpan(
text: '${style?.couponCommission?.coupon?.couonText ?? '元劵'}',
text:
'${style?.listStyle?.couponCommission?.coupon?.couonText ?? '元劵'}',
style: TextStyle(
height: 1,
fontSize: 11,
color: HexColor.fromHex(style?.couponCommission?.coupon?.couponFontColor),
color: HexColor.fromHex(style
?.listStyle?.couponCommission?.coupon?.couponFontColor),
),
)
]),
@@ -207,17 +225,21 @@ class HomeGoodsItemSingle extends StatelessWidget {
}

if (goods.commission != null || goods.commission != '') {
var commissionDe = style?.couponCommission?.commission?.isImg == '1'
? BoxDecoration(
image: DecorationImage(
image: CachedNetworkImageProvider(style?.couponCommission?.commission?.commissionBgImg ?? ''),
),
borderRadius: BorderRadius.circular(2.5),
)
: BoxDecoration(
color: HexColor.fromHex(style?.couponCommission?.commission?.commissionBgColor),
borderRadius: BorderRadius.circular(2.5),
);
var commissionDe =
style?.listStyle?.couponCommission?.commission?.isImg == '1'
? BoxDecoration(
image: DecorationImage(
image: CachedNetworkImageProvider(style?.listStyle
?.couponCommission?.commission?.commissionBgImg ??
''),
),
borderRadius: BorderRadius.circular(2.5),
)
: BoxDecoration(
color: HexColor.fromHex(style?.listStyle?.couponCommission
?.commission?.commissionBgColor),
borderRadius: BorderRadius.circular(2.5),
);

widgets.add(
Container(
@@ -243,23 +265,25 @@ class HomeGoodsItemSingle extends StatelessWidget {
maxLines: 1,
textAlign: TextAlign.center,
text: TextSpan(
text: '${style?.couponCommission?.commission?.commissionText ?? ''}',
style: TextStyle(
height: 1,
fontSize: 11,
color: HexColor.fromHex(style?.couponCommission?.commission?.commissionFontColor),
),
children: [
TextSpan(
text: '${goods?.commission ?? '0'}',
style: TextStyle(
height: 1,
fontSize: 11,
color: HexColor.fromHex(style?.couponCommission?.commission?.commissionFontColor),
),
)
]
),
text:
'${style?.listStyle?.couponCommission?.commission?.commissionText ?? ''}',
style: TextStyle(
height: 1,
fontSize: 11,
color: HexColor.fromHex(style?.listStyle?.couponCommission
?.commission?.commissionFontColor),
),
children: [
TextSpan(
text: '${goods?.commission ?? '0'}',
style: TextStyle(
height: 1,
fontSize: 11,
color: HexColor.fromHex(style?.listStyle?.couponCommission
?.commission?.commissionFontColor),
),
)
]),
),
),
);
@@ -296,7 +320,7 @@ class HomeGoodsItemSingle extends StatelessWidget {
text: '¥',
style: TextStyle(
fontSize: 10,
color: HexColor.fromHex(style.currentPriceColor),
color: HexColor.fromHex(style?.listStyle?.currentPriceColor),
fontWeight: FontWeight.bold,
fontFamily: 'Din',
package: 'zhiying_base_widget',
@@ -306,7 +330,7 @@ class HomeGoodsItemSingle extends StatelessWidget {
text: goods.currentPrice,
style: TextStyle(
fontSize: 20,
color: HexColor.fromHex(style.currentPriceColor),
color: HexColor.fromHex(style?.listStyle?.currentPriceColor),
fontWeight: FontWeight.bold,
fontFamily: 'Din',
package: 'zhiying_base_widget',
@@ -324,7 +348,7 @@ class HomeGoodsItemSingle extends StatelessWidget {
style: TextStyle(
fontSize: 11,
height: 1,
color: HexColor.fromHex(style.marketPriceColor),
color: HexColor.fromHex(style?.listStyle?.marketPriceColor),
fontWeight: FontWeight.normal,
fontFamily: 'Din',
package: 'zhiying_base_widget',


+ 5
- 17
lib/widgets/home/home_goods/models/home_goods_header_model.dart Bestand weergeven

@@ -2,25 +2,17 @@ class HomeGoodsHeaderModel {
String type;
String title;
String subtitle;
String tilteTextColor;
String subtitleBgColor;
String subtitleTextColor;

HomeGoodsHeaderModel(
{this.type,
this.title,
this.subtitle,
this.tilteTextColor,
this.subtitleBgColor,
this.subtitleTextColor});
HomeGoodsHeaderModel({
this.type,
this.title,
this.subtitle,
});

HomeGoodsHeaderModel.fromJson(Map<String, dynamic> json) {
type = json['type'];
title = json['title'];
subtitle = json['subtitle'];
tilteTextColor = json['tilte_text_color'];
subtitleBgColor = json['subtitle_bg_color'];
subtitleTextColor = json['subtitle_text_color'];
}

Map<String, dynamic> toJson() {
@@ -28,10 +20,6 @@ class HomeGoodsHeaderModel {
data['type'] = this.type;
data['title'] = this.title;
data['subtitle'] = this.subtitle;
data['tilte_text_color'] = this.tilteTextColor;
data['subtitle_bg_color'] = this.subtitleBgColor;
data['subtitle_text_color'] = this.subtitleTextColor;
return data;
}
}


+ 229
- 0
lib/widgets/home/home_goods/models/home_goods_list_style_model.dart Bestand weergeven

@@ -0,0 +1,229 @@
class HomeGoodsListStyleModel {
List<String> hotRankIconList;
String topMargin;
String leftRighMargin;
List<HomeGoodsStyleModelProviders> providers;
String titleColor;
String currentPriceColor;
String marketPriceColor;
String shopNameColor;
String saleCountColor;
String saleCountText;
String shopIcon;
HomeGoodsStyleModelCouponCommission couponCommission;
HomeGoodsStyleModelHotRank hotRank;

HomeGoodsListStyleModel(
{this.hotRankIconList,
this.topMargin,
this.leftRighMargin,
this.providers,
this.titleColor,
this.currentPriceColor,
this.marketPriceColor,
this.shopNameColor,
this.saleCountColor,
this.saleCountText,
this.shopIcon,
this.couponCommission,
this.hotRank});

HomeGoodsListStyleModel.fromJson(Map<String, dynamic> json) {
hotRankIconList = json['hot_rank_icon_list'].cast<String>();
topMargin = json['top_margin'];
leftRighMargin = json['left_righ_margin'];
if (json['providers'] != null) {
providers = new List<HomeGoodsStyleModelProviders>();
json['providers'].forEach((v) {
providers.add(new HomeGoodsStyleModelProviders.fromJson(v));
});
}
titleColor = json['title_color'];
currentPriceColor = json['current_price_color'];
marketPriceColor = json['market_price_color'];
shopNameColor = json['shop_name_color'];
saleCountColor = json['sale_count_color'];
saleCountText = json['sale_count_text'];
shopIcon = json['shop_icon'];
couponCommission = json['coupon_commission'] != null
? new HomeGoodsStyleModelCouponCommission.fromJson(
json['coupon_commission'])
: null;
hotRank = json['hot_rank'] != null
? new HomeGoodsStyleModelHotRank.fromJson(json['hot_rank'])
: null;
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['hot_rank_icon_list'] = this.hotRankIconList;
data['top_margin'] = this.topMargin;
data['left_righ_margin'] = this.leftRighMargin;
if (this.providers != null) {
data['providers'] = this.providers.map((v) => v.toJson()).toList();
}
data['title_color'] = this.titleColor;
data['current_price_color'] = this.currentPriceColor;
data['market_price_color'] = this.marketPriceColor;
data['shop_name_color'] = this.shopNameColor;
data['sale_count_color'] = this.saleCountColor;
data['sale_count_text'] = this.saleCountText;
data['shop_icon'] = this.shopIcon;
if (this.couponCommission != null) {
data['coupon_commission'] = this.couponCommission.toJson();
}
if (this.hotRank != null) {
data['hot_rank'] = this.hotRank.toJson();
}
return data;
}
}

class HomeGoodsStyleModelProviders {
String type;
String providerNameColor;
String providerBgColor;

HomeGoodsStyleModelProviders(
{this.type, this.providerNameColor, this.providerBgColor});

HomeGoodsStyleModelProviders.fromJson(Map<String, dynamic> json) {
type = json['type']?.toString();
providerNameColor = json['provider_name_color']?.toString();
providerBgColor = json['provider_bg_color']?.toString();
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['type'] = this.type;
data['provider_name_color'] = this.providerNameColor;
data['provider_bg_color'] = this.providerBgColor;
return data;
}
}

class HomeGoodsStyleModelCouponCommission {
HomeGoodsStyleModelCoupon coupon;
HomeGoodsStyleModelCommission commission;

HomeGoodsStyleModelCouponCommission({this.coupon, this.commission});

HomeGoodsStyleModelCouponCommission.fromJson(Map<String, dynamic> json) {
coupon = json['left'] != null
? new HomeGoodsStyleModelCoupon.fromJson(json['left'])
: null;
commission = json['right'] != null
? new HomeGoodsStyleModelCommission.fromJson(json['right'])
: null;
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.coupon != null) {
data['left'] = this.coupon.toJson();
}
if (this.commission != null) {
data['right'] = this.commission.toJson();
}
return data;
}
}

class HomeGoodsStyleModelCoupon {
String couonText;
String couponFontColor;
String couponBgColor;
String couponBgImg;
String isImg;

HomeGoodsStyleModelCoupon(
{this.couonText,
this.couponFontColor,
this.couponBgColor,
this.couponBgImg,
this.isImg});

HomeGoodsStyleModelCoupon.fromJson(Map<String, dynamic> json) {
couonText = json['couon_text']?.toString();
couponFontColor = json['coupon_font_color']?.toString();
couponBgColor = json['coupon_bg_color']?.toString();
couponBgImg = json['coupon_bg_img']?.toString();
isImg = json['is_img']?.toString();
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['couon_text'] = this.couonText;
data['coupon_font_color'] = this.couponFontColor;
data['coupon_bg_color'] = this.couponBgColor;
data['coupon_bg_img'] = this.couponBgImg;
data['is_img'] = this.isImg;
return data;
}
}

class HomeGoodsStyleModelCommission {
String commissionText;
String commissionFontColor;
String commissionBgColor;
String commissionBgImg;
String isImg;

HomeGoodsStyleModelCommission(
{this.commissionText,
this.commissionFontColor,
this.commissionBgColor,
this.commissionBgImg,
this.isImg});

HomeGoodsStyleModelCommission.fromJson(Map<String, dynamic> json) {
commissionText = json['commission_text']?.toString();
commissionFontColor = json['commission_font_color']?.toString();
commissionBgColor = json['commission_bg_color']?.toString();
commissionBgImg = json['commission_bg_img']?.toString();
isImg = json['is_img']?.toString();
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['commission_text'] = this.commissionText;
data['commission_font_color'] = this.commissionFontColor;
data['commission_bg_color'] = this.commissionBgColor;
data['commission_bg_img'] = this.commissionBgImg;
data['is_img'] = this.isImg;
return data;
}
}

class HomeGoodsStyleModelHotRank {
String isOpen;
String bgColor;
String fontColor;
String hotSaleImg;
String buyNowImg;

HomeGoodsStyleModelHotRank(
{this.isOpen,
this.bgColor,
this.fontColor,
this.hotSaleImg,
this.buyNowImg});

HomeGoodsStyleModelHotRank.fromJson(Map<String, dynamic> json) {
isOpen = json['is_open']?.toString();
bgColor = json['bg_color']?.toString();
fontColor = json['font_color']?.toString();
hotSaleImg = json['hot_sale_img']?.toString();
buyNowImg = json['buy_now_img']?.toString();
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['is_open'] = this.isOpen;
data['bg_color'] = this.bgColor;
data['font_color'] = this.fontColor;
data['hot_sale_img'] = this.hotSaleImg;
data['buy_now_img'] = this.buyNowImg;
return data;
}
}

+ 51
- 429
lib/widgets/home/home_goods/models/home_goods_style_model.dart Bestand weergeven

@@ -1,453 +1,75 @@
import 'package:zhiying_base_widget/widgets/home/home_goods/models/home_goods_header_model.dart';
import 'package:zhiying_base_widget/widgets/home/home_goods/models/home_goods_list_style_model.dart';

class HomeGoodsStyleModel {
String listColumn;
List<HomeGoodsHeaderModel> recommendList;
List<String> hotRankIconList;
String topMargin;
String leftRighMargin;
List<HomeGoodsStyleModelProviders> providers;
String titleColor;
String currentPriceColor;
String marketPriceColor;
String shopNameColor;
String saleCountColor;
String saleCountText;
String shopIcon;
HomeGoodsStyleModelCouponCommission couponCommission;
HomeGoodsStyleModelHotRank hotRank;

HomeGoodsStyleModel({
this.listColumn,
this.recommendList,
this.hotRankIconList,
this.topMargin,
this.leftRighMargin,
this.providers,
this.titleColor,
this.currentPriceColor,
this.marketPriceColor,
this.shopNameColor,
this.saleCountColor,
this.saleCountText,
this.shopIcon,
this.couponCommission,
this.hotRank,
});
String subtitle;
String tilteTextColor;
String subtitleTextColor;
String tilteTextSelectedColor;
String subtitleTextSelectedColor;
String subtitleBgColor;
String sourceType;
List<HomeGoodsHeaderModel> recommendList;
String listColumn;
HomeGoodsListStyleModel listStyle;

HomeGoodsStyleModel(
{this.topMargin,
this.leftRighMargin,
this.subtitle,
this.tilteTextColor,
this.subtitleTextColor,
this.tilteTextSelectedColor,
this.subtitleTextSelectedColor,
this.subtitleBgColor,
this.sourceType,
this.recommendList,
this.listColumn,
this.listStyle});

HomeGoodsStyleModel.fromJson(Map<String, dynamic> json) {
listColumn = json['list_column']?.toString();
topMargin = json['top_margin'];
leftRighMargin = json['left_righ_margin'];
subtitle = json['subtitle'];
tilteTextColor = json['tilte_text_color'];
subtitleTextColor = json['subtitle_text_color'];
tilteTextSelectedColor = json['tilte_text_selected_color'];
subtitleTextSelectedColor = json['subtitle_text_selected_color'];
subtitleBgColor = json['subtitle_bg_color'];
sourceType = json['source_type'];
if (json['recommend_list'] != null) {
recommendList = new List<HomeGoodsHeaderModel>();
json['recommend_list'].forEach((v) {
recommendList.add(new HomeGoodsHeaderModel.fromJson(v));
});
}
if(json['hot_rank_icon_list'] != null) {
hotRankIconList = json['hot_rank_icon_list'].cast<String>();
}
topMargin = json['top_margin']?.toString();
leftRighMargin = json['left_righ_margin']?.toString();
if (json['providers'] != null) {
providers = new List<HomeGoodsStyleModelProviders>();
json['providers'].forEach((v) {
providers.add(new HomeGoodsStyleModelProviders.fromJson(v));
});
}
titleColor = json['title_color']?.toString();
currentPriceColor = json['current_price_color']?.toString();
marketPriceColor = json['market_price_color']?.toString();
shopNameColor = json['shop_name_color']?.toString();
saleCountColor = json['sale_count_color']?.toString();
saleCountText = json['sale_count_text']?.toString();
shopIcon = json['shop_icon']?.toString();
couponCommission = json['coupon_commission'] != null ? new HomeGoodsStyleModelCouponCommission.fromJson(json['coupon_commission']) : null;
hotRank = json['hot_rank'] != null ? new HomeGoodsStyleModelHotRank.fromJson(json['hot_rank']) : null;
listColumn = json['list_column'];
listStyle = json['list_style'] != null
? new HomeGoodsListStyleModel.fromJson(json['list_style'])
: null;
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['list_column'] = this.listColumn;
if (this.recommendList != null) {
data['recommend_list'] = this.recommendList.map((v) => v.toJson()).toList();
}
data['hot_rank_icon_list'] = this.hotRankIconList;
data['top_margin'] = this.topMargin;
data['left_righ_margin'] = this.leftRighMargin;
if (this.providers != null) {
data['providers'] = this.providers.map((v) => v.toJson()).toList();
}
data['title_color'] = this.titleColor;
data['current_price_color'] = this.currentPriceColor;
data['market_price_color'] = this.marketPriceColor;
data['shop_name_color'] = this.shopNameColor;
data['sale_count_color'] = this.saleCountColor;
data['sale_count_text'] = this.saleCountText;
data['shop_icon'] = this.shopIcon;
if (this.couponCommission != null) {
data['coupon_commission'] = this.couponCommission.toJson();
}
if (this.hotRank != null) {
data['hot_rank'] = this.hotRank.toJson();
}
return data;
}
}

class HomeGoodsStyleModelProviders {
String type;
String providerNameColor;
String providerBgColor;

HomeGoodsStyleModelProviders({this.type, this.providerNameColor, this.providerBgColor});

HomeGoodsStyleModelProviders.fromJson(Map<String, dynamic> json) {
type = json['type']?.toString();
providerNameColor = json['provider_name_color']?.toString();
providerBgColor = json['provider_bg_color']?.toString();
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['type'] = this.type;
data['provider_name_color'] = this.providerNameColor;
data['provider_bg_color'] = this.providerBgColor;
return data;
}
}

class HomeGoodsStyleModelCouponCommission {
HomeGoodsStyleModelCoupon coupon;
HomeGoodsStyleModelCommission commission;

HomeGoodsStyleModelCouponCommission({this.coupon, this.commission});

HomeGoodsStyleModelCouponCommission.fromJson(Map<String, dynamic> json) {
coupon = json['left'] != null ? new HomeGoodsStyleModelCoupon.fromJson(json['left']) : null;
commission = json['right'] != null ? new HomeGoodsStyleModelCommission.fromJson(json['right']) : null;
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.coupon != null) {
data['left'] = this.coupon.toJson();
data['subtitle'] = this.subtitle;
data['tilte_text_color'] = this.tilteTextColor;
data['subtitle_text_color'] = this.subtitleTextColor;
data['tilte_text_selected_color'] = this.tilteTextSelectedColor;
data['subtitle_text_selected_color'] = this.subtitleTextSelectedColor;
data['subtitle_bg_color'] = this.subtitleBgColor;
data['source_type'] = this.sourceType;
if (this.recommendList != null) {
data['recommend_list'] =
this.recommendList.map((v) => v.toJson()).toList();
}
if (this.commission != null) {
data['right'] = this.commission.toJson();
data['list_column'] = this.listColumn;
if (this.listStyle != null) {
data['list_style'] = this.listStyle.toJson();
}
return data;
}
}

class HomeGoodsStyleModelCoupon {
String couonText;
String couponFontColor;
String couponBgColor;
String couponBgImg;
String isImg;

HomeGoodsStyleModelCoupon({this.couonText, this.couponFontColor, this.couponBgColor, this.couponBgImg, this.isImg});

HomeGoodsStyleModelCoupon.fromJson(Map<String, dynamic> json) {
couonText = json['couon_text']?.toString();
couponFontColor = json['coupon_font_color']?.toString();
couponBgColor = json['coupon_bg_color']?.toString();
couponBgImg = json['coupon_bg_img']?.toString();
isImg = json['is_img']?.toString();
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['couon_text'] = this.couonText;
data['coupon_font_color'] = this.couponFontColor;
data['coupon_bg_color'] = this.couponBgColor;
data['coupon_bg_img'] = this.couponBgImg;
data['is_img'] = this.isImg;
return data;
}
}

class HomeGoodsStyleModelCommission {
String commissionText;
String commissionFontColor;
String commissionBgColor;
String commissionBgImg;
String isImg;

HomeGoodsStyleModelCommission({this.commissionText, this.commissionFontColor, this.commissionBgColor, this.commissionBgImg, this.isImg});

HomeGoodsStyleModelCommission.fromJson(Map<String, dynamic> json) {
commissionText = json['commission_text']?.toString();
commissionFontColor = json['commission_font_color']?.toString();
commissionBgColor = json['commission_bg_color']?.toString();
commissionBgImg = json['commission_bg_img']?.toString();
isImg = json['is_img']?.toString();
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['commission_text'] = this.commissionText;
data['commission_font_color'] = this.commissionFontColor;
data['commission_bg_color'] = this.commissionBgColor;
data['commission_bg_img'] = this.commissionBgImg;
data['is_img'] = this.isImg;
return data;
}
}

class HomeGoodsStyleModelHotRank {
String isOpen;
String bgColor;
String fontColor;
String hotSaleImg;
String buyNowImg;

HomeGoodsStyleModelHotRank({this.isOpen, this.bgColor, this.fontColor, this.hotSaleImg, this.buyNowImg});

HomeGoodsStyleModelHotRank.fromJson(Map<String, dynamic> json) {
isOpen = json['is_open']?.toString();
bgColor = json['bg_color']?.toString();
fontColor = json['font_color']?.toString();
hotSaleImg = json['hot_sale_img']?.toString();
buyNowImg = json['buy_now_img']?.toString();
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['is_open'] = this.isOpen;
data['bg_color'] = this.bgColor;
data['font_color'] = this.fontColor;
data['hot_sale_img'] = this.hotSaleImg;
data['buy_now_img'] = this.buyNowImg;
return data;
}
}

// class HomeGoodsStyleModel {
// String listColumn;
// List<HomeGoodsHeaderModel> recommendList;
// String providerNameColor;
// String providerNameBackgroundColor;
// String shopNameColor;
// String shopIcon;
// String couponFontColor;
// String couponBgColor;
// String commissionFontColor;
// String commissionBgColor;
// String marketPriceColor;
// String currentPriceColor;
//
// /// 2020-10-12日 新加
// String title_color;
// String sale_count_color;
// String sale_count_text;
// String top_margin;
// String left_righ_margin;
//
// HomeGoodsStyleModel({
// this.listColumn,
// this.recommendList,
// this.providerNameColor,
// this.providerNameBackgroundColor,
// this.shopNameColor,
// this.shopIcon,
// this.couponFontColor,
// this.couponBgColor,
// this.commissionFontColor,
// this.commissionBgColor,
// this.marketPriceColor,
// this.currentPriceColor,
// });
//
// HomeGoodsStyleModel.fromJson(Map<String, dynamic> json) {
// listColumn = json['list_column']?.toString();
// if (json['recommend_list'] != null) {
// recommendList = new List<HomeGoodsHeaderModel>();
// json['recommend_list'].forEach((v) {
// recommendList.add(new HomeGoodsHeaderModel.fromJson(v));
// });
// }
// providerNameColor = json['provider_name_color']?.toString();
// providerNameBackgroundColor = json['provider_name_background_color']?.toString();
// shopNameColor = json['shop_name_color']?.toString();
// shopIcon = json['shop_icon']?.toString();
// couponFontColor = json['coupon_font_color']?.toString();
// couponBgColor = json['coupon_bg_color']?.toString();
// commissionFontColor = json['commission_font_color']?.toString();
// commissionBgColor = json['commission_bg_color']?.toString();
// marketPriceColor = json['market_price_color']?.toString();
// currentPriceColor = json['current_price_color']?.toString();
// }
//
// Map<String, dynamic> toJson() {
// final Map<String, dynamic> data = new Map<String, dynamic>();
// data['list_column'] = this.listColumn;
// if (this.recommendList != null) {
// data['recommend_list'] = this.recommendList.map((v) => v.toJson()).toList();
// }
// data['provider_name_color'] = this.providerNameColor;
// data['provider_name_background_color'] = this.providerNameBackgroundColor;
// data['shop_name_color'] = this.shopNameColor;
// data['shop_icon'] = this.shopIcon;
// data['coupon_font_color'] = this.couponFontColor;
// data['coupon_bg_color'] = this.couponBgColor;
// data['commission_font_color'] = this.commissionFontColor;
// data['commission_bg_color'] = this.commissionBgColor;
// data['market_price_color'] = this.marketPriceColor;
// data['current_price_color'] = this.currentPriceColor;
// return data;
// }
// }
//
// class HomeGoodsStyleProvidersModel {
// String type;
// String provider_name_color;
// String provider_bg_color;
//
// HomeGoodsStyleProvidersModel({
// this.type,
// this.provider_name_color,
// this.provider_bg_color,
// });
//
// factory HomeGoodsStyleProvidersModel.fromJson(Map<String, dynamic> json) {
// return HomeGoodsStyleProvidersModel(
// type: json['type']?.toString(),
// provider_name_color: json['provider_name_color']?.toString(),
// provider_bg_color: json['provider_bg_color']?.toString(),
// );
// }
//
// Map<String, dynamic> toJson() {
// final Map<String, dynamic> data = new Map<String, dynamic>();
// data['type'] = this.type;
// data['provider_name_color'] = this.provider_name_color;
// data['provider_bg_color'] = this.provider_bg_color;
// return data;
// }
// }
//
// class HomeGoodsStyleCouponCommissionModel {
// HomeGoodsStyleCouonModel couonModel;
// HomeGoodsStyleCommissionModel commissionModel;
//
// HomeGoodsStyleCouponCommissionModel({
// this.couonModel,
// this.commissionModel,
// });
//
// factory HomeGoodsStyleCouponCommissionModel.fromJson(Map<String, dynamic> json) {
// return HomeGoodsStyleCouponCommissionModel(
// couonModel: json.containsKey('left') ? HomeGoodsStyleCouonModel.fromJson(json['left']) : null,
// commissionModel: json.containsKey('right') ? HomeGoodsStyleCommissionModel.fromJson(json['left']) : null,
// );
// }
// }
//
// class HomeGoodsStyleCouonModel {
// String couon_text;
// String coupon_font_color;
// String coupon_bg_color;
// String coupon_bg_img;
// String is_img;
//
// HomeGoodsStyleCouonModel({
// this.couon_text,
// this.coupon_font_color,
// this.coupon_bg_color,
// this.coupon_bg_img,
// this.is_img,
// });
//
// factory HomeGoodsStyleCouonModel.fromJson(Map<String, dynamic> json) {
// return HomeGoodsStyleCouonModel(
// couon_text: json['couon_text']?.toString(),
// coupon_font_color: json['coupon_font_color']?.toString(),
// coupon_bg_color: json['coupon_bg_color']?.toString(),
// coupon_bg_img: json['coupon_bg_img']?.toString(),
// is_img: json['is_img']?.toString(),
// );
// }
//
// Map<String, dynamic> toJson() {
// final Map<String, dynamic> data = new Map<String, dynamic>();
// data['couon_text'] = this.couon_text;
// data['coupon_font_color'] = this.coupon_font_color;
// data['coupon_bg_color'] = this.coupon_bg_color;
// data['coupon_bg_img'] = this.coupon_bg_img;
// data['is_img'] = this.is_img;
// return data;
// }
// }
//
// class HomeGoodsStyleCommissionModel {
// String commission_text;
// String commission_font_color;
// String commission_bg_color;
// String commission_bg_img;
// String is_img;
//
// HomeGoodsStyleCommissionModel({
// this.commission_text,
// this.commission_font_color,
// this.commission_bg_color,
// this.commission_bg_img,
// this.is_img,
// });
//
// factory HomeGoodsStyleCommissionModel.fromJson(Map<String, dynamic> json) {
// return HomeGoodsStyleCommissionModel(
// commission_text: json['commission_text']?.toString(),
// commission_font_color: json['commission_font_color']?.toString(),
// commission_bg_color: json['commission_bg_color']?.toString(),
// commission_bg_img: json['commission_bg_img']?.toString(),
// is_img: json['is_img']?.toString(),
// );
// }
//
// Map<String, dynamic> toJson() {
// final Map<String, dynamic> data = new Map<String, dynamic>();
// data['commission_text'] = this.commission_text;
// data['commission_font_color'] = this.commission_font_color;
// data['commission_bg_color'] = this.commission_bg_color;
// data['commission_bg_img'] = this.commission_bg_img;
// data['is_img'] = this.is_img;
// return data;
// }
// }
//
// class HomeGoodsStyleHotRankModel {
// String is_open;
// String bg_color;
// String font_color;
// String hot_sale_img;
// String buy_now_img;
//
// HomeGoodsStyleHotRankModel({
// this.is_open,
// this.bg_color,
// this.font_color,
// this.hot_sale_img,
// this.buy_now_img,
// });
//
// factory HomeGoodsStyleHotRankModel.fromJson(Map<String, dynamic> json) {
// return HomeGoodsStyleHotRankModel(
// is_open: json['is_open']?.toString(),
// bg_color: json['bg_color']?.toString(),
// font_color: json['font_color']?.toString(),
// hot_sale_img: json['hot_sale_img']?.toString(),
// buy_now_img: json['buy_now_img']?.toString(),
// );
// }
//
// Map<String, dynamic> toJson() {
// final Map<String, dynamic> data = new Map<String, dynamic>();
// data['is_open'] = this.is_open;
// data['bg_color'] = this.bg_color;
// data['font_color'] = this.font_color;
// data['hot_sale_img'] = this.hot_sale_img;
// data['buy_now_img'] = this.buy_now_img;
// return data;
// }
// }

Laden…
Annuleren
Opslaan