248 lines
9.5 KiB
Dart
248 lines
9.5 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
import 'package:aslan/app_localizations.dart';
|
|
import 'package:aslan/chatvibe_ui/components/at_debounce_widget.dart';
|
|
import 'package:aslan/chatvibe_ui/components/at_compontent.dart';
|
|
import 'package:aslan/chatvibe_ui/components/text/at_text.dart';
|
|
import 'package:aslan/chatvibe_core/utilities/at_room_utils.dart';
|
|
import 'package:aslan/chatvibe_domain/models/res/at_sign_in_res.dart';
|
|
import 'package:aslan/main.dart';
|
|
import 'package:aslan/chatvibe_core/routes/at_fluro_navigator.dart';
|
|
import 'package:aslan/chatvibe_data/sources/repositories/user_repository_impl.dart';
|
|
import 'package:aslan/chatvibe_domain/models/res/task_checkIn_latest_vip_record_res.dart';
|
|
import 'package:aslan/chatvibe_features/index/main_route.dart';
|
|
|
|
import '../../../chatvibe_data/models/enum/at_activity_reward_props_type.dart';
|
|
|
|
///签到奖励
|
|
class ReciveAwardSginPage extends StatefulWidget {
|
|
ActivityRewardProps? awd;
|
|
int resNum;
|
|
bool fromHome = false;
|
|
|
|
@override
|
|
_ReciveAwardSginPageState createState() => _ReciveAwardSginPageState();
|
|
|
|
ReciveAwardSginPage(this.awd, this.resNum, this.fromHome);
|
|
}
|
|
|
|
class _ReciveAwardSginPageState extends State<ReciveAwardSginPage> {
|
|
List<TaskCheckInLatestVipRecordRes> taskCheckInLatestVipRecordRes = [];
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
AccountRepository()
|
|
.taskCheckInLatestVipRecord()
|
|
.then((result) {
|
|
taskCheckInLatestVipRecordRes = result;
|
|
setState(() {});
|
|
})
|
|
.catchError((e) {});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GestureDetector(
|
|
child: Container(
|
|
height: 400.w,
|
|
margin: EdgeInsets.symmetric(horizontal: 15.w),
|
|
alignment: AlignmentDirectional.center,
|
|
decoration: BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage("atu_images/index/at_icon_sgin_bg.png"),
|
|
fit: BoxFit.fill,
|
|
),
|
|
),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
SizedBox(height: 110.w),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
spacing: 15.w,
|
|
children: [
|
|
Container(
|
|
width: 90.w,
|
|
height: 115.w,
|
|
child: Stack(
|
|
alignment: AlignmentDirectional.center,
|
|
children: [
|
|
Image.asset("atu_images/index/at_icon_sgin_item_bg1.png"),
|
|
widget.awd?.type == ATActivityRewardATPropsType.GOLD.name
|
|
? Image.asset(
|
|
"atu_images/general/at_icon_jb.png",
|
|
width: 36.w,
|
|
height: 36.w,
|
|
)
|
|
: netImage(
|
|
url: widget.awd?.cover ?? "",
|
|
width: 48.w,
|
|
height: 48.w,
|
|
),
|
|
Positioned(
|
|
top: 2,
|
|
right: 13.w,
|
|
child: text(
|
|
"${widget.resNum}",
|
|
fontSize: 11.sp,
|
|
textColor: Colors.white,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
PositionedDirectional(
|
|
bottom: 3.w,
|
|
child:
|
|
widget.awd?.type ==
|
|
ATActivityRewardATPropsType.PROPS.name
|
|
? Row(
|
|
children: [
|
|
text(
|
|
"${widget.awd?.quantity} ${ATAppLocalizations.of(context)!.day}",
|
|
fontSize: 12.sp,
|
|
textColor: Colors.white,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
],
|
|
)
|
|
: Row(
|
|
children: [
|
|
SizedBox(width: 2.w),
|
|
text(
|
|
"${ATAppLocalizations.of(context)!.coins4}*${widget.awd?.amount}",
|
|
fontSize: 12.sp,
|
|
textColor: Colors.white,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
taskCheckInLatestVipRecordRes.isNotEmpty
|
|
? Container(
|
|
width: 90.w,
|
|
height: 115.w,
|
|
child: Stack(
|
|
alignment: AlignmentDirectional.center,
|
|
children: [
|
|
Image.asset(
|
|
getVipBg(
|
|
taskCheckInLatestVipRecordRes.first.vipLevel ?? 0,
|
|
),
|
|
),
|
|
Image.asset(
|
|
"atu_images/general/at_icon_jb3.png",
|
|
width: 48.w,
|
|
height: 48.w,
|
|
),
|
|
|
|
PositionedDirectional(
|
|
bottom: 3.w,
|
|
child: Row(
|
|
children: [
|
|
SizedBox(width: 2.w),
|
|
text(
|
|
"${ATAppLocalizations.of(context)!.coins4}*${taskCheckInLatestVipRecordRes.first.loginRewardsAmount?.toInt() ?? 0}",
|
|
fontSize: 12.sp,
|
|
textColor: Colors.white,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
)
|
|
: Container(),
|
|
],
|
|
),
|
|
SizedBox(height: 10.w),
|
|
taskCheckInLatestVipRecordRes.isNotEmpty
|
|
? Container(
|
|
child: text(
|
|
"${ATAppLocalizations.of(context)!.currentVip}${taskCheckInLatestVipRecordRes.first.vipLevel ?? 0}:",
|
|
fontSize: 16.sp,
|
|
fontWeight: FontWeight.w600,
|
|
textColor: Color(0xffFFBD13),
|
|
),
|
|
)
|
|
: Container(),
|
|
SizedBox(height: 5.w),
|
|
taskCheckInLatestVipRecordRes.isNotEmpty
|
|
? Container(
|
|
alignment: Alignment.center,
|
|
decoration: BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage(
|
|
"atu_images/index/at_icon_sgin_awd_vip_bg2.png",
|
|
),
|
|
fit: BoxFit.fill,
|
|
),
|
|
),
|
|
height: 28.w,
|
|
child: text(
|
|
"${taskCheckInLatestVipRecordRes.first.loginRewardsAmount?.toInt() ?? 0}${ATAppLocalizations.of(context)!.coins4}/${ATAppLocalizations.of(context)!.day}",
|
|
fontSize: 16.sp,
|
|
fontWeight: FontWeight.w400,
|
|
textColor: Color(0xffFFBD13),
|
|
),
|
|
)
|
|
: Container(),
|
|
Spacer(),
|
|
ATDebounceWidget(
|
|
child: Container(
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
SizedBox(width: 10.w),
|
|
Expanded(
|
|
child: text(
|
|
ATAppLocalizations.of(
|
|
context,
|
|
)!.forMoreRewardsPleaseCheckTheTaskCenter,
|
|
fontSize: 14.sp,
|
|
maxLines: 2,
|
|
fontWeight: FontWeight.w600,
|
|
textColor: Color(0xffFFBD13),
|
|
),
|
|
),
|
|
Icon(
|
|
Icons.keyboard_arrow_right_rounded,
|
|
color: Color(0xffFFBD13),
|
|
size: 18.w,
|
|
),
|
|
SizedBox(width: 10.w),
|
|
],
|
|
),
|
|
),
|
|
onTap: () {
|
|
ATRoomUtils.closeAllDialogs();
|
|
if (widget.fromHome) {
|
|
ATNavigatorUtils.push(
|
|
navigatorKey.currentContext!,
|
|
MainRoute.taskList,
|
|
replace: false,
|
|
);
|
|
}
|
|
},
|
|
),
|
|
SizedBox(height: 25.w),
|
|
],
|
|
),
|
|
),
|
|
onTap: () {
|
|
SmartDialog.dismiss(tag: "showSginListAward");
|
|
},
|
|
);
|
|
}
|
|
|
|
String getVipBg(num vipLevel) {
|
|
return "atu_images/index/at_icon_sgin_awd_vip_${vipLevel}_bg.png";
|
|
}
|
|
}
|