Bladeren bron

1.增加商品详情顶部按钮开关显示

2.增加商品列表优惠券开关
tags/0.0.4+7
“yanghuaxuan” 3 jaren geleden
bovenliggende
commit
33aaa44110
6 gewijzigde bestanden met toevoegingen van 275 en 218 verwijderingen
  1. +37
    -32
      lib/widgets/custom/multi_nav/custom_quick_entry.dart
  2. +79
    -45
      lib/widgets/goods_details/footer/goods_details_footer_widget.dart
  3. +4
    -0
      lib/widgets/goods_details/footer/model/goods_details_footer_model.dart
  4. +79
    -73
      lib/widgets/home/home_goods/home_goods_item.dart
  5. +74
    -68
      lib/widgets/home/home_goods/home_goods_item_single.dart
  6. +2
    -0
      lib/widgets/home/home_goods/models/home_goods_list_style_model.dart

+ 37
- 32
lib/widgets/custom/multi_nav/custom_quick_entry.dart Bestand weergeven

@@ -142,7 +142,7 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer>
// 总体高度 = 行数 * (子元素高度 + 边距高度) + 进度条的高度
double totalHeight = totalRowSize * (itemHeight + barMargin);
if (totalPage > 1 && !EmptyUtil.isEmpty(model?.pagination) && model.pagination != 'type_null' /*model.pagination_open == '0'*/) {
totalHeight = totalRowSize * (itemHeight + barMargin)+8;
totalHeight = totalRowSize * (itemHeight + barMargin) + 8;
}

