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.
236 lines
7.4 KiB
236 lines
7.4 KiB
import 'package:flutter/material.dart'; |
|
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; |
|
import 'package:huixiang/generated/l10n.dart'; |
|
import 'package:huixiang/retrofit/data/sign_info.dart'; |
|
import 'package:huixiang/utils/font_weight.dart'; |
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
import 'package:huixiang/view_widget/round_button.dart'; |
|
|
|
|
|
class InForPoints extends StatefulWidget { |
|
|
|
final SignInfo signInfo; |
|
final Function signIn; |
|
|
|
InForPoints(this.signInfo, this.signIn); |
|
|
|
@override |
|
State<StatefulWidget> createState() { |
|
return _InForPoints(); |
|
} |
|
|
|
} |
|
|
|
class _InForPoints extends State<InForPoints> { |
|
|
|
@override |
|
Widget build(BuildContext context) { |
|
return Container( |
|
width: double.infinity, |
|
margin: EdgeInsets.symmetric(horizontal: 16.w, vertical: 6.h), |
|
padding: EdgeInsets.symmetric(horizontal: 20.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.center, |
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
children: [ |
|
Text( |
|
S.of(context).qiandaolingjifen, |
|
style: TextStyle( |
|
fontWeight: MyFontWeight.medium, |
|
fontSize: 16.sp, |
|
color: Color(0xFF353535), |
|
), |
|
), |
|
SizedBox( |
|
height: 10.h, |
|
), |
|
Text( |
|
S.of(context).lianxuqiandaolingqushuangbeijifen, |
|
style: TextStyle( |
|
fontWeight: MyFontWeight.medium, |
|
fontSize: 11.sp, |
|
color: Color(0xFF727272), |
|
), |
|
), |
|
SizedBox( |
|
height: 32.h, |
|
), |
|
StaggeredGridView.countBuilder( |
|
crossAxisCount: 4, |
|
shrinkWrap: true, |
|
itemCount: 7, |
|
mainAxisSpacing: 8, |
|
crossAxisSpacing: 18, |
|
padding: EdgeInsets.only(bottom: 32), |
|
physics: NeverScrollableScrollPhysics(), |
|
itemBuilder: (context, position) { |
|
return signInItem(position); |
|
}, |
|
staggeredTileBuilder: (position) { |
|
return StaggeredTile.count(position == 6 ? 2 : 1, 1.28); |
|
}, |
|
), |
|
InkWell( |
|
onTap: widget.signIn, |
|
child: Container( |
|
alignment: Alignment.center, |
|
child: RoundButton( |
|
width: 106.w, |
|
height: 34.h, |
|
text: (widget.signInfo != null && widget.signInfo.todayHasSignin) |
|
? S.of(context).yiqiandao |
|
: S.of(context).lijiqiandao, |
|
textColor: Colors.white, |
|
backgroup: (widget.signInfo != null && widget.signInfo.todayHasSignin) |
|
? Colors.grey |
|
: Color(0xFF32A060), |
|
fontSize: 16.sp, |
|
fontWeight: MyFontWeight.regular, |
|
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 6.h), |
|
radius: 4.w, |
|
), |
|
), |
|
), |
|
], |
|
), |
|
); |
|
} |
|
|
|
|
|
Widget signInItem(position) { |
|
if (position == 6) { |
|
return Container( |
|
padding: EdgeInsets.all(4), |
|
decoration: BoxDecoration( |
|
color: Color(0xFFF0F0F2), |
|
borderRadius: BorderRadius.circular(4), |
|
), |
|
child: Row( |
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
children: [ |
|
Expanded( |
|
child: Column( |
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly, |
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
children: [ |
|
Text( |
|
"0${position + 1}", |
|
style: TextStyle( |
|
color: Color(0xFF353535), |
|
fontSize: 14.sp, |
|
fontWeight: MyFontWeight.medium, |
|
), |
|
), |
|
Container( |
|
alignment: Alignment.center, |
|
height: 30.h, |
|
child: Text( |
|
S.of(context).shenmijifendali, |
|
style: TextStyle( |
|
color: Color(0xFF727272), |
|
fontWeight: FontWeight.bold, |
|
fontSize: 10.sp, |
|
), |
|
), |
|
), |
|
Text( |
|
"", |
|
style: TextStyle( |
|
color: Color(0xFF353535), |
|
fontSize: 14.sp, |
|
fontWeight: MyFontWeight.medium, |
|
), |
|
), |
|
], |
|
), |
|
flex: 1, |
|
), |
|
Container( |
|
alignment: Alignment.center, |
|
child: Image.asset( |
|
"assets/image/icon_gold_blessing.png", |
|
width: 59.w, |
|
height: 59.h, |
|
), |
|
), |
|
], |
|
), |
|
); |
|
} else { |
|
return Container( |
|
padding: EdgeInsets.all(4), |
|
decoration: BoxDecoration( |
|
color: (widget.signInfo != null && |
|
widget.signInfo.signInList != null && |
|
widget.signInfo.signInList.length > position) |
|
? Color(0xFF32A060) |
|
: Color(0xFFF0F0F2), |
|
borderRadius: BorderRadius.circular(4), |
|
), |
|
child: Column( |
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly, |
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
children: [ |
|
Text( |
|
"0${position + 1}", |
|
style: TextStyle( |
|
color: (widget.signInfo != null && |
|
widget.signInfo.signInList != null && |
|
widget.signInfo.signInList.length > position) |
|
? Colors.white |
|
: Color(0xFF353535), |
|
fontSize: 14.sp, |
|
fontWeight: MyFontWeight.medium, |
|
), |
|
), |
|
Container( |
|
alignment: Alignment.center, |
|
child: Image.asset( |
|
"assets/image/icon_gold_coin.png", |
|
width: 30.w, |
|
height: 30.h, |
|
), |
|
), |
|
Container( |
|
alignment: Alignment.center, |
|
margin: EdgeInsets.only( |
|
top: 2.h, |
|
), |
|
child: Text( |
|
(widget.signInfo != null && |
|
widget.signInfo.rewardList != null && |
|
widget.signInfo.rewardList.length > position) |
|
? "+${widget.signInfo.rewardList[position]}" |
|
: "+10", |
|
style: TextStyle( |
|
color: (widget.signInfo != null && |
|
widget.signInfo.signInList != null && |
|
widget.signInfo.signInList.length > position) |
|
? Colors.white |
|
: Color(0xFF727272), |
|
fontSize: 12.sp, |
|
fontWeight: MyFontWeight.regular, |
|
), |
|
), |
|
), |
|
], |
|
), |
|
); |
|
} |
|
} |
|
|
|
|
|
}
|
|
|