583 lines
29 KiB
Dart
583 lines
29 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_compontent.dart';
|
|
import 'package:aslan/chatvibe_ui/components/text/at_text.dart';
|
|
import 'package:aslan/chatvibe_core/constants/at_global_config.dart';
|
|
import 'package:aslan/chatvibe_data/sources/repositories/room_repository_imp.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:aslan/chatvibe_core/utilities/at_room_utils.dart';
|
|
import 'package:aslan/chatvibe_domain/models/res/at_room_rocket_config_res.dart';
|
|
import 'package:aslan/chatvibe_domain/models/res/at_room_rocket_status_res.dart';
|
|
import 'package:aslan/chatvibe_managers/rtc_manager.dart';
|
|
|
|
import '../../../../chatvibe_data/models/enum/at_activity_reward_props_type.dart';
|
|
|
|
class RoomRocketPage extends StatefulWidget {
|
|
@override
|
|
_RoomRocketPageState createState() => _RoomRocketPageState();
|
|
}
|
|
|
|
class _RoomRocketPageState extends State<RoomRocketPage> {
|
|
ATRoomRocketConfigRes? rocketLevel1;
|
|
ATRoomRocketConfigRes? rocketLevel2;
|
|
ATRoomRocketConfigRes? rocketLevel3;
|
|
ATRoomRocketConfigRes? currernRocketLevel;
|
|
ATRoomRocketStatusRes? roomRocketStatus;
|
|
bool _isLoading = true;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
roomRocketStatus =
|
|
Provider.of<RtcProvider>(context, listen: false).roomRocketStatus;
|
|
ChatRoomRepository()
|
|
.rocketConfigEnabled()
|
|
.then((res) {
|
|
rocketLevel1 = res.first;
|
|
rocketLevel2 = res[1];
|
|
rocketLevel3 = res[2];
|
|
if (roomRocketStatus?.level == 1) {
|
|
currernRocketLevel = rocketLevel1;
|
|
} else if (roomRocketStatus?.level == 2) {
|
|
currernRocketLevel = rocketLevel2;
|
|
} else if (roomRocketStatus?.level == 3) {
|
|
currernRocketLevel = rocketLevel3;
|
|
}
|
|
_isLoading = false;
|
|
setState(() {});
|
|
})
|
|
.catchError((e) {
|
|
setState(() {
|
|
_isLoading = false;
|
|
});
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Directionality(
|
|
textDirection: TextDirection.ltr,
|
|
child: SafeArea(
|
|
top: false,
|
|
child: Container(
|
|
width: ScreenUtil().screenWidth,
|
|
height: ScreenUtil().screenHeight * 0.75,
|
|
decoration: BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage("atu_images/room/at_icon_room_rocket_bg.png"),
|
|
fit: BoxFit.fitWidth,
|
|
),
|
|
),
|
|
child: _isLoading?Container():SingleChildScrollView(
|
|
child: Stack(
|
|
alignment: AlignmentDirectional.topCenter,
|
|
children: [
|
|
PositionedDirectional(
|
|
top: 30.w,
|
|
child: Image.asset(
|
|
"atu_images/room/at_icon_room_rocket_lv${currernRocketLevel?.level ?? 1}.png",
|
|
width: 140.w,
|
|
height: 190.w,
|
|
),
|
|
),
|
|
Column(
|
|
children: [
|
|
SizedBox(height: 130.w),
|
|
GestureDetector(
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
Image.asset(
|
|
(currernRocketLevel?.level ?? 1) == 3
|
|
? "atu_images/room/at_icon_lab_lv3_en.png"
|
|
: "atu_images/room/at_icon_lab_lv3_un.png",
|
|
width:
|
|
(currernRocketLevel?.level ?? 1) == 3
|
|
? 80.w
|
|
: 50.w,
|
|
),
|
|
],
|
|
),
|
|
onTap: () {
|
|
currernRocketLevel = rocketLevel3;
|
|
setState(() {});
|
|
},
|
|
),
|
|
SizedBox(height: 10.w),
|
|
GestureDetector(
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
Image.asset(
|
|
(currernRocketLevel?.level ?? 1) == 2
|
|
? "atu_images/room/at_icon_lab_lv2_en.png"
|
|
: "atu_images/room/at_icon_lab_lv2_un.png",
|
|
width:
|
|
(currernRocketLevel?.level ?? 1) == 2
|
|
? 80.w
|
|
: 50.w,
|
|
),
|
|
],
|
|
),
|
|
onTap: () {
|
|
currernRocketLevel = rocketLevel2;
|
|
setState(() {});
|
|
},
|
|
),
|
|
SizedBox(height: 10.w),
|
|
GestureDetector(
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
Image.asset(
|
|
(currernRocketLevel?.level ?? 1) == 1
|
|
? "atu_images/room/at_icon_lab_lv1_en.png"
|
|
: "atu_images/room/at_icon_lab_lv1_un.png",
|
|
width:
|
|
(currernRocketLevel?.level ?? 1) == 1
|
|
? 80.w
|
|
: 50.w,
|
|
),
|
|
],
|
|
),
|
|
onTap: () {
|
|
currernRocketLevel = rocketLevel1;
|
|
setState(() {});
|
|
},
|
|
),
|
|
SizedBox(height: 15.w),
|
|
Container(
|
|
decoration: BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage(
|
|
"atu_images/room/at_icon_room_rocket_title_bg.png",
|
|
),
|
|
fit: BoxFit.fill,
|
|
),
|
|
),
|
|
margin: EdgeInsets.symmetric(horizontal: 15.w),
|
|
width: ScreenUtil().screenWidth,
|
|
height: 100.w,
|
|
child: Stack(
|
|
alignment: AlignmentDirectional.center,
|
|
children: [
|
|
Consumer<RtcProvider>(
|
|
builder: (context, ref, child) {
|
|
return Row(
|
|
children: [
|
|
SizedBox(width: 22.w),
|
|
Image.asset(
|
|
"atu_images/room/at_icon_room_rocket_lv${currernRocketLevel?.level ?? 1}_text.png",
|
|
width: 25.w,
|
|
),
|
|
SizedBox(width: 10.w),
|
|
Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.start,
|
|
children: [
|
|
text(
|
|
"${ref.roomRocketStatus?.currentEnergy}/${currernRocketLevel?.maxEnergy}",
|
|
fontSize: 13.sp,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
Stack(
|
|
alignment:
|
|
AlignmentDirectional.centerStart,
|
|
children: [
|
|
Container(
|
|
width: 250.w,
|
|
height: 8.w,
|
|
decoration: BoxDecoration(
|
|
borderRadius:
|
|
BorderRadius.circular(5),
|
|
color: Color(0xff17224B),
|
|
border: Border.all(
|
|
color: Color(0xffF9CE82),
|
|
width: 1.w,
|
|
),
|
|
),
|
|
),
|
|
Row(
|
|
children: [
|
|
Container(
|
|
width: ATRoomUtils.collectCurrenProgressProcess(
|
|
(ref
|
|
.roomRocketStatus
|
|
?.currentEnergy ??
|
|
0),
|
|
(currernRocketLevel?.maxEnergy ?? 1),
|
|
250.w,
|
|
),
|
|
height: 8.w,
|
|
decoration: BoxDecoration(
|
|
borderRadius:
|
|
BorderRadius.circular(5),
|
|
gradient: LinearGradient(
|
|
colors: [
|
|
Color(0xFF2E4AFE),
|
|
Color(0xFF04A5FF),
|
|
Color(0xFF05FEFF),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Transform.translate(
|
|
offset: Offset(-5, 0),
|
|
child: Image.asset(
|
|
"atu_images/room/at_icon_room_rocket_progress_lv${(currernRocketLevel?.level ?? 1)}_tag.png",
|
|
width: 35.w,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
],
|
|
);
|
|
},
|
|
),
|
|
PositionedDirectional(
|
|
end: 30.w,
|
|
top: 20.w,
|
|
child: GestureDetector(
|
|
child: Image.asset(
|
|
"atu_images/room/at_icon_room_rocket_help.png",
|
|
width: 30.w,
|
|
),
|
|
onTap: () {
|
|
SmartDialog.show(
|
|
tag: "showRoomRocketHelpDialog",
|
|
alignment: Alignment.center,
|
|
debounce: true,
|
|
animationType: SmartAnimationType.fade,
|
|
builder: (_) {
|
|
return Container(
|
|
width: ScreenUtil().screenWidth,
|
|
margin: EdgeInsets.symmetric(
|
|
horizontal: 15.w,
|
|
),
|
|
padding: EdgeInsets.symmetric(
|
|
horizontal: 20.w,
|
|
),
|
|
decoration: BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage(
|
|
"atu_images/room/at_icon_room_rocket_hepl_bg.png",
|
|
),
|
|
fit: BoxFit.fill,
|
|
),
|
|
),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
SizedBox(height: 13.w),
|
|
Image.asset(
|
|
ATGlobalConfig.lang == "ar"
|
|
? "atu_images/room/at_icon_room_rocket_rule_text_ar.png"
|
|
: "atu_images/room/at_icon_room_rocket_rule_text_en.png",
|
|
width: 58.w,
|
|
),
|
|
SizedBox(height: 8.w),
|
|
text(
|
|
ATAppLocalizations.of(
|
|
context,
|
|
)!.roomRocketHelpTips,
|
|
maxLines: 25,
|
|
fontSize: 14.sp,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
SizedBox(height: 20.w),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
);
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
SizedBox(height: 10.w),
|
|
Container(
|
|
decoration: BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage(
|
|
"atu_images/room/at_icon_room_rocket_rew_bg.png",
|
|
),
|
|
fit: BoxFit.fill,
|
|
),
|
|
),
|
|
margin: EdgeInsets.symmetric(horizontal: 15.w),
|
|
width: ScreenUtil().screenWidth,
|
|
height: 170.w,
|
|
child: Row(
|
|
children: [
|
|
SizedBox(width: 20.w),
|
|
Container(
|
|
width: 118.w,
|
|
height: 118.w,
|
|
alignment: AlignmentDirectional.center,
|
|
decoration: BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage(
|
|
"atu_images/room/at_icon_room_rocket_rew_item_bg.png",
|
|
),
|
|
fit: BoxFit.fill,
|
|
),
|
|
),
|
|
child:
|
|
(currernRocketLevel?.rewardConfig ?? [])
|
|
.isNotEmpty
|
|
? (currernRocketLevel!
|
|
.rewardConfig!
|
|
.first
|
|
.type ==
|
|
ATActivityRewardATPropsType.GOLD.name
|
|
? Image.asset(
|
|
"atu_images/general/at_icon_jb.png",
|
|
width: 82.w,
|
|
height: 82.w,
|
|
)
|
|
: netImage(
|
|
url:
|
|
currernRocketLevel!
|
|
.rewardConfig!
|
|
.first
|
|
.cover ??
|
|
"",
|
|
width: 82.w,
|
|
height: 82.w,
|
|
))
|
|
: Container(),
|
|
),
|
|
SizedBox(width: 5.w),
|
|
Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Container(
|
|
width: 57.w,
|
|
height: 57.w,
|
|
alignment: AlignmentDirectional.center,
|
|
decoration: BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage(
|
|
"atu_images/room/at_icon_room_rocket_rew_item_bg.png",
|
|
),
|
|
fit: BoxFit.fill,
|
|
),
|
|
),
|
|
child:
|
|
(currernRocketLevel?.rewardConfig ?? [])
|
|
.length >
|
|
1
|
|
? (currernRocketLevel!
|
|
.rewardConfig![1]
|
|
.type ==
|
|
ATActivityRewardATPropsType
|
|
.GOLD
|
|
.name
|
|
? Image.asset(
|
|
"atu_images/general/at_icon_jb.png",
|
|
width: 40.w,
|
|
height: 40.w,
|
|
)
|
|
: netImage(
|
|
url:
|
|
currernRocketLevel!
|
|
.rewardConfig![1]
|
|
.cover ??
|
|
"",
|
|
width: 40.w,
|
|
height: 40.w,
|
|
))
|
|
: Container(),
|
|
),
|
|
SizedBox(width: 5.w),
|
|
Container(
|
|
width: 57.w,
|
|
height: 57.w,
|
|
alignment: AlignmentDirectional.center,
|
|
decoration: BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage(
|
|
"atu_images/room/at_icon_room_rocket_rew_item_bg.png",
|
|
),
|
|
fit: BoxFit.fill,
|
|
),
|
|
),
|
|
child:
|
|
(currernRocketLevel?.rewardConfig ?? [])
|
|
.length >
|
|
2
|
|
? (currernRocketLevel!
|
|
.rewardConfig![2]
|
|
.type ==
|
|
ATActivityRewardATPropsType
|
|
.GOLD
|
|
.name
|
|
? Image.asset(
|
|
"atu_images/general/at_icon_jb.png",
|
|
width: 40.w,
|
|
height: 40.w,
|
|
)
|
|
: netImage(
|
|
url:
|
|
currernRocketLevel!
|
|
.rewardConfig![2]
|
|
.cover ??
|
|
"",
|
|
width: 40.w,
|
|
height: 40.w,
|
|
))
|
|
: Container(),
|
|
),
|
|
SizedBox(width: 5.w),
|
|
Container(
|
|
width: 57.w,
|
|
height: 57.w,
|
|
alignment: AlignmentDirectional.center,
|
|
decoration: BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage(
|
|
"atu_images/room/at_icon_room_rocket_rew_item_bg.png",
|
|
),
|
|
fit: BoxFit.fill,
|
|
),
|
|
),
|
|
child:
|
|
(currernRocketLevel?.rewardConfig ?? [])
|
|
.length >
|
|
3
|
|
? (currernRocketLevel!
|
|
.rewardConfig![3]
|
|
.type ==
|
|
ATActivityRewardATPropsType
|
|
.GOLD
|
|
.name
|
|
? Image.asset(
|
|
"atu_images/general/at_icon_jb.png",
|
|
width: 40.w,
|
|
height: 40.w,
|
|
)
|
|
: netImage(
|
|
url:
|
|
currernRocketLevel!
|
|
.rewardConfig![3]
|
|
.cover ??
|
|
"",
|
|
width: 40.w,
|
|
height: 40.w,
|
|
))
|
|
: Container(),
|
|
),
|
|
],
|
|
),
|
|
SizedBox(height: 5.w),
|
|
Row(
|
|
children: [
|
|
Container(
|
|
width: 57.w,
|
|
height: 57.w,
|
|
alignment: AlignmentDirectional.center,
|
|
decoration: BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage(
|
|
"atu_images/room/at_icon_room_rocket_rew_item_bg.png",
|
|
),
|
|
fit: BoxFit.fill,
|
|
),
|
|
),
|
|
child:
|
|
(currernRocketLevel?.rewardConfig ?? [])
|
|
.length >
|
|
4
|
|
? (currernRocketLevel!
|
|
.rewardConfig![4]
|
|
.type ==
|
|
ATActivityRewardATPropsType
|
|
.GOLD
|
|
.name
|
|
? Image.asset(
|
|
"atu_images/general/at_icon_jb.png",
|
|
width: 40.w,
|
|
height: 40.w,
|
|
)
|
|
: netImage(
|
|
url:
|
|
currernRocketLevel!
|
|
.rewardConfig![4]
|
|
.cover ??
|
|
"",
|
|
width: 40.w,
|
|
height: 40.w,
|
|
))
|
|
: Container(),
|
|
),
|
|
SizedBox(width: 5.w),
|
|
Container(
|
|
width: 57.w,
|
|
height: 57.w,
|
|
alignment: AlignmentDirectional.center,
|
|
decoration: BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage(
|
|
"atu_images/room/at_icon_room_rocket_rew_item_bg.png",
|
|
),
|
|
fit: BoxFit.fill,
|
|
),
|
|
),
|
|
child:
|
|
(currernRocketLevel?.rewardConfig ?? [])
|
|
.length >
|
|
5
|
|
? (currernRocketLevel!
|
|
.rewardConfig![5]
|
|
.type ==
|
|
ATActivityRewardATPropsType
|
|
.GOLD
|
|
.name
|
|
? Image.asset(
|
|
"atu_images/general/at_icon_jb.png",
|
|
width: 40.w,
|
|
height: 40.w,
|
|
)
|
|
: netImage(
|
|
url:
|
|
currernRocketLevel!
|
|
.rewardConfig![5]
|
|
.cover ??
|
|
"",
|
|
width: 40.w,
|
|
height: 40.w,
|
|
))
|
|
: Container(),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
}
|