// 分类导航高度
@@ -398,7 +398,10 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer>
child: Column(
children: <Widget>[
/// 图标
MyNetWorkImage(item.img),
MyNetWorkImage(
item.img,
width: 40,
),

/// 一级标题
Visibility(
@@ -694,11 +697,12 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker
}
}


//计算实际显示行数
print("行数" + totalRowSize.toString());

// 图标的高度
double iconHeight = 40.0;
double iconHeight = 40;
// 标题的高度
double titleHeight = 20.0;

@@ -724,7 +728,7 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker
// 总体高度 = 行数 * (子元素高度 + 边距高度) + 进度条的高度
double totalHeight = totalRowSize * (itemHeight + barMargin);
if (totalPage > 1 && !EmptyUtil.isEmpty(model?.pagination) && model.pagination != 'type_null' /*model.pagination_open == '0'*/) {
totalHeight = totalRowSize * (itemHeight + barMargin)+8;
totalHeight = totalRowSize * (itemHeight + barMargin) + 6;
}

// 分类导航高度
@@ -749,7 +753,7 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker
int currentTypeIndex = 0;

for (var item in model.typeList) {
if ((item?.listStyle?.length??0) == 0) {
if ((item?.listStyle?.length ?? 0) == 0) {
pageList.add(PageItem(index: currentTypeIndex, listStyle: List()));
currentTypeIndex++;
continue;
@@ -761,14 +765,14 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker
var startIndex = index * columSize * totalRowSize;
for (var i = 0; i < columSize * totalRowSize; i++) {
if (item.listStyle.length > startIndex + i) {
list.add(item.listStyle[startIndex+i]);
list.add(item.listStyle[startIndex + i]);
} else {
break;
}
}
pageList.add(PageItem(index: currentTypeIndex, listStyle: list));
}
}else{
} else {
pageList.add(PageItem(index: currentTypeIndex, listStyle: item?.listStyle));
}
currentTypeIndex++;
@@ -786,20 +790,20 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker
bottomRight: Radius.circular(ParseUtil.stringParseDouble(model?.bottomRightRadius)),
)),
child: Container(
height: totalHeight+(totalRowSize*5),
margin: EdgeInsets.only(bottom: model?.pagination=="type_null"?0:8),
height: totalHeight + (totalRowSize * 5) + 5+5,
margin: EdgeInsets.only(bottom: model?.pagination == "type_null" ? 0 : 8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
hasCategory
? Container(
height: categoryHeight,
margin: EdgeInsets.only(top: 10,bottom: 10),
margin: EdgeInsets.only(top: 10, bottom: 15),
child: TabBar(
isScrollable: true,
onTap: (value) {
onTapTimer?.cancel();
isOnTap=true;
isOnTap = true;
onTapTimer = Timer(Duration(milliseconds: 300), () {
isOnTap = false;
});
@@ -816,7 +820,8 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker
labelColor: HexColor.fromHex("#FFFFFF"),
unselectedLabelColor: HexColor.fromHex("#FF333333"),
labelStyle: TextStyle(fontSize: 14),
tabs: _buildTab(model),
tabs: _buildTab(model,columSize),
labelPadding: EdgeInsets.only(left: 16,right: 16),
controller: tabController,
indicatorSize: TabBarIndicatorSize.label,
indicatorColor: Colors.transparent,
@@ -841,12 +846,12 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker
return Container(
height: double.infinity,
width: double.infinity,
padding: const EdgeInsets.symmetric(horizontal: 4),
padding: const EdgeInsets.symmetric(horizontal: 0),
child: _getCategoryPageWidget(
iconHeight: iconHeight,
titleHeight: titleHeight,
totalDataSize: totalDataSize,
totalPage: pageList?.length??0,
totalPage: pageList?.length ?? 0,
currentPage: index,
totalRowSize: totalRowSize,
columSize: columSize,
@@ -863,11 +868,16 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker
);
}

_buildTab(CustomQuickEntryModel model) {
_buildTab(CustomQuickEntryModel model,int columSize) {
List<Widget> listWidget = List();
var maxWidth = (MediaQuery.of(context).size.width-(32*columSize)) / columSize;
print("测试"+columSize.toString());
for (var item in model?.typeList) {
listWidget.add(Tab(
text: item.name,
child: Container(
width: maxWidth,
child: Center(child: Text(item.name??"")),
),
));
}
return listWidget;
@@ -875,15 +885,7 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker

/// 获取有分类页
_getCategoryPageWidget(
{double titleHeight,
double iconHeight,
int totalPage,
int currentPage,
int columSize,
int totalRowSize,
int totalDataSize,
CustomQuickEntryModel model,
double itemHeight}) {
{double titleHeight, double iconHeight, int totalPage, int currentPage, int columSize, int totalRowSize, int totalDataSize, CustomQuickEntryModel model, double itemHeight}) {
List rowList = [];
for (int i = 0; i < totalRowSize; i++) {
rowList.add(i);
@@ -894,7 +896,7 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker
mainAxisAlignment: MainAxisAlignment.start,
children: rowList.map((currentRow) {
return Container(
padding: EdgeInsets.only(bottom: 15),
padding: EdgeInsets.only(bottom: 15, top: 0),
width: double.infinity,
child: _buildHasCategoryRowWidget(
titleHeight: titleHeight,
@@ -928,8 +930,9 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker
for (int i = 0; i < columSize; i++) {
itemList.add(i);
}

return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: itemList.map((currentIndex) {
return _getHasCategoryColumWidget(
@@ -969,11 +972,12 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker
// currentColum + currentRow * columSize;

// 当前元素的下表 = 当前的列数 + 当前的行数 * 列数 + 当前的页数 * 当前的行数 + 当前的列数
int currentIndex = currentColum + currentRow * columSize ;
print("当前页"+currentPage.toString()+"当前点"+currentIndex.toString());
int currentIndex = currentColum + currentRow * columSize;
print("当前页" + currentPage.toString() + "当前点" + currentIndex.toString());

// print('current Index sss = $currentIndex');


if (currentIndex >= totalDataSize) {
return Container(
height: itemHeight,
@@ -988,12 +992,12 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker
onTap: () => _itemIconClick(item),
child: Container(
height: itemHeight,
width: 60,
// color: Colors.red,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
/// 图标
MyNetWorkImage(item.img),
MyNetWorkImage(item.img,width: 40,),

/// 一级标题
Visibility(
@@ -1051,7 +1055,8 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker
return SwiperPagination(
margin: const EdgeInsets.only(),
builder: DotSwiperPaginationBuilder(
color: HexColor.fromHex(model?.paginationUnselectColor), activeColor: HexColor.fromHex(model?.paginationSelectColor), size: 8, activeSize: 8));
space: 2,
color: HexColor.fromHex(model?.paginationUnselectColor), activeColor: HexColor.fromHex(model?.paginationSelectColor), size: 6, activeSize: 7));
}

// 自定义进度条 条形


+ 79
- 45
lib/widgets/goods_details/footer/goods_details_footer_widget.dart Bestand weergeven

@@ -21,7 +21,8 @@ import 'package:zhiying_comm/util/turn_chain/turn_chain_util.dart';
class GoodsDetailsFooterWidget extends StatelessWidget {
final Map<String, dynamic> model;
final bool isFree;
const GoodsDetailsFooterWidget(this.model,{this.isFree=false});

const GoodsDetailsFooterWidget(this.model, {this.isFree = false});

@override
Widget build(BuildContext context) {
@@ -44,7 +45,8 @@ class GoodsDetailsFooterWidget extends StatelessWidget {
class _GoodsDetailsFooterContainer extends StatefulWidget {
final Map<String, dynamic> model;
final bool isFree;
const _GoodsDetailsFooterContainer(this.model, {this.isFree,Key key}) : super(key: key);

const _GoodsDetailsFooterContainer(this.model, {this.isFree, Key key}) : super(key: key);

@override
_GoodsDetailsFooterContainerState createState() => _GoodsDetailsFooterContainerState();
@@ -61,7 +63,9 @@ class _GoodsDetailsFooterContainerState extends State<_GoodsDetailsFooterContain

@override
void didChangeDependencies() {
_user = Provider.of<UserInfoNotifier>(context).userInfo;
_user = Provider
.of<UserInfoNotifier>(context)
.userInfo;
super.didChangeDependencies();
}

@@ -105,7 +109,7 @@ class _GoodsDetailsFooterContainerState extends State<_GoodsDetailsFooterContain

/// 自购省
void _saveMoneyOnClick(GoodsDetailsFooterModel model) async {
await TurnChainUtil.openReceiveCoupon(context, _user, model?.good_id, model?.provider, model?.convertArgs?.toJson(),isFree: widget?.isFree);
await TurnChainUtil.openReceiveCoupon(context, _user, model?.good_id, model?.provider, model?.convertArgs?.toJson(), isFree: widget?.isFree);
}

@override
@@ -129,23 +133,26 @@ class _GoodsDetailsFooterContainerState extends State<_GoodsDetailsFooterContain
}

Widget _getMainWidget(GoodsDetailsFooterModel model) {
double height = MediaQuery.of(context).padding.bottom;
double height = MediaQuery
.of(context)
.padding
.bottom;
return SafeArea(
child: Container(
width: double.infinity,
padding: EdgeInsets.only(bottom: (height > 10 ? 0 : 8), top: 8, left: 21, right: 12.5),
padding: EdgeInsets.only(bottom: (height > 10 ? 0 : 8), top: 8, left: 12.5, right: 12.5),
decoration: BoxDecoration(
// boxShadow: [
// 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: 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)),
)
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)),
),
@@ -158,11 +165,12 @@ class _GoodsDetailsFooterContainerState extends State<_GoodsDetailsFooterContain
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[

/// 首页与收藏
_getLeftWidget(model),

/// 分享赚与自购省
_getRightWidget(model),
Expanded(child: _getRightWidget(model)),
],
);
}
@@ -173,32 +181,54 @@ class _GoodsDetailsFooterContainerState extends State<_GoodsDetailsFooterContain
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () => _openHome(),
child: Padding(
padding: const EdgeInsets.only(right: 35),
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?.listStyle?.leftIcon2?.text ?? '收藏', model?.listStyle?.leftIcon2?.color ?? '999999', model?.isFav == '0' ? model?.listStyle?.leftIcon2?.beforeIcon ?? '' : model?.listStyle?.leftIcon2?.afterIcon ?? '')))
Visibility(
visible: (model?.listStyle?.leftIcon1?.isShow ?? "0") == "1" ? true : false,
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () => _openHome(),
child: Padding(
padding: const EdgeInsets.only(right: 35,left: 8),
child: _getCustomWidget(model?.listStyle?.leftIcon1?.text ?? '首页', model?.listStyle?.leftIcon1?.color ?? '999999', model?.listStyle?.leftIcon1?.beforeIcon ?? ''),
)),
),
Visibility(
visible: (model?.listStyle?.leftIcon2?.isShow ?? "0") == "1" ? true : false,
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () => _collectOnClick(model),
child: Padding(
padding: const EdgeInsets.only(right: 35),
child: _getCustomWidget(model?.listStyle?.leftIcon2?.text ?? '收藏', model?.listStyle?.leftIcon2?.color ?? '999999',
model?.isFav == '0' ? model?.listStyle?.leftIcon2?.beforeIcon ?? '' : model?.listStyle?.leftIcon2?.afterIcon ?? ''))),
)
],
);
}

/// 分享赚与自购省
Widget _getRightWidget(GoodsDetailsFooterModel model) {
return Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
_getFxzButton(model),
_getZgsButton(model),
],
if (model?.listStyle?.rightIcon1.isShow == "0" || model?.listStyle.rightIcon2.isShow == "0") {
return Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
(model?.listStyle?.rightIcon1?.isShow ?? "0") == "1" ? Expanded(child: _getFxzButton(model)):Container(),
(model?.listStyle?.rightIcon2?.isShow ?? "0") == "1" ? Expanded(child: _getZgsButton(model)):Container()
],
),
);
}
return Container(
width: 220,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Expanded(child: _getFxzButton(model)),
Expanded(child: _getZgsButton(model)),
],
),
);
}

@@ -209,13 +239,13 @@ class _GoodsDetailsFooterContainerState extends State<_GoodsDetailsFooterContain
child: Container(
alignment: Alignment.center,
height: 44,
width: 110,
width: double.infinity,
// 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(
@@ -227,7 +257,11 @@ class _GoodsDetailsFooterContainerState extends State<_GoodsDetailsFooterContain
TextSpan(
text: model?.share_value ?? '0.0',
style: TextStyle(
fontSize: 15, fontWeight: FontWeight.bold, color: HexColor.fromHex(model?.listStyle?.rightIcon1?.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(
@@ -249,12 +283,11 @@ class _GoodsDetailsFooterContainerState extends State<_GoodsDetailsFooterContain
alignment: Alignment.center,
// padding: const EdgeInsets.only(left: 30, right: 30, top: 5, bottom: 5),
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(
@@ -286,6 +319,7 @@ class _GoodsDetailsFooterContainerState extends State<_GoodsDetailsFooterContain
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[

/// 图标
CachedNetworkImage(
imageUrl: icon,


+ 4
- 0
lib/widgets/goods_details/footer/model/goods_details_footer_model.dart Bestand weergeven

@@ -337,6 +337,7 @@ class LeftIcon1 extends SkipModel{
String requiredLogin;
String requiredTaobaoAuth;
String isJump;
String isShow;

LeftIcon1({this.text,
this.color,
@@ -357,6 +358,7 @@ class LeftIcon1 extends SkipModel{
requiredLogin = json['required_login'];
requiredTaobaoAuth = json['required_taobao_auth'];
isJump = json['is_jump'];
isShow=json['is_show'];
}

Map<String, dynamic> toJson() {
@@ -380,6 +382,7 @@ class RightIcon1 {
String bgImage;
String functionType;
List<String> sourceList;
String isShow;

RightIcon1({this.text,
this.color,
@@ -395,6 +398,7 @@ class RightIcon1 {
bgImage = json['bg_image'];
functionType = json['function_type'];
sourceList = json['source_list'].cast<String>();
isShow=json['is_show'];
}

Map<String, dynamic> toJson() {


+ 79
- 73
lib/widgets/home/home_goods/home_goods_item.dart Bestand weergeven

@@ -176,48 +176,51 @@ class HomeGoodsItem extends StatelessWidget {
borderRadius: BorderRadius.circular(2.5),
);

widgets.add(Container(
margin: EdgeInsets.only(right: 5),
padding: EdgeInsets.only(left: 10, right: 10, top: 3, bottom: 3),
// decoration: BoxDecoration(
// color: HexColor.fromHex(style.couponBgColor),
// borderRadius: BorderRadius.circular(2.5),
// ),
// child: Text(
// goods.coupon,
// textAlign: TextAlign.center,
// maxLines: 1,
// style: TextStyle(
// height: 1,
// fontSize: 11,
// // color: HexColor.fromHex(style.couponFontColor),
// color: HexColor.fromHex(style?.couponCommission?.coupon?.couponFontColor),
// ),
// ),
decoration: couponDe,
child: RichText(
maxLines: 1,
textAlign: TextAlign.center,
text: TextSpan(
text: '${goods?.coupon ?? '0'}',
style: TextStyle(
height: 1,
fontSize: 11,
color: HexColor.fromHex(style
?.listStyle?.couponCommission?.coupon?.fontColor),
),
children: [
TextSpan(
text:
'${style?.listStyle?.couponCommission?.coupon?.text ?? '元劵'}',
style: TextStyle(
height: 1,
fontSize: 11,
color: HexColor.fromHex(style
?.listStyle?.couponCommission?.coupon?.fontColor),
),
)
]),
widgets.add(Visibility(
visible: style?.listStyle?.couponCommission?.coupon?.isShow=="1"?true:false,
child: Container(
margin: EdgeInsets.only(right: 5),
padding: EdgeInsets.only(left: 10, right: 10, top: 3, bottom: 3),
// decoration: BoxDecoration(
// color: HexColor.fromHex(style.couponBgColor),
// borderRadius: BorderRadius.circular(2.5),
// ),
// child: Text(
// goods.coupon,
// textAlign: TextAlign.center,
// maxLines: 1,
// style: TextStyle(
// height: 1,
// fontSize: 11,
// // color: HexColor.fromHex(style.couponFontColor),
// color: HexColor.fromHex(style?.couponCommission?.coupon?.couponFontColor),
// ),
// ),
decoration: couponDe,
child: RichText(
maxLines: 1,
textAlign: TextAlign.center,
text: TextSpan(
text: '${goods?.coupon ?? '0'}',
style: TextStyle(
height: 1,
fontSize: 11,
color: HexColor.fromHex(style
?.listStyle?.couponCommission?.coupon?.fontColor),
),
children: [
TextSpan(
text:
'${style?.listStyle?.couponCommission?.coupon?.text ?? '元劵'}',
style: TextStyle(
height: 1,
fontSize: 11,
color: HexColor.fromHex(style
?.listStyle?.couponCommission?.coupon?.fontColor),
),
)
]),
),
),
));
}
@@ -239,37 +242,40 @@ class HomeGoodsItem extends StatelessWidget {
borderRadius: BorderRadius.circular(2.5),
);

widgets.add(Container(
margin: EdgeInsets.only(right: 5),
padding: EdgeInsets.only(left: 10, right: 10, top: 3, bottom: 3),
// decoration: BoxDecoration(
// color: HexColor.fromHex(style.commissionBgColor),
// borderRadius: BorderRadius.circular(2.5),
// ),
decoration: commissionDe,
child: RichText(
maxLines: 1,
textAlign: TextAlign.center,
text: TextSpan(
text:
'${style?.listStyle?.couponCommission?.commission?.text ?? ''}',
style: TextStyle(
height: 1,
fontSize: 11,
color: HexColor.fromHex(style?.listStyle?.couponCommission
?.commission?.fontColor),
),
children: [
TextSpan(
text: '${goods?.commission ?? '0'}',
style: TextStyle(
height: 1,
fontSize: 11,
color: HexColor.fromHex(style?.listStyle?.couponCommission
?.commission?.fontColor),
),
)
]),
widgets.add(Visibility(
visible: style?.listStyle?.couponCommission?.commission.isShow=="1"?true:false,
child: Container(
margin: EdgeInsets.only(right: 5),
padding: EdgeInsets.only(left: 10, right: 10, top: 3, bottom: 3),
// decoration: BoxDecoration(
// color: HexColor.fromHex(style.commissionBgColor),
// borderRadius: BorderRadius.circular(2.5),
// ),
decoration: commissionDe,
child: RichText(
maxLines: 1,
textAlign: TextAlign.center,
text: TextSpan(
text:
'${style?.listStyle?.couponCommission?.commission?.text ?? ''}',
style: TextStyle(
height: 1,
fontSize: 11,
color: HexColor.fromHex(style?.listStyle?.couponCommission
?.commission?.fontColor),
),
children: [
TextSpan(
text: '${goods?.commission ?? '0'}',
style: TextStyle(
height: 1,
fontSize: 11,
color: HexColor.fromHex(style?.listStyle?.couponCommission
?.commission?.fontColor),
),
)
]),
),
),
));
}


+ 74
- 68
lib/widgets/home/home_goods/home_goods_item_single.dart Bestand weergeven

@@ -192,105 +192,111 @@ class HomeGoodsItemSingle extends StatelessWidget {
borderRadius: BorderRadius.circular(2.5),
);

widgets.add(Container(
margin: EdgeInsets.only(right: 5),
padding: EdgeInsets.only(left: 10, right: 10, top: 3, bottom: 3),
// decoration: BoxDecoration(
// color: HexColor.fromHex(style.couponBgColor),
// borderRadius: BorderRadius.circular(2.5),
// ),

// child: Text(
// goods.coupon,
// textAlign: TextAlign.center,
// maxLines: 1,
// style: TextStyle(
// height: 1,
// fontSize: 11,
// // color: HexColor.fromHex(style.couponFontColor),
// color: HexColor.fromHex(style?.couponCommission?.coupon?.couponFontColor),
// ),
// ),
decoration: couponDe,
child: RichText(
maxLines: 1,
textAlign: TextAlign.center,
text: TextSpan(
text: '${goods?.coupon ?? '0'}',
style: TextStyle(
height: 1,
fontSize: 11,
color: HexColor.fromHex(style?.listStyle?.couponCommission?.coupon?.fontColor),
),
children: [
TextSpan(
text: '${style?.listStyle?.couponCommission?.coupon?.text ?? '元劵'}',
style: TextStyle(
height: 1,
fontSize: 11,
color: HexColor.fromHex(style?.listStyle?.couponCommission?.coupon?.fontColor),
),
)
]),
),
));
}

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

widgets.add(
Container(
widgets.add(Visibility(
visible: style?.listStyle?.couponCommission?.coupon.isShow=="1"?true:false,
child: Container(
margin: EdgeInsets.only(right: 5),
padding: EdgeInsets.only(left: 10, right: 10, top: 3, bottom: 3),
// decoration: BoxDecoration(
// color: HexColor.fromHex(style.commissionBgColor),
// color: HexColor.fromHex(style.couponBgColor),
// borderRadius: BorderRadius.circular(2.5),
// ),

// child: Text(
// goods.commission,
// goods.coupon,
// textAlign: TextAlign.center,
// maxLines: 1,
// style: TextStyle(
// height: 1,
// fontSize: 11,
// // color: HexColor.fromHex(style.commissionFontColor),
// color: HexColor.fromHex(style?.couponCommission?.commission?.commissionFontColor),
// // color: HexColor.fromHex(style.couponFontColor),
// color: HexColor.fromHex(style?.couponCommission?.coupon?.couponFontColor),
// ),
// ),
decoration: commissionDe,
decoration: couponDe,
child: RichText(
maxLines: 1,
textAlign: TextAlign.center,
text: TextSpan(
text: '${style?.listStyle?.couponCommission?.commission?.text ?? ''}',
text: '${goods?.coupon ?? '0'}',
style: TextStyle(
height: 1,
fontSize: 11,
color: HexColor.fromHex(style?.listStyle?.couponCommission?.commission?.fontColor),
color: HexColor.fromHex(style?.listStyle?.couponCommission?.coupon?.fontColor),
),
children: [
TextSpan(
text: '${goods?.commission ?? '0'}',
text: '${style?.listStyle?.couponCommission?.coupon?.text ?? '元劵'}',
style: TextStyle(
height: 1,
fontSize: 11,
color: HexColor.fromHex(style?.listStyle?.couponCommission?.commission?.fontColor),
color: HexColor.fromHex(style?.listStyle?.couponCommission?.coupon?.fontColor),
),
)
]),
),
),
));
}

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

widgets.add(
Visibility(
visible: style?.listStyle?.couponCommission?.commission.isShow=="1"?true:false,
child: Container(
margin: EdgeInsets.only(right: 5),
padding: EdgeInsets.only(left: 10, right: 10, top: 3, bottom: 3),
// decoration: BoxDecoration(
// color: HexColor.fromHex(style.commissionBgColor),
// borderRadius: BorderRadius.circular(2.5),
// ),
// child: Text(
// goods.commission,
// textAlign: TextAlign.center,
// maxLines: 1,
// style: TextStyle(
// height: 1,
// fontSize: 11,
// // color: HexColor.fromHex(style.commissionFontColor),
// color: HexColor.fromHex(style?.couponCommission?.commission?.commissionFontColor),
// ),
// ),
decoration: commissionDe,
child: RichText(
maxLines: 1,
textAlign: TextAlign.center,
text: TextSpan(
text: '${style?.listStyle?.couponCommission?.commission?.text ?? ''}',
style: TextStyle(
height: 1,
fontSize: 11,
color: HexColor.fromHex(style?.listStyle?.couponCommission?.commission?.fontColor),
),
children: [
TextSpan(
text: '${goods?.commission ?? '0'}',
style: TextStyle(
height: 1,
fontSize: 11,
color: HexColor.fromHex(style?.listStyle?.couponCommission?.commission?.fontColor),
),
)
]),
),
),
),
);
}



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

@@ -136,6 +136,7 @@ class Left {
String bgType;
String bgColor;
String bgImg;
String isShow;

Left({this.text, this.fontColor, this.bgType, this.bgColor, this.bgImg});

@@ -145,6 +146,7 @@ class Left {
bgType = json['bg_type'];
bgColor = json['bg_color'];
bgImg = json['bg_img'];
isShow=json['is_show'];
}

Map<String, dynamic> toJson() {


Laden…
Annuleren
Opslaan