|
|
|
import 'package:dio/dio.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_swiper/flutter_swiper.dart';
|
|
|
|
import 'package:huixiang/generated/l10n.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/activity.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/base_data.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/page.dart';
|
|
|
|
import 'package:huixiang/retrofit/retrofit_api.dart';
|
|
|
|
import 'package:huixiang/utils/font_weight.dart';
|
|
|
|
import 'package:huixiang/view_widget/classic_header.dart';
|
|
|
|
import 'package:huixiang/view_widget/item_title.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();
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
}
|
|
|
|
|
|
|
|
@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: 125.h,left: 14,right: 14),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(6),
|
|
|
|
color: Color(0xFFF9FAF7),
|
|
|
|
),
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
child: FutureBuilder(
|
|
|
|
// future: querySignInfo(),
|
|
|
|
builder: (context, snap) {
|
|
|
|
return Column(
|
|
|
|
children: [
|
|
|
|
weekCoupons(),
|
|
|
|
|
|
|
|
inviteFriends(),
|
|
|
|
|
|
|
|
activityTask(),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// 周券包推荐
|
|
|
|
Widget weekCoupons() {
|
|
|
|
return Container(
|
|
|
|
width: double.infinity,
|
|
|
|
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(
|
|
|
|
"本周劵包 ",
|
|
|
|
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,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget weekItem() {
|
|
|
|
return Container(
|
|
|
|
width:double.infinity,
|
|
|
|
height:100.h,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
image: DecorationImage(
|
|
|
|
fit: BoxFit.fill,
|
|
|
|
image: AssetImage("assets/image/week_coupons.png"),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 10.w,vertical: 10.h),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Expanded(child:
|
|
|
|
Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Expanded(child: Text(
|
|
|
|
"百年川椒(哈乐城店)",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.bold,
|
|
|
|
color: Color(0xFF0D0D0D),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
Text(
|
|
|
|
"新人满减30元",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 11.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFF4D4D4D),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(height:4.h,),
|
|
|
|
Text(
|
|
|
|
"有效期至2022-09-10 12:00:00",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 11.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFF4D4D4D),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Text.rich(
|
|
|
|
TextSpan(
|
|
|
|
children: [
|
|
|
|
TextSpan(
|
|
|
|
text: "¥",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.semi_bold,
|
|
|
|
color: Color(0xFFFF4500),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
TextSpan(
|
|
|
|
text: "30",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 24.sp,
|
|
|
|
fontWeight: MyFontWeight.semi_bold,
|
|
|
|
color: Color(0xFFFF4500),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Expanded(child: Text(
|
|
|
|
"满30.1可用",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFFFF4500),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
Container(
|
|
|
|
width: 55.w,
|
|
|
|
height: 19.h,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
gradient: new LinearGradient(
|
|
|
|
begin: Alignment.bottomCenter,
|
|
|
|
end: Alignment.topCenter,
|
|
|
|
colors: [
|
|
|
|
Color(0xFFFF4F00),
|
|
|
|
Color(0xFFFF2700),
|
|
|
|
]),
|
|
|
|
// 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),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///邀请好友
|
|
|
|
Widget inviteFriends() {
|
|
|
|
return Container(
|
|
|
|
margin: EdgeInsets.only(right:14.w,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 activityTask() {
|
|
|
|
return Container(
|
|
|
|
margin: EdgeInsets.only(right:14.w,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),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|