You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

150 lines
4.5 KiB

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/shopping_home_config.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class HomeRecommendGoods extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _HomeRecommendGoods();
}
}
class _HomeRecommendGoods extends State<HomeRecommendGoods> {
ApiService apiService;
final RefreshController refreshController = RefreshController();
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
height: 257.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
color: Colors.white,
),
margin: EdgeInsets.only(left: 14.w,right: 14.w,top: 12.h,bottom: 24.h),
child: ListView.builder(
scrollDirection: Axis.horizontal,
physics: BouncingScrollPhysics(),
itemCount:3,
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {},
child: recommendGoodsItem(),
);
},
),
),
],
),
);
}
Widget recommendGoodsItem() {
return Container(
width: 158.w,
margin: EdgeInsets.only(right:7.w,left:12.w,top: 12.h),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Stack(
children: [
Container(
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,
),
),
),
],
),
SizedBox(
height:8.h,
),
Text(
"花生吐司",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 13.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF0D0D0D),
),
),SizedBox(
height:4.h,
),
Text.rich(
TextSpan(
children: [
TextSpan(
text: "¥123.00",
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFFF85400),
),
),
TextSpan(
text: "¥123.00",
style: TextStyle(
fontSize:10.sp,
decoration: TextDecoration.lineThrough,
fontWeight: MyFontWeight.regular,
color: Color(0xFFB3B3B3),
),
),
],
),
),
],
),
);
}
}