|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:huixiang/generated/l10n.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/sign_info.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/task.dart';
|
|
|
|
import 'package:huixiang/utils/font_weight.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:huixiang/view_widget/round_button.dart';
|
|
|
|
|
|
|
|
class IntegralTask extends StatefulWidget {
|
|
|
|
final SignInfo signInfo;
|
|
|
|
|
|
|
|
IntegralTask(this.signInfo);
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() {
|
|
|
|
return _IntegralTask();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class _IntegralTask extends State<IntegralTask> {
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Container(
|
|
|
|
width: MediaQuery.of(context).size.width - 32,
|
|
|
|
height: 320.h,
|
|
|
|
margin: EdgeInsets.all(16),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: 10.w,
|
|
|
|
vertical: 20.h,
|
|
|
|
),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.white,
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
color: Colors.black.withAlpha(12),
|
|
|
|
offset: Offset(0, 3),
|
|
|
|
blurRadius: 14,
|
|
|
|
spreadRadius: 0,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(left: 10.w),
|
|
|
|
child: Text(
|
|
|
|
S.of(context).zuorenwudejifen,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF353535),
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
fontSize: 16.sp,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
child: ListView.builder(
|
|
|
|
padding: EdgeInsets.only(left: 10.w, top: 20.h),
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
// loop: false,
|
|
|
|
// pagination: SwiperPagination(
|
|
|
|
// alignment: Alignment.bottomCenter,
|
|
|
|
// builder: DotSwiperPaginationBuilder(
|
|
|
|
// size: 8,
|
|
|
|
// activeSize: 8,
|
|
|
|
// space: 5,
|
|
|
|
// activeColor: Colors.black,
|
|
|
|
// color: Colors.black.withAlpha(76),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
itemBuilder: (context, position) {
|
|
|
|
return taskItem(widget.signInfo.taskList[position]);
|
|
|
|
},
|
|
|
|
itemCount: (widget.signInfo != null &&
|
|
|
|
widget.signInfo.taskList != null &&
|
|
|
|
widget.signInfo.taskList.length > 0)
|
|
|
|
? widget.signInfo.taskList.length
|
|
|
|
: 0),
|
|
|
|
),
|
|
|
|
flex: 1,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget taskPage(position) {
|
|
|
|
if (widget.signInfo == null || widget.signInfo.taskList == null)
|
|
|
|
return Container();
|
|
|
|
return Container(
|
|
|
|
margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 16.h),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
taskItem(widget.signInfo.taskList[position * 3 + 0]),
|
|
|
|
if (widget.signInfo.taskList.length > (position * 3 + 1))
|
|
|
|
taskItem(widget.signInfo.taskList[position * 3 + 1]),
|
|
|
|
if (widget.signInfo.taskList.length > (position * 3 + 2))
|
|
|
|
taskItem(widget.signInfo.taskList[position * 3 + 2]),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
taskImg(String taskType) {
|
|
|
|
switch (taskType) {
|
|
|
|
case "bill_type_point_order":
|
|
|
|
return "assets/image/icon_integral_login.png";
|
|
|
|
break;
|
|
|
|
case "bill_type_point_share":
|
|
|
|
return "assets/image/icon_integral_share.png";
|
|
|
|
break;
|
|
|
|
case "bill_type_point_login":
|
|
|
|
return "assets/image/icon_integral_order.png";
|
|
|
|
break;
|
|
|
|
case "bill_type_point_signin":
|
|
|
|
return "assets/image/icon_integral_sign.png";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return "assets/image/icon_integral_login.png";
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget taskItem(Task task) {
|
|
|
|
return Container(
|
|
|
|
margin: EdgeInsets.only(top: 8.h, bottom: 8.h),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
taskImg(task.type),
|
|
|
|
width: 24.w,
|
|
|
|
height: 24.h,
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 21.w,
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
flex: 1,
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
task.name,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFF353535),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 7.h,
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
"+${double.tryParse(task.rewardValue).toInt()}",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFF727272),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 20.w,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
S.of(context).wancheng_(
|
|
|
|
"${task.complateNum ?? task.conplateNum}/${task.limitDay}"),
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFF727272),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
task.limitDay == (task.complateNum ?? task.conplateNum)
|
|
|
|
? RoundButton(
|
|
|
|
text: task.limitDay == (task.complateNum ?? task.conplateNum)
|
|
|
|
? S.of(context).yiwancheng
|
|
|
|
: S.of(context).quwancheng,
|
|
|
|
textColor:
|
|
|
|
task.limitDay == (task.complateNum ?? task.conplateNum)
|
|
|
|
? Color(0xFF808080)
|
|
|
|
: Colors.white,
|
|
|
|
backgroup:
|
|
|
|
task.limitDay == (task.complateNum ?? task.conplateNum)
|
|
|
|
? Color(0xFFF5F6FA)
|
|
|
|
: Color(0xFF32A060),
|
|
|
|
radius: 12.w,
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.semi_bold,
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
vertical: 4.h,
|
|
|
|
horizontal: 15.w,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: RoundButton(
|
|
|
|
text: "x${double.tryParse(task.rewardValue).toInt()}",
|
|
|
|
textColor:
|
|
|
|
task.limitDay == (task.complateNum ?? task.conplateNum)
|
|
|
|
? Color(0xFF808080)
|
|
|
|
: Colors.white,
|
|
|
|
backgroup:
|
|
|
|
task.limitDay == (task.complateNum ?? task.conplateNum)
|
|
|
|
? Color(0xFFF5F6FA)
|
|
|
|
: Color(0xFF32A060),
|
|
|
|
icons: Image.asset(
|
|
|
|
"assets/image/icon_gold_coin.png",
|
|
|
|
width: 16,
|
|
|
|
height: 16,
|
|
|
|
),
|
|
|
|
radius: 12.w,
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.semi_bold,
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
vertical: 4.h,
|
|
|
|
horizontal: 14.w,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|