|
|
|
@ -3,6 +3,7 @@ import 'dart:convert';
|
|
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
|
import 'package:flutter_swiper/flutter_swiper.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/banner.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/home_rank.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/shopping_home_config.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/retrofit_api.dart'; |
|
|
|
|
import 'package:huixiang/view_widget/custom_image.dart'; |
|
|
|
@ -11,6 +12,11 @@ import 'package:huixiang/utils/font_weight.dart';
|
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
|
|
|
|
|
|
class HomeRecommendGoods extends StatefulWidget { |
|
|
|
|
// final List<CommodityZone> commodityZone; |
|
|
|
|
final HomeRank homeRank; |
|
|
|
|
|
|
|
|
|
HomeRecommendGoods(this.homeRank); |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
State<StatefulWidget> createState() { |
|
|
|
|
return _HomeRecommendGoods(); |
|
|
|
@ -37,18 +43,28 @@ class _HomeRecommendGoods extends State<HomeRecommendGoods> {
|
|
|
|
|
Container( |
|
|
|
|
height: 257.h, |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
borderRadius: BorderRadius.circular(6), |
|
|
|
|
borderRadius: BorderRadius.circular(6), |
|
|
|
|
color: Colors.white, |
|
|
|
|
), |
|
|
|
|
margin: EdgeInsets.only(left: 14.w,right: 14.w,top: 14.h,bottom: 24.h), |
|
|
|
|
), |
|
|
|
|
margin: EdgeInsets.only( |
|
|
|
|
left: 14.w, right: 14.w, top: 14.h, bottom: 24.h), |
|
|
|
|
child: ListView.builder( |
|
|
|
|
scrollDirection: Axis.horizontal, |
|
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
|
itemCount:3, |
|
|
|
|
itemCount: widget.homeRank?.commodityZone?.length ?? 0, |
|
|
|
|
itemBuilder: (context, position) { |
|
|
|
|
return GestureDetector( |
|
|
|
|
onTap: () {}, |
|
|
|
|
child: recommendGoodsItem(), |
|
|
|
|
onTap: () { |
|
|
|
|
Navigator.of(context).pushNamed( |
|
|
|
|
'/router/store_order', |
|
|
|
|
arguments: { |
|
|
|
|
"id": widget.homeRank.commodityZone[position].storeId, |
|
|
|
|
"tenant": widget.homeRank.commodityZone[position].tenantCode, |
|
|
|
|
"storeName": "" |
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
child: recommendGoodsItem(widget.homeRank?.commodityZone[position]), |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
@ -58,10 +74,10 @@ class _HomeRecommendGoods extends State<HomeRecommendGoods> {
|
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Widget recommendGoodsItem() { |
|
|
|
|
Widget recommendGoodsItem(CommodityZone commodityZone) { |
|
|
|
|
return Container( |
|
|
|
|
width: 158.w, |
|
|
|
|
margin: EdgeInsets.only(right:7.w,left:12.w,top: 12.h), |
|
|
|
|
margin: EdgeInsets.only(right: 7.w, left: 12.w, top: 12.h), |
|
|
|
|
child: Column( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
@ -72,44 +88,23 @@ class _HomeRecommendGoods extends State<HomeRecommendGoods> {
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
borderRadius: BorderRadius.circular(4), |
|
|
|
|
), |
|
|
|
|
child: |
|
|
|
|
ClipRRect( |
|
|
|
|
borderRadius: BorderRadius.circular(4), |
|
|
|
|
child: Image.asset( |
|
|
|
|
"assets/image/icon_story_td.webp", |
|
|
|
|
width: 158.w, |
|
|
|
|
height: 158, |
|
|
|
|
fit: BoxFit.cover, |
|
|
|
|
), |
|
|
|
|
),), |
|
|
|
|
Container( |
|
|
|
|
width: 81.w, |
|
|
|
|
height: 27.h, |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
borderRadius: BorderRadius.only( |
|
|
|
|
topLeft: Radius.circular(4), |
|
|
|
|
bottomLeft: Radius.circular(0), |
|
|
|
|
bottomRight: Radius.circular(100), |
|
|
|
|
topRight: Radius.circular(100),), |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
), |
|
|
|
|
child: Text( |
|
|
|
|
"直降¥120.00", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
color: Color(0xFFFFFFFF), |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
), |
|
|
|
|
child: MImage( |
|
|
|
|
commodityZone?.productImg ?? "", |
|
|
|
|
fit: BoxFit.contain, |
|
|
|
|
radius: BorderRadius.circular(4), |
|
|
|
|
width: 158, |
|
|
|
|
height: 158, |
|
|
|
|
errorSrc: "assets/image/default_2_1.webp", |
|
|
|
|
fadeSrc: "assets/image/default_2_1.webp", |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
height:8.h, |
|
|
|
|
height: 8.h, |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
"花生吐司", |
|
|
|
|
commodityZone?.productName ?? "", |
|
|
|
|
maxLines: 1, |
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
style: TextStyle( |
|
|
|
@ -117,14 +112,15 @@ class _HomeRecommendGoods extends State<HomeRecommendGoods> {
|
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
color: Color(0xFF0D0D0D), |
|
|
|
|
), |
|
|
|
|
),SizedBox( |
|
|
|
|
height:4.h, |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 4.h, |
|
|
|
|
), |
|
|
|
|
Text.rich( |
|
|
|
|
TextSpan( |
|
|
|
|
children: [ |
|
|
|
|
TextSpan( |
|
|
|
|
text: "¥123.00", |
|
|
|
|
text: commodityZone?.price ?? "", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
@ -132,9 +128,9 @@ class _HomeRecommendGoods extends State<HomeRecommendGoods> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
TextSpan( |
|
|
|
|
text: "¥123.00", |
|
|
|
|
text: commodityZone?.applyPrice ?? "", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize:10.sp, |
|
|
|
|
fontSize: 10.sp, |
|
|
|
|
decoration: TextDecoration.lineThrough, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
color: Color(0xFFB3B3B3), |
|
|
|
|