|
|
@@ -18,8 +18,12 @@ class HomeGoodsItemSingle extends StatelessWidget { |
|
|
|
final double marginRight; |
|
|
|
final double marginTop; |
|
|
|
final double marginBottom; |
|
|
|
final String indexImage; |
|
|
|
|
|
|
|
HomeGoodsItemSingle(this.goods, this.style, {Key key, this.data, this.marginBottom = 4, this.marginTop = 4, this.marginLeft = 12.5, this.marginRight = 12.5}) : super(key: key) { |
|
|
|
///排序标题 |
|
|
|
|
|
|
|
HomeGoodsItemSingle(this.goods, this.style, {Key key, this.data, this.marginBottom = 4, this.marginTop = 4, this.marginLeft = 12.5, this.marginRight = 12.5, this.indexImage}) |
|
|
|
: 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)); |
|
|
@@ -37,48 +41,66 @@ class HomeGoodsItemSingle extends StatelessWidget { |
|
|
|
Widget build(BuildContext context) { |
|
|
|
return GestureDetector( |
|
|
|
onTap: () => _onJumpGoodsDetails(context, goods), |
|
|
|
child: Container( |
|
|
|
margin: EdgeInsets.only(left: marginLeft, right: marginRight, top: marginTop, bottom: marginBottom), |
|
|
|
padding: EdgeInsets.all(7.5), |
|
|
|
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(7.5))), |
|
|
|
child: Row( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: <Widget>[ |
|
|
|
Container( |
|
|
|
width: 126, |
|
|
|
height: 126, |
|
|
|
margin: EdgeInsets.only(right: 10), |
|
|
|
child: ClipRRect( |
|
|
|
borderRadius: BorderRadius.circular(7.5), |
|
|
|
child: CachedNetworkImage( |
|
|
|
imageUrl: goods.goodImage, |
|
|
|
fit: BoxFit.fitHeight, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
Expanded( |
|
|
|
child: Container( |
|
|
|
height: 126, |
|
|
|
width: double.infinity, |
|
|
|
child: Column( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: <Widget>[ |
|
|
|
Container( |
|
|
|
width: double.infinity, |
|
|
|
child: _createTitle(), |
|
|
|
child: Stack( |
|
|
|
children: <Widget>[ |
|
|
|
Container( |
|
|
|
margin: EdgeInsets.only(left: marginLeft, right: marginRight, top: marginTop, bottom: marginBottom), |
|
|
|
padding: EdgeInsets.all(7.5), |
|
|
|
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(7.5))), |
|
|
|
child: Row( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: <Widget>[ |
|
|
|
Container( |
|
|
|
width: 126, |
|
|
|
height: 126, |
|
|
|
margin: EdgeInsets.only(right: 10), |
|
|
|
child: ClipRRect( |
|
|
|
borderRadius: BorderRadius.circular(7.5), |
|
|
|
child: CachedNetworkImage( |
|
|
|
imageUrl: goods.goodImage, |
|
|
|
fit: BoxFit.fitHeight, |
|
|
|
), |
|
|
|
style?.listStyle?.hotRank?.isOpen == "0" ? _createShop() : Container(), |
|
|
|
_createCupone(), |
|
|
|
style?.listStyle?.hotRank?.isOpen == "0"? Expanded(child: Container()):Container(), |
|
|
|
_createBottom(), |
|
|
|
style?.listStyle?.hotRank?.isOpen == "1"? Expanded(child: Container()):Container(), |
|
|
|
style?.listStyle?.hotRank?.isOpen == "1"? _buildHotItem():Container() |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
) |
|
|
|
], |
|
|
|
), |
|
|
|
Expanded( |
|
|
|
child: Container( |
|
|
|
height: 126, |
|
|
|
width: double.infinity, |
|
|
|
child: Column( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: <Widget>[ |
|
|
|
Container( |
|
|
|
width: double.infinity, |
|
|
|
child: _createTitle(), |
|
|
|
), |
|
|
|
style?.listStyle?.hotRank?.isOpen == "0" ? _createShop() : Container(), |
|
|
|
_createCupone(), |
|
|
|
style?.listStyle?.hotRank?.isOpen == "0" ? Expanded(child: Container()) : Container(), |
|
|
|
_createBottom(), |
|
|
|
style?.listStyle?.hotRank?.isOpen == "1" ? Expanded(child: Container()) : Container(), |
|
|
|
style?.listStyle?.hotRank?.isOpen == "1" ? _buildHotItem() : Container() |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
) |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
style?.listStyle?.hotRank?.isOpen == "1" |
|
|
|
? Align( |
|
|
|
alignment: Alignment.topLeft, |
|
|
|
child: Container( |
|
|
|
decoration: BoxDecoration(image: DecorationImage(image: CachedNetworkImageProvider(indexImage ?? ""))), |
|
|
|
margin: EdgeInsets.only(left: 20, top: 4), |
|
|
|
height: 30, |
|
|
|
width: 30, |
|
|
|
), |
|
|
|
) |
|
|
|
: Container( |
|
|
|
width: 0, |
|
|
|
height: 0, |
|
|
|
) |
|
|
|
], |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
@@ -288,7 +310,7 @@ class HomeGoodsItemSingle extends StatelessWidget { |
|
|
|
_createPrice(), |
|
|
|
_createOriginPrice(), |
|
|
|
Expanded(child: Container()), |
|
|
|
style?.listStyle?.hotRank?.isOpen == "0"? _createSale():Container(), |
|
|
|
style?.listStyle?.hotRank?.isOpen == "0" ? _createSale() : Container(), |
|
|
|
], |
|
|
|
), |
|
|
|
); |
|
|
@@ -349,67 +371,53 @@ class HomeGoodsItemSingle extends StatelessWidget { |
|
|
|
|
|
|
|
///热点 |
|
|
|
_buildHotItem() { |
|
|
|
var hotRank=style?.listStyle?.hotRank; |
|
|
|
var hotRank = style?.listStyle?.hotRank; |
|
|
|
return Row( |
|
|
|
children: <Widget>[ |
|
|
|
Expanded( |
|
|
|
child: Stack( |
|
|
|
alignment: Alignment.centerLeft, |
|
|
|
alignment: Alignment.centerLeft, |
|
|
|
children: <Widget>[ |
|
|
|
Row( |
|
|
|
children: <Widget>[ |
|
|
|
Row( |
|
|
|
children: <Widget>[ |
|
|
|
Expanded( |
|
|
|
child: Container( |
|
|
|
alignment: Alignment.centerLeft, |
|
|
|
height: 20, |
|
|
|
padding: EdgeInsets.only( |
|
|
|
left: 20, |
|
|
|
), |
|
|
|
margin: |
|
|
|
EdgeInsets.only(right: 20, left: 10), |
|
|
|
color: HexColor.fromHex( |
|
|
|
hotRank.bgColor ?? ""), |
|
|
|
child: Text( |
|
|
|
(goods.inorderCount??"") , |
|
|
|
style: TextStyle( |
|
|
|
color: Colors.white, |
|
|
|
fontSize: 11, |
|
|
|
fontFamily: 'Din', |
|
|
|
package: 'zhiying_comm'), |
|
|
|
), |
|
|
|
)) |
|
|
|
], |
|
|
|
), |
|
|
|
Container( |
|
|
|
width: 24, |
|
|
|
height: 24, |
|
|
|
child: CachedNetworkImage( |
|
|
|
imageUrl: |
|
|
|
hotRank?.hotSaleImg ?? "", |
|
|
|
width: 24, |
|
|
|
height: 24, |
|
|
|
placeholder: (context, _) => |
|
|
|
Container(color: Colors.yellow), |
|
|
|
fit: BoxFit.fill, |
|
|
|
), |
|
|
|
), |
|
|
|
Align( |
|
|
|
alignment: Alignment.centerRight, |
|
|
|
Expanded( |
|
|
|
child: Container( |
|
|
|
height: 24, |
|
|
|
width: 63.5, |
|
|
|
decoration: BoxDecoration( |
|
|
|
image: DecorationImage( |
|
|
|
image: CachedNetworkImageProvider( |
|
|
|
hotRank.buyNowImg ?? |
|
|
|
""), |
|
|
|
fit: BoxFit.fitWidth), |
|
|
|
borderRadius: |
|
|
|
BorderRadius.circular(20)), |
|
|
|
margin: EdgeInsets.only(right: 0), |
|
|
|
)) |
|
|
|
alignment: Alignment.centerLeft, |
|
|
|
height: 20, |
|
|
|
padding: EdgeInsets.only( |
|
|
|
left: 20, |
|
|
|
), |
|
|
|
margin: EdgeInsets.only(right: 20, left: 10), |
|
|
|
color: HexColor.fromHex(hotRank.bgColor ?? ""), |
|
|
|
child: Text( |
|
|
|
(goods.inorderCount ?? ""), |
|
|
|
style: TextStyle(color: Colors.white, fontSize: 11, fontFamily: 'Din', package: 'zhiying_comm'), |
|
|
|
), |
|
|
|
)) |
|
|
|
], |
|
|
|
)) |
|
|
|
), |
|
|
|
Container( |
|
|
|
width: 24, |
|
|
|
height: 24, |
|
|
|
child: CachedNetworkImage( |
|
|
|
imageUrl: hotRank?.hotSaleImg ?? "", |
|
|
|
width: 24, |
|
|
|
height: 24, |
|
|
|
placeholder: (context, _) => Container(color: Colors.yellow), |
|
|
|
fit: BoxFit.fill, |
|
|
|
), |
|
|
|
), |
|
|
|
Align( |
|
|
|
alignment: Alignment.centerRight, |
|
|
|
child: Container( |
|
|
|
height: 24, |
|
|
|
width: 63.5, |
|
|
|
decoration: BoxDecoration( |
|
|
|
image: DecorationImage(image: CachedNetworkImageProvider(hotRank.buyNowImg ?? ""), fit: BoxFit.fitWidth), borderRadius: BorderRadius.circular(20)), |
|
|
|
margin: EdgeInsets.only(right: 0), |
|
|
|
)) |
|
|
|
], |
|
|
|
)) |
|
|
|
], |
|
|
|
); |
|
|
|
} |
|
|
|