|
|
|
import 'package:dio/dio.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
|
|
|
import 'package:flutter_swiper/flutter_swiper.dart';
|
|
|
|
import 'package:huixiang/generated/l10n.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/base_data.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/goods.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/page.dart';
|
|
|
|
import 'package:huixiang/retrofit/retrofit_api.dart';
|
|
|
|
import 'package:huixiang/utils/flutter_utils.dart';
|
|
|
|
import 'package:huixiang/utils/font_weight.dart';
|
|
|
|
import 'package:huixiang/view_widget/classic_header.dart';
|
|
|
|
import 'package:huixiang/view_widget/custom_image.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:huixiang/view_widget/my_appbar.dart';
|
|
|
|
import 'package:huixiang/view_widget/my_footer.dart';
|
|
|
|
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
|
|
|
|
class WelfarePage extends StatefulWidget {
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() {
|
|
|
|
return _WelfarePage();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class _WelfarePage extends State<WelfarePage> {
|
|
|
|
ApiService apiService;
|
|
|
|
final RefreshController refreshController = RefreshController();
|
|
|
|
final ScrollController scrollController = ScrollController();
|
|
|
|
List<Goods> goods = [];
|
|
|
|
String categoryId;
|
|
|
|
bool orderDesc = true;
|
|
|
|
int orderType = 1;
|
|
|
|
int pageNum = 1;
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
SharedPreferences.getInstance().then((value) => {
|
|
|
|
apiService = ApiService(Dio(), context: context, token: value.getString("token")),
|
|
|
|
queryGoods(),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
queryGoods() async {
|
|
|
|
var param = {
|
|
|
|
"categoryId": categoryId ?? "",
|
|
|
|
"orderDesc": orderDesc,
|
|
|
|
"orderType": orderType,
|
|
|
|
"pageNum": pageNum,
|
|
|
|
"pageSize": 10,
|
|
|
|
"state": 1
|
|
|
|
};
|
|
|
|
BaseData<PageInfo<Goods>> pageGoods =
|
|
|
|
await apiService.creditGoods(param).catchError((onError) {
|
|
|
|
refreshController.loadFailed();
|
|
|
|
refreshController.refreshFailed();
|
|
|
|
});
|
|
|
|
EasyLoading.dismiss();
|
|
|
|
if (pageGoods != null && pageGoods.isSuccess) {
|
|
|
|
setState(() {
|
|
|
|
if (pageNum == 1) {
|
|
|
|
goods.clear();
|
|
|
|
}
|
|
|
|
goods.addAll(pageGoods.data.list);
|
|
|
|
});
|
|
|
|
refreshController.refreshCompleted();
|
|
|
|
refreshController.loadComplete();
|
|
|
|
if (pageGoods.data.pageNum == pageGoods.data.pages) {
|
|
|
|
refreshController.loadNoData();
|
|
|
|
} else {
|
|
|
|
pageNum += 1;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
refreshController.loadFailed();
|
|
|
|
refreshController.refreshFailed();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Stack(
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
image: DecorationImage(
|
|
|
|
fit: BoxFit.fill,
|
|
|
|
image: AssetImage("assets/image/welfare_zx.webp"),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
width: double.infinity,
|
|
|
|
height: 385.h,
|
|
|
|
),
|
|
|
|
Scaffold(
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
appBar: MyAppBar(
|
|
|
|
background: Colors.transparent,
|
|
|
|
leadingColor: Colors.white,
|
|
|
|
title: "福利中心",
|
|
|
|
titleColor: Colors.white,
|
|
|
|
titleSize: 18.sp,
|
|
|
|
brightness: Brightness.dark,
|
|
|
|
),
|
|
|
|
body:SmartRefresher(
|
|
|
|
controller: refreshController,
|
|
|
|
enablePullDown: true,
|
|
|
|
enablePullUp: false,
|
|
|
|
header: MyHeader(),
|
|
|
|
footer: CustomFooter(
|
|
|
|
builder: (context, mode) {
|
|
|
|
return MyFooter(mode);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
onRefresh:(){
|
|
|
|
setState(() {
|
|
|
|
});
|
|
|
|
},
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
scrollController: scrollController,
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(top: 45.h,left: 14,right: 14),
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
child: FutureBuilder(
|
|
|
|
// future: querySignInfo(),
|
|
|
|
builder: (context, snap) {
|
|
|
|
return Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
|
|
|
|
|
|
|
|
weekCoupons(),
|
|
|
|
|
|
|
|
inviteFriends(),
|
|
|
|
|
|
|
|
benefitExchange(),
|
|
|
|
|
|
|
|
// activityTask(),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// 周券包推荐
|
|
|
|
Widget weekCoupons() {
|
|
|
|
return Stack(
|
|
|
|
alignment: Alignment.topRight,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
margin: EdgeInsets.only(top: 95),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(6),
|
|
|
|
color: Colors.white,
|
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
color: Color(0x08213303).withAlpha(12),
|
|
|
|
offset: Offset(0, 2),
|
|
|
|
blurRadius: 3,
|
|
|
|
spreadRadius: 0,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
// margin: EdgeInsets.only(top: 139.h),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 12.w,vertical: 16.h),
|
|
|
|
child:
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
S.of(context).lingquanzhongxin,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF0D0D0D),
|
|
|
|
fontSize: 15.sp,
|
|
|
|
fontWeight: MyFontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"每周上新 ",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF4D4D4D),
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
AspectRatio(
|
|
|
|
aspectRatio: 1.22,
|
|
|
|
child: Swiper(
|
|
|
|
viewportFraction: 0.9,
|
|
|
|
scale: 0.7,
|
|
|
|
pagination: SwiperPagination(
|
|
|
|
alignment: Alignment.bottomCenter,
|
|
|
|
builder: DotSwiperPaginationBuilder(
|
|
|
|
size: 8,
|
|
|
|
activeSize: 8,
|
|
|
|
space: 5,
|
|
|
|
activeColor: Colors.black,
|
|
|
|
color: Colors.black.withAlpha(76),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
itemBuilder: (context, position) {
|
|
|
|
return Column(
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
// height: 84.h,
|
|
|
|
// child: ListView.builder(
|
|
|
|
// scrollDirection: Axis.horizontal,
|
|
|
|
// physics: BouncingScrollPhysics(),
|
|
|
|
// padding: EdgeInsets.symmetric(horizontal: 12),
|
|
|
|
// itemCount:3,
|
|
|
|
// itemBuilder: (context, index) {
|
|
|
|
// return GestureDetector(
|
|
|
|
// onTap: () {
|
|
|
|
//
|
|
|
|
// },
|
|
|
|
// child: weekItem(),
|
|
|
|
// );
|
|
|
|
// },
|
|
|
|
// ),
|
|
|
|
child: weekItem(),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
},
|
|
|
|
itemCount:3,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Expanded(child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Padding(padding:EdgeInsets.only(top: 12),
|
|
|
|
child: Text(
|
|
|
|
"福利周周有,优惠享不停",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 20.sp,
|
|
|
|
fontWeight: MyFontWeight.bold,
|
|
|
|
color: Color(0xFFFFFFFF),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
SizedBox(height: 8,),
|
|
|
|
Text(
|
|
|
|
"各种优惠全都有",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFFFFFFFF),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
Image.asset(
|
|
|
|
"assets/image/welfare_zx_tu.webp",
|
|
|
|
width:120.w,
|
|
|
|
height:105.h,
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget weekItem() {
|
|
|
|
return Container(
|
|
|
|
width:double.infinity,
|
|
|
|
height:100.h,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
image: DecorationImage(
|
|
|
|
fit: BoxFit.fill,
|
|
|
|
image: AssetImage("assets/image/week_coupons.webp"),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 12.w,vertical: 12.h),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
children: [
|
|
|
|
Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Text.rich(
|
|
|
|
TextSpan(
|
|
|
|
children: [
|
|
|
|
TextSpan(
|
|
|
|
text: "¥",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16.sp,
|
|
|
|
fontWeight: MyFontWeight.semi_bold,
|
|
|
|
color: Color(0xFF32A060),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
TextSpan(
|
|
|
|
text: "30",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 26.sp,
|
|
|
|
fontWeight: MyFontWeight.semi_bold,
|
|
|
|
color: Color(0xFF32A060),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"满30.1可用",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFF32A060),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
SizedBox(width: 30,),
|
|
|
|
Expanded(child:
|
|
|
|
Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Expanded(child: Text(
|
|
|
|
"新人满减30元",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.semi_bold,
|
|
|
|
color: Color(0xFF353535),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
SizedBox(height:4.h,),
|
|
|
|
Text(
|
|
|
|
"有效期至2022-09-10 12:00:00",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 11.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFF4D4D4D),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(height:5.h,),
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
"使用详情",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 11.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFF4D4D4D),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Icon(
|
|
|
|
Icons.keyboard_arrow_right,
|
|
|
|
color: Color(0xFF4D4D4D),
|
|
|
|
size: 20,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
Container(
|
|
|
|
width: 50.w,
|
|
|
|
height: 19.h,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0xFF32A060),
|
|
|
|
shape: BoxShape.rectangle,
|
|
|
|
borderRadius: BorderRadius.circular(3),
|
|
|
|
),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child:Text(
|
|
|
|
"领取",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFFFFFFFF),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///邀请好友
|
|
|
|
Widget inviteFriends() {
|
|
|
|
return Container(
|
|
|
|
margin: EdgeInsets.only(top:24.h,bottom:20.h),
|
|
|
|
child:Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
"邀请好友",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 15.sp,
|
|
|
|
fontWeight: MyFontWeight.bold,
|
|
|
|
color: Color(0xFF0D0D0D),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(height: 12,),
|
|
|
|
GestureDetector(
|
|
|
|
onTap: (){
|
|
|
|
Navigator.of(context).pushNamed('/router/invite_friends');
|
|
|
|
},
|
|
|
|
child:ClipRRect(
|
|
|
|
child:Image.asset(
|
|
|
|
"assets/image/icon_story_td.webp",
|
|
|
|
width:double.infinity,
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
height:80.h,
|
|
|
|
),
|
|
|
|
borderRadius: BorderRadius.circular(6.w),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///福利兑换
|
|
|
|
Widget benefitExchange() {
|
|
|
|
return Container(
|
|
|
|
width: double.infinity,
|
|
|
|
margin: EdgeInsets.only(top:24.h,bottom:20.h),
|
|
|
|
child:Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
GestureDetector(
|
|
|
|
onTap: (){
|
|
|
|
Navigator.of(context).pushNamed('/router/welfare_exchange');
|
|
|
|
},
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Expanded(child:
|
|
|
|
Text(
|
|
|
|
"福利兑换",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 15.sp,
|
|
|
|
fontWeight: MyFontWeight.bold,
|
|
|
|
color: Color(0xFF0D0D0D),
|
|
|
|
),
|
|
|
|
),),
|
|
|
|
Text(
|
|
|
|
S.of(context).gengduo,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFF4D4D4D),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Icon(
|
|
|
|
Icons.keyboard_arrow_right,
|
|
|
|
color: Color(0xFF4D4D4D),
|
|
|
|
size: 20,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(height: 12,),
|
|
|
|
GridView.builder(
|
|
|
|
itemCount:goods.length>6?6:goods.length,
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
// left: 16.w,
|
|
|
|
// right: 16.w,
|
|
|
|
top: 18.h,
|
|
|
|
bottom: 16.h,
|
|
|
|
),
|
|
|
|
shrinkWrap: true,
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
//一行的Widget数量
|
|
|
|
crossAxisCount: 2,
|
|
|
|
//水平子Widget之间间距
|
|
|
|
crossAxisSpacing: 11.w,
|
|
|
|
//垂直子Widget之间间距
|
|
|
|
mainAxisSpacing: 16.w,
|
|
|
|
//子Widget宽高比例 0.59
|
|
|
|
childAspectRatio:
|
|
|
|
200 / (261 / 2 + (261 / 2) * AppUtils.textScale(context)),
|
|
|
|
),
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
return GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
'/router/integral_store_page',
|
|
|
|
arguments: {"goodsId": goods[index].id},
|
|
|
|
);
|
|
|
|
},
|
|
|
|
child: exchangeItem(goods[index]),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget exchangeItem(Goods goods) {
|
|
|
|
return Container(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0xFFFFFFFF),
|
|
|
|
borderRadius: BorderRadius.circular(4),
|
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
color: Colors.black.withAlpha(12),
|
|
|
|
offset: Offset(0, 2),
|
|
|
|
blurRadius: 4,
|
|
|
|
spreadRadius: 0,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
child: Stack(
|
|
|
|
alignment: AlignmentDirectional.topEnd,
|
|
|
|
fit: StackFit.loose,
|
|
|
|
children: [
|
|
|
|
Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
children: [
|
|
|
|
MImage(
|
|
|
|
goods.mainImgPath,
|
|
|
|
aspectRatio: 1.1,
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
radius: BorderRadius.only(
|
|
|
|
topLeft: Radius.circular(4),
|
|
|
|
topRight: Radius.circular(4),
|
|
|
|
),
|
|
|
|
errorSrc: "assets/image/default_1.webp",
|
|
|
|
fadeSrc: "assets/image/default_1.webp",
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
right: 12.w,
|
|
|
|
top: 10.h,
|
|
|
|
),padding: EdgeInsets.only(
|
|
|
|
bottom: 8,
|
|
|
|
left: 8
|
|
|
|
),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
goods.name,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
maxLines: 2,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF0D0D0D),
|
|
|
|
height: 1.2,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
fontSize: 14.sp,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Spacer(),
|
|
|
|
Text(
|
|
|
|
(goods?.price == null || goods.price == "0"?"":S.of(context).jifen_(goods.price)) + (goods?.money == null|| goods.money == "0.00" ?"":" + ${goods.money}元"),
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFFE5600D),
|
|
|
|
fontSize: 16.sp,
|
|
|
|
fontWeight: MyFontWeight.semi_bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
flex: 1,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///活动任务
|
|
|
|
Widget activityTask() {
|
|
|
|
return Container(
|
|
|
|
margin: EdgeInsets.only(bottom:20.h,),
|
|
|
|
child:Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
"活动任务",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 15.sp,
|
|
|
|
fontWeight: MyFontWeight.bold,
|
|
|
|
color: Color(0xFF0D0D0D),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"已完成0/3",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFF4D4D4D),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
SizedBox(height: 12.h,),
|
|
|
|
ListView.builder(
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
itemCount:6,
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
shrinkWrap: true,
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
itemBuilder: (context, position) {
|
|
|
|
return GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
},
|
|
|
|
child: taskItem(),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget taskItem() {
|
|
|
|
return Container(
|
|
|
|
width:double.infinity,
|
|
|
|
height:95.h,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(6),
|
|
|
|
color: Colors.white,
|
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
color: Color(0x08213303).withAlpha(12),
|
|
|
|
offset: Offset(0, 2),
|
|
|
|
blurRadius: 3,
|
|
|
|
spreadRadius: 0,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 12.w,vertical: 12.h),
|
|
|
|
margin: EdgeInsets.only(bottom: 10.h),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
children: [
|
|
|
|
Expanded(child:Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
"海峡姐妹茶新品尝鲜(0/3)",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.bold,
|
|
|
|
color: Color(0xFF353535),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"可获得¥10代金券",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFF4D4D4D),
|
|
|
|
),
|
|
|
|
), Text(
|
|
|
|
"购买任意3杯新品",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 10.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFFB3B3B3),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),),
|
|
|
|
Container(
|
|
|
|
width: 55.w,
|
|
|
|
height: 21.h,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
gradient: new LinearGradient(
|
|
|
|
begin: Alignment.centerLeft,
|
|
|
|
end: Alignment.centerRight,
|
|
|
|
colors: [
|
|
|
|
Color(0xFFFF2700),
|
|
|
|
Color(0xFFFF4F00),
|
|
|
|
],),
|
|
|
|
// border: Border.all(color: Colors.white,width: 0.5),
|
|
|
|
shape: BoxShape.rectangle,
|
|
|
|
borderRadius: BorderRadius.circular(3),
|
|
|
|
),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child:Text(
|
|
|
|
"领取",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFFFFFFFF),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|