修改礼物bag
This commit is contained in:
parent
74e8162c1f
commit
4b637d4137
@ -676,6 +676,7 @@ class _GiftPageState extends State<GiftPage> with TickerProviderStateMixin {
|
|||||||
color: const Color(0xff09372E).withValues(alpha: 0.5),
|
color: const Color(0xff09372E).withValues(alpha: 0.5),
|
||||||
constraints: BoxConstraints(maxHeight: 430.w),
|
constraints: BoxConstraints(maxHeight: 430.w),
|
||||||
child: Column(
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(height: 12.w),
|
SizedBox(height: 12.w),
|
||||||
Row(
|
Row(
|
||||||
@ -782,7 +783,8 @@ class _GiftPageState extends State<GiftPage> with TickerProviderStateMixin {
|
|||||||
SizedBox(width: 5.w),
|
SizedBox(width: 5.w),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Expanded(
|
SizedBox(
|
||||||
|
height: kGiftTabPageHeight.w,
|
||||||
child: TabBarView(
|
child: TabBarView(
|
||||||
physics: NeverScrollableScrollPhysics(),
|
physics: NeverScrollableScrollPhysics(),
|
||||||
controller: tabController,
|
controller: tabController,
|
||||||
|
|||||||
@ -18,6 +18,29 @@ enum _GiftGridPageStatus { idle, loading, ready }
|
|||||||
|
|
||||||
const Duration _kGiftPageSkeletonMinDuration = Duration(milliseconds: 420);
|
const Duration _kGiftPageSkeletonMinDuration = Duration(milliseconds: 420);
|
||||||
const Duration _kGiftPageSkeletonMaxDuration = Duration(milliseconds: 900);
|
const Duration _kGiftPageSkeletonMaxDuration = Duration(milliseconds: 900);
|
||||||
|
const int _kGiftGridColumnCount = 4;
|
||||||
|
const int _kGiftGridRowCount = 2;
|
||||||
|
const double _kGiftGridCardHeight = 76;
|
||||||
|
const double _kGiftGridVerticalPadding = 5;
|
||||||
|
const double _kGiftGridMainAxisSpacing = 2;
|
||||||
|
const double _kGiftGridCrossAxisSpacing = 8;
|
||||||
|
const double _kGiftCardVerticalPadding = 5;
|
||||||
|
const double _kGiftIconPriceSpacing = 1;
|
||||||
|
const double _kGiftPriceRowHeight = 14;
|
||||||
|
const double _kGiftGridTopGap = 5;
|
||||||
|
const double _kGiftIndicatorTopGap = 5;
|
||||||
|
const double _kGiftPageIndicatorHeight = 6.5;
|
||||||
|
const double _kGiftGridBottomPadding = 6;
|
||||||
|
const double _kGiftGridHeight =
|
||||||
|
_kGiftGridCardHeight * _kGiftGridRowCount +
|
||||||
|
_kGiftGridMainAxisSpacing * (_kGiftGridRowCount - 1) +
|
||||||
|
_kGiftGridVerticalPadding * 2;
|
||||||
|
const double kGiftTabPageHeight =
|
||||||
|
_kGiftGridTopGap +
|
||||||
|
_kGiftGridHeight +
|
||||||
|
_kGiftIndicatorTopGap +
|
||||||
|
_kGiftPageIndicatorHeight +
|
||||||
|
_kGiftGridBottomPadding;
|
||||||
|
|
||||||
class GiftTabPage extends StatefulWidget {
|
class GiftTabPage extends StatefulWidget {
|
||||||
final String type;
|
final String type;
|
||||||
@ -72,8 +95,9 @@ class _GiftTabPageState extends State<GiftTabPage>
|
|||||||
))
|
))
|
||||||
: Column(
|
: Column(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(height: 23.w),
|
SizedBox(height: _kGiftGridTopGap.w),
|
||||||
Expanded(
|
SizedBox(
|
||||||
|
height: _kGiftGridHeight.w,
|
||||||
child: PageView.builder(
|
child: PageView.builder(
|
||||||
controller: _giftPageController,
|
controller: _giftPageController,
|
||||||
onPageChanged: (i) {
|
onPageChanged: (i) {
|
||||||
@ -95,16 +119,7 @@ class _GiftTabPageState extends State<GiftTabPage>
|
|||||||
_GiftGridPageStatus.ready) {
|
_GiftGridPageStatus.ready) {
|
||||||
return _buildGiftPageSkeleton();
|
return _buildGiftPageSkeleton();
|
||||||
}
|
}
|
||||||
return GridView.builder(
|
return _buildGiftGrid(
|
||||||
shrinkWrap: true,
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 12.w),
|
|
||||||
physics: NeverScrollableScrollPhysics(),
|
|
||||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
||||||
crossAxisCount: 4,
|
|
||||||
childAspectRatio: 0.75,
|
|
||||||
mainAxisSpacing: 8.w,
|
|
||||||
crossAxisSpacing: 8.w,
|
|
||||||
),
|
|
||||||
itemCount: size,
|
itemCount: size,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
return _bagItem(gifts[(i * 8) + index], ref);
|
return _bagItem(gifts[(i * 8) + index], ref);
|
||||||
@ -114,8 +129,9 @@ class _GiftTabPageState extends State<GiftTabPage>
|
|||||||
itemCount: (gifts.length / 8).ceil(),
|
itemCount: (gifts.length / 8).ceil(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
SizedBox(height: _kGiftIndicatorTopGap.w),
|
||||||
_indicator(ref),
|
_indicator(ref),
|
||||||
SizedBox(height: 10.w),
|
SizedBox(height: _kGiftGridBottomPadding.w),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -206,18 +222,11 @@ class _GiftTabPageState extends State<GiftTabPage>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
GridView.builder(
|
Positioned.fill(
|
||||||
shrinkWrap: true,
|
child: _buildGiftGrid(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 12.w),
|
itemCount: 8,
|
||||||
physics: NeverScrollableScrollPhysics(),
|
itemBuilder: (context, index) => _buildGiftSkeletonCard(),
|
||||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
||||||
crossAxisCount: 4,
|
|
||||||
childAspectRatio: 0.75,
|
|
||||||
mainAxisSpacing: 8.w,
|
|
||||||
crossAxisSpacing: 8.w,
|
|
||||||
),
|
),
|
||||||
itemCount: 8,
|
|
||||||
itemBuilder: (context, index) => _buildGiftSkeletonCard(),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -226,42 +235,71 @@ class _GiftTabPageState extends State<GiftTabPage>
|
|||||||
Widget _buildGiftSkeletonCard() {
|
Widget _buildGiftSkeletonCard() {
|
||||||
final baseColor = Colors.white.withValues(alpha: 0.12);
|
final baseColor = Colors.white.withValues(alpha: 0.12);
|
||||||
return Container(
|
return Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(borderRadius: BorderRadius.circular(12.w)),
|
||||||
borderRadius: BorderRadius.circular(12.w),
|
child: Padding(
|
||||||
color: Colors.white.withValues(alpha: 0.08),
|
padding: EdgeInsets.symmetric(vertical: _kGiftCardVerticalPadding.w),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 48.w,
|
||||||
|
height: 48.w,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(12.w),
|
||||||
|
color: baseColor,
|
||||||
|
),
|
||||||
|
child: Center(child: SCRotatingDotsLoading(size: 24.w)),
|
||||||
|
),
|
||||||
|
SizedBox(height: _kGiftIconPriceSpacing.w),
|
||||||
|
Container(
|
||||||
|
width: 52.w,
|
||||||
|
height: 8.w,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(999.w),
|
||||||
|
color: baseColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
child: Column(
|
);
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
}
|
||||||
children: [
|
|
||||||
Container(
|
Widget _buildGiftGrid({
|
||||||
width: 48.w,
|
required int itemCount,
|
||||||
height: 48.w,
|
required IndexedWidgetBuilder itemBuilder,
|
||||||
decoration: BoxDecoration(
|
}) {
|
||||||
borderRadius: BorderRadius.circular(12.w),
|
return LayoutBuilder(
|
||||||
color: baseColor,
|
builder: (context, constraints) {
|
||||||
),
|
final horizontalPadding = 12.w;
|
||||||
child: Center(child: SCRotatingDotsLoading(size: 24.w)),
|
final verticalPadding = _kGiftGridVerticalPadding.w;
|
||||||
|
final mainAxisSpacing = _kGiftGridMainAxisSpacing.w;
|
||||||
|
final crossAxisSpacing = _kGiftGridCrossAxisSpacing.w;
|
||||||
|
final itemHeight = _kGiftGridCardHeight.w;
|
||||||
|
final gridWidth =
|
||||||
|
constraints.maxWidth -
|
||||||
|
horizontalPadding * 2 -
|
||||||
|
crossAxisSpacing * (_kGiftGridColumnCount - 1);
|
||||||
|
final itemWidth = (gridWidth / _kGiftGridColumnCount).clamp(
|
||||||
|
1.0,
|
||||||
|
double.infinity,
|
||||||
|
);
|
||||||
|
return GridView.builder(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: horizontalPadding,
|
||||||
|
vertical: verticalPadding,
|
||||||
),
|
),
|
||||||
SizedBox(height: 7.w),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
Container(
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
width: 52.w,
|
crossAxisCount: _kGiftGridColumnCount,
|
||||||
height: 8.w,
|
childAspectRatio: itemWidth / itemHeight,
|
||||||
decoration: BoxDecoration(
|
mainAxisSpacing: mainAxisSpacing,
|
||||||
borderRadius: BorderRadius.circular(999.w),
|
crossAxisSpacing: crossAxisSpacing,
|
||||||
color: baseColor,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
SizedBox(height: 6.w),
|
itemCount: itemCount,
|
||||||
Container(
|
itemBuilder: itemBuilder,
|
||||||
width: 40.w,
|
);
|
||||||
height: 8.w,
|
},
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(999.w),
|
|
||||||
color: baseColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,40 +335,45 @@ class _GiftTabPageState extends State<GiftTabPage>
|
|||||||
Widget _bagItem(SocialChatGiftRes gift, SCAppGeneralManager ref) {
|
Widget _bagItem(SocialChatGiftRes gift, SCAppGeneralManager ref) {
|
||||||
return gift.id == "-1000"
|
return gift.id == "-1000"
|
||||||
? GestureDetector(
|
? GestureDetector(
|
||||||
|
behavior: HitTestBehavior.opaque,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(12.w),
|
borderRadius: BorderRadius.circular(12.w),
|
||||||
color: Colors.white10,
|
|
||||||
border: Border.all(color: Colors.transparent, width: 1.w),
|
border: Border.all(color: Colors.transparent, width: 1.w),
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Padding(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
padding: EdgeInsets.symmetric(
|
||||||
children: [
|
vertical: _kGiftCardVerticalPadding.w,
|
||||||
Image.asset(
|
),
|
||||||
_strategy.getGiftPageCustomizedRuleIcon(),
|
child: Column(
|
||||||
fit: BoxFit.cover,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
width: 48.w,
|
children: [
|
||||||
height: 48.w,
|
Image.asset(
|
||||||
),
|
_strategy.getGiftPageCustomizedRuleIcon(),
|
||||||
SizedBox(height: 5.w),
|
fit: BoxFit.cover,
|
||||||
Container(
|
width: 48.w,
|
||||||
height: 23.w,
|
height: 48.w,
|
||||||
margin: EdgeInsets.symmetric(horizontal: 3.w),
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: text(
|
|
||||||
SCAppLocalizations.of(context)!.rulesUpload,
|
|
||||||
maxLines: 2,
|
|
||||||
fontSize: 10.sp,
|
|
||||||
letterSpacing: 0.1,
|
|
||||||
lineHeight: 1,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
textColor: Colors.white,
|
|
||||||
),
|
),
|
||||||
),
|
SizedBox(height: _kGiftIconPriceSpacing.w),
|
||||||
],
|
Container(
|
||||||
|
height: 12.w,
|
||||||
|
margin: EdgeInsets.symmetric(horizontal: 3.w),
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: text(
|
||||||
|
SCAppLocalizations.of(context)!.rulesUpload,
|
||||||
|
maxLines: 1,
|
||||||
|
fontSize: 10,
|
||||||
|
letterSpacing: 0.1,
|
||||||
|
lineHeight: 1,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
textColor: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -403,10 +446,10 @@ class _GiftTabPageState extends State<GiftTabPage>
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
: GestureDetector(
|
: GestureDetector(
|
||||||
|
behavior: HitTestBehavior.opaque,
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(12.w),
|
borderRadius: BorderRadius.circular(12.w),
|
||||||
color: Colors.white10,
|
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color:
|
color:
|
||||||
checkedIndex == ref.giftByTab[widget.type]!.indexOf(gift)
|
checkedIndex == ref.giftByTab[widget.type]!.indexOf(gift)
|
||||||
@ -415,64 +458,61 @@ class _GiftTabPageState extends State<GiftTabPage>
|
|||||||
width: 1.w,
|
width: 1.w,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Padding(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
padding: EdgeInsets.symmetric(
|
||||||
children: [
|
vertical: _kGiftCardVerticalPadding.w,
|
||||||
netImage(
|
),
|
||||||
url: gift.giftPhoto ?? "",
|
child: Column(
|
||||||
fit: BoxFit.cover,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
width: 48.w,
|
children: [
|
||||||
height: 48.w,
|
netImage(
|
||||||
loadingWidget: _buildGiftCoverLoading(),
|
url: gift.giftPhoto ?? "",
|
||||||
errorWidget: _buildGiftCoverNoData(),
|
fit: BoxFit.cover,
|
||||||
),
|
width: 48.w,
|
||||||
SizedBox(height: 5.w),
|
height: 48.w,
|
||||||
Container(
|
loadingWidget: _buildGiftCoverLoading(),
|
||||||
height: 23.w,
|
errorWidget: _buildGiftCoverNoData(),
|
||||||
margin: EdgeInsets.symmetric(horizontal: 3.w),
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: text(
|
|
||||||
gift.giftName ?? "",
|
|
||||||
maxLines: 2,
|
|
||||||
fontSize: 10.sp,
|
|
||||||
letterSpacing: 0.1,
|
|
||||||
lineHeight: 1,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
textColor: widget.isDark ? Colors.white : Colors.black,
|
|
||||||
),
|
),
|
||||||
),
|
SizedBox(height: _kGiftIconPriceSpacing.w),
|
||||||
Row(
|
SizedBox(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
height: _kGiftPriceRowHeight.w,
|
||||||
children:
|
child: Row(
|
||||||
_isBackpackTab
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
? [
|
children:
|
||||||
text(
|
_isBackpackTab
|
||||||
"x${_formatBackpackQuantity(gift)}",
|
? [
|
||||||
fontSize: 10.sp,
|
text(
|
||||||
fontWeight: FontWeight.w600,
|
"x${_formatBackpackQuantity(gift)}",
|
||||||
textColor:
|
fontSize: 10,
|
||||||
widget.isDark
|
lineHeight: 1,
|
||||||
? SocialChatTheme.primaryLight
|
fontWeight: FontWeight.w600,
|
||||||
: SocialChatTheme.primaryColor,
|
textColor:
|
||||||
),
|
widget.isDark
|
||||||
]
|
? SocialChatTheme.primaryLight
|
||||||
: [
|
: SocialChatTheme.primaryColor,
|
||||||
Image.asset(
|
),
|
||||||
_strategy.getGiftPageGoldCoinIcon(),
|
]
|
||||||
width: 14.w,
|
: [
|
||||||
height: 14.w,
|
Image.asset(
|
||||||
),
|
_strategy.getGiftPageGoldCoinIcon(),
|
||||||
SizedBox(width: 3.w),
|
width: 14.w,
|
||||||
text(
|
height: 14.w,
|
||||||
"${gift.giftCandy}",
|
),
|
||||||
fontSize: 10.sp,
|
SizedBox(width: 3.w),
|
||||||
textColor:
|
text(
|
||||||
widget.isDark ? Colors.white : Colors.black,
|
"${gift.giftCandy}",
|
||||||
),
|
fontSize: 10,
|
||||||
],
|
lineHeight: 1,
|
||||||
),
|
textColor:
|
||||||
],
|
widget.isDark
|
||||||
|
? Colors.white
|
||||||
|
: Colors.black,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
|||||||
168
lib/modules/user/my_items/gift/bags_gift_page.dart
Normal file
168
lib/modules/user/my_items/gift/bags_gift_page.dart
Normal file
@ -0,0 +1,168 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:yumi/app/constants/sc_global_config.dart';
|
||||||
|
import 'package:yumi/shared/business_logic/models/res/gift_backpack_res.dart';
|
||||||
|
import 'package:yumi/shared/data_sources/sources/repositories/sc_room_repository_imp.dart';
|
||||||
|
import 'package:yumi/ui_kit/components/sc_compontent.dart';
|
||||||
|
import 'package:yumi/ui_kit/components/sc_page_list.dart';
|
||||||
|
import 'package:yumi/ui_kit/components/text/sc_text.dart';
|
||||||
|
import 'package:yumi/ui_kit/theme/socialchat_theme.dart';
|
||||||
|
import 'package:yumi/ui_kit/widgets/store/store_bag_page_helpers.dart';
|
||||||
|
|
||||||
|
const double _kBagsGiftGridAspectRatio = 0.86;
|
||||||
|
|
||||||
|
///背包-礼物
|
||||||
|
class BagsGiftPage extends SCPageList {
|
||||||
|
const BagsGiftPage({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
SCPageListState<SocialChatGiftBackpackRes, BagsGiftPage> createState() =>
|
||||||
|
_BagsGiftPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _BagsGiftPageState
|
||||||
|
extends SCPageListState<SocialChatGiftBackpackRes, BagsGiftPage> {
|
||||||
|
SocialChatGiftBackpackRes? selectedGift;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
enablePullUp = false;
|
||||||
|
isGridView = true;
|
||||||
|
gridViewCount = 3;
|
||||||
|
padding = EdgeInsets.symmetric(horizontal: 6.w);
|
||||||
|
backgroundColor = Colors.transparent;
|
||||||
|
gridDelegate = SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
|
crossAxisCount: gridViewCount,
|
||||||
|
mainAxisSpacing: 12.w,
|
||||||
|
crossAxisSpacing: 12.w,
|
||||||
|
childAspectRatio: _kBagsGiftGridAspectRatio,
|
||||||
|
);
|
||||||
|
loadData(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
body:
|
||||||
|
items.isEmpty && isLoading
|
||||||
|
? const SCBagGridSkeleton()
|
||||||
|
: buildList(context),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget buildItem(SocialChatGiftBackpackRes res) {
|
||||||
|
final gift = res.giftConfig;
|
||||||
|
final isSelected = selectedGift?.id == res.id;
|
||||||
|
|
||||||
|
return GestureDetector(
|
||||||
|
behavior: HitTestBehavior.opaque,
|
||||||
|
onTap: () {
|
||||||
|
selectedGift = res;
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: const Color(0xff18F2B1).withValues(alpha: 0.1),
|
||||||
|
border: Border.all(
|
||||||
|
color:
|
||||||
|
isSelected ? SocialChatTheme.primaryLight : Colors.transparent,
|
||||||
|
width: 1.w,
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(8.w)),
|
||||||
|
),
|
||||||
|
child: Stack(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
SizedBox(height: 25.w),
|
||||||
|
netImage(
|
||||||
|
url: gift?.giftPhoto ?? "",
|
||||||
|
width: 55.w,
|
||||||
|
height: 55.w,
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
),
|
||||||
|
SizedBox(height: 8.w),
|
||||||
|
buildStoreBagItemTitle(
|
||||||
|
gift?.giftName ?? "",
|
||||||
|
textColor: Colors.white,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
SizedBox(height: 6.w),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
SCGlobalConfig.businessLogicStrategy
|
||||||
|
.getGiftPageGoldCoinIcon(),
|
||||||
|
width: 14.w,
|
||||||
|
height: 14.w,
|
||||||
|
),
|
||||||
|
SizedBox(width: 3.w),
|
||||||
|
text(
|
||||||
|
_formatNumber(gift?.giftCandy),
|
||||||
|
fontSize: 10,
|
||||||
|
lineHeight: 1,
|
||||||
|
textColor: Colors.white,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
PositionedDirectional(
|
||||||
|
top: 0,
|
||||||
|
start: 0,
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 2.w),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: SocialChatTheme.primaryLight,
|
||||||
|
borderRadius: BorderRadiusDirectional.only(
|
||||||
|
topStart: Radius.circular(6.w),
|
||||||
|
topEnd: Radius.circular(12.w),
|
||||||
|
bottomEnd: Radius.circular(12.w),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: text(
|
||||||
|
"x${_formatNumber(res.quantity)}",
|
||||||
|
fontSize: 10,
|
||||||
|
lineHeight: 1,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
textColor: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
loadPage({
|
||||||
|
required int page,
|
||||||
|
required Function(List<SocialChatGiftBackpackRes>) onSuccess,
|
||||||
|
Function? onErr,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
final giftList = await SCChatRoomRepository().giftBackpack();
|
||||||
|
onSuccess(giftList.where((item) => (item.quantity ?? 0) > 0).toList());
|
||||||
|
} catch (e) {
|
||||||
|
if (onErr != null) {
|
||||||
|
onErr();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String _formatNumber(num? value) {
|
||||||
|
if (value == null) {
|
||||||
|
return "0";
|
||||||
|
}
|
||||||
|
if (value % 1 == 0) {
|
||||||
|
return value.toInt().toString();
|
||||||
|
}
|
||||||
|
return value.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,142 +1,140 @@
|
|||||||
import 'dart:async';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:yumi/app_localizations.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:yumi/ui_kit/components/appbar/socialchat_appbar.dart';
|
||||||
import 'package:yumi/modules/user/my_items/theme/bags_tab_theme_page.dart';
|
import 'package:yumi/app/routes/sc_fluro_navigator.dart';
|
||||||
import 'package:tancent_vap/utils/constant.dart';
|
import 'package:yumi/modules/store/store_route.dart';
|
||||||
import 'package:tancent_vap/widgets/vap_view.dart';
|
import 'package:yumi/modules/user/my_items/chatbox/bags_chatbox_page.dart';
|
||||||
|
import 'package:yumi/modules/user/my_items/gift/bags_gift_page.dart';
|
||||||
import 'package:yumi/app_localizations.dart';
|
import 'package:yumi/modules/user/my_items/headdress/bags_headdress_page.dart';
|
||||||
import 'package:yumi/ui_kit/components/appbar/socialchat_appbar.dart';
|
import 'package:yumi/modules/user/my_items/mountains/bags_mountains_page.dart';
|
||||||
import 'package:yumi/ui_kit/components/sc_compontent.dart';
|
|
||||||
import 'package:yumi/ui_kit/theme/socialchat_theme.dart';
|
import 'package:yumi/app/constants/sc_global_config.dart';
|
||||||
import 'package:yumi/app/routes/sc_fluro_navigator.dart';
|
import 'package:yumi/shared/business_logic/usecases/sc_fixed_width_tabIndicator.dart';
|
||||||
import 'package:yumi/shared/tools/sc_path_utils.dart';
|
|
||||||
import 'package:yumi/shared/data_sources/sources/local/file_cache_manager.dart';
|
class MyItemsPage extends StatefulWidget {
|
||||||
import 'package:yumi/ui_kit/widgets/headdress/headdress_widget.dart';
|
const MyItemsPage({super.key});
|
||||||
import 'package:yumi/modules/store/store_route.dart';
|
|
||||||
import 'package:yumi/modules/user/my_items/chatbox/bags_chatbox_page.dart';
|
@override
|
||||||
import 'package:yumi/modules/user/my_items/headdress/bags_headdress_page.dart';
|
State<MyItemsPage> createState() => _MyItemsPageState();
|
||||||
import 'package:yumi/modules/user/my_items/mountains/bags_mountains_page.dart';
|
}
|
||||||
|
|
||||||
import '../../../app/constants/sc_global_config.dart';
|
class _MyItemsPageState extends State<MyItemsPage>
|
||||||
import '../../../shared/business_logic/usecases/sc_fixed_width_tabIndicator.dart';
|
with SingleTickerProviderStateMixin {
|
||||||
|
late TabController _tabController;
|
||||||
class MyItemsPage extends StatefulWidget {
|
final List<Widget> _pages = [];
|
||||||
@override
|
final List<Widget> _tabs = [];
|
||||||
_MyItemsPageState createState() => _MyItemsPageState();
|
|
||||||
}
|
@override
|
||||||
|
void initState() {
|
||||||
class _MyItemsPageState extends State<MyItemsPage>
|
super.initState();
|
||||||
with SingleTickerProviderStateMixin {
|
_pages.add(BagsHeaddressPage());
|
||||||
late TabController _tabController;
|
_pages.add(BagsMountainsPage());
|
||||||
final List<Widget> _pages = [];
|
_pages.add(BagsGiftPage());
|
||||||
final List<Widget> _tabs = [];
|
_pages.add(BagsChatboxPage());
|
||||||
|
_tabController = TabController(length: _pages.length, vsync: this);
|
||||||
@override
|
_tabController.addListener(() {});
|
||||||
void initState() {
|
}
|
||||||
super.initState();
|
|
||||||
_pages.add(BagsHeaddressPage());
|
@override
|
||||||
_pages.add(
|
void dispose() {
|
||||||
BagsMountainsPage(),
|
_tabController.dispose();
|
||||||
);
|
super.dispose();
|
||||||
_pages.add(
|
}
|
||||||
BagsTabThemePage(),
|
|
||||||
);
|
@override
|
||||||
_pages.add(BagsChatboxPage());
|
Widget build(BuildContext context) {
|
||||||
_tabController = TabController(length: _pages.length, vsync: this);
|
_tabs.clear();
|
||||||
_tabController.addListener(() {
|
_tabs.add(Tab(text: SCAppLocalizations.of(context)!.headdress));
|
||||||
});
|
_tabs.add(Tab(text: SCAppLocalizations.of(context)!.mountains));
|
||||||
}
|
_tabs.add(Tab(text: SCAppLocalizations.of(context)!.gift));
|
||||||
|
_tabs.add(Tab(text: SCAppLocalizations.of(context)!.chatBox));
|
||||||
@override
|
return Stack(
|
||||||
void dispose() {
|
children: [
|
||||||
super.dispose();
|
Image.asset(
|
||||||
}
|
SCGlobalConfig.businessLogicStrategy.getLanguagePageBackgroundImage(),
|
||||||
|
width: ScreenUtil().screenWidth,
|
||||||
@override
|
height: ScreenUtil().screenHeight,
|
||||||
Widget build(BuildContext context) {
|
fit: BoxFit.fill,
|
||||||
_tabs.clear();
|
),
|
||||||
_tabs.add(Tab(text: SCAppLocalizations.of(context)!.headdress));
|
Scaffold(
|
||||||
_tabs.add(Tab(text: SCAppLocalizations.of(context)!.mountains));
|
backgroundColor: Colors.transparent,
|
||||||
_tabs.add(Tab(text: SCAppLocalizations.of(context)!.theme));
|
resizeToAvoidBottomInset: false,
|
||||||
_tabs.add(Tab(text: SCAppLocalizations.of(context)!.chatBox));
|
appBar: SocialChatStandardAppBar(
|
||||||
return Stack(
|
title: SCAppLocalizations.of(context)!.myItems,
|
||||||
children: [
|
actions: [
|
||||||
Image.asset(
|
GestureDetector(
|
||||||
SCGlobalConfig.businessLogicStrategy.getLanguagePageBackgroundImage(),
|
behavior: HitTestBehavior.opaque,
|
||||||
width: ScreenUtil().screenWidth,
|
child: Container(
|
||||||
height: ScreenUtil().screenHeight,
|
padding: EdgeInsets.all(5.w),
|
||||||
fit: BoxFit.fill,
|
margin: EdgeInsetsDirectional.only(end: 10.w),
|
||||||
),
|
child: Image.asset(
|
||||||
Scaffold(
|
"sc_images/store/sc_icon_bag_shop.png",
|
||||||
backgroundColor: Colors.transparent,
|
width: 20.w,
|
||||||
resizeToAvoidBottomInset: false,
|
height: 20.w,
|
||||||
appBar: SocialChatStandardAppBar(
|
),
|
||||||
title: SCAppLocalizations.of(context)!.myItems,
|
),
|
||||||
actions: [
|
onTap: () {
|
||||||
GestureDetector(
|
SCNavigatorUtils.push(
|
||||||
behavior: HitTestBehavior.opaque,
|
context,
|
||||||
child: Container(
|
StoreRoute.list,
|
||||||
padding: EdgeInsets.all(5.w),
|
replace: true,
|
||||||
margin: EdgeInsetsDirectional.only(end: 10.w),
|
);
|
||||||
child: Image.asset(
|
},
|
||||||
"sc_images/store/sc_icon_bag_shop.png",
|
),
|
||||||
width: 20.w,
|
],
|
||||||
height: 20.w,
|
),
|
||||||
),
|
body: SafeArea(
|
||||||
),
|
top: false,
|
||||||
onTap: () {
|
child: Column(
|
||||||
SCNavigatorUtils.push(context, StoreRoute.list, replace: true);
|
children: [
|
||||||
},
|
Row(
|
||||||
),
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
],
|
children: [
|
||||||
),
|
TabBar(
|
||||||
body: SafeArea(top:false,child: Column(
|
tabAlignment: TabAlignment.center,
|
||||||
children: [
|
isScrollable: true,
|
||||||
Row(
|
labelColor: Colors.white,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
unselectedLabelStyle: SCGlobalConfig.businessLogicStrategy
|
||||||
children: [
|
.getStorePageTabUnselectedLabelStyle()
|
||||||
TabBar(
|
.copyWith(
|
||||||
tabAlignment: TabAlignment.center,
|
fontSize:
|
||||||
isScrollable: true,
|
SCGlobalConfig.businessLogicStrategy
|
||||||
labelColor: Colors.white,
|
.getStorePageTabUnselectedLabelStyle()
|
||||||
unselectedLabelStyle: SCGlobalConfig.businessLogicStrategy
|
.fontSize
|
||||||
.getStorePageTabUnselectedLabelStyle()
|
?.sp,
|
||||||
.copyWith(
|
),
|
||||||
fontSize:
|
// indicatorPadding: EdgeInsets.symmetric(
|
||||||
SCGlobalConfig.businessLogicStrategy
|
// vertical: 5.w,
|
||||||
.getStorePageTabUnselectedLabelStyle()
|
// horizontal: 15.w,
|
||||||
.fontSize
|
// ),
|
||||||
?.sp,
|
indicator: SCFixedWidthTabIndicator(
|
||||||
),
|
width: 15.w,
|
||||||
// indicatorPadding: EdgeInsets.symmetric(
|
color:
|
||||||
// vertical: 5.w,
|
SCGlobalConfig.businessLogicStrategy
|
||||||
// horizontal: 15.w,
|
.getStorePageTabIndicatorColor(),
|
||||||
// ),
|
),
|
||||||
indicator: SCFixedWidthTabIndicator(
|
dividerColor:
|
||||||
width: 15.w,
|
SCGlobalConfig.businessLogicStrategy
|
||||||
color:
|
.getStorePageTabDividerColor(),
|
||||||
SCGlobalConfig.businessLogicStrategy
|
controller: _tabController,
|
||||||
.getStorePageTabIndicatorColor(),
|
tabs: _tabs,
|
||||||
),
|
),
|
||||||
dividerColor:
|
],
|
||||||
SCGlobalConfig.businessLogicStrategy
|
),
|
||||||
.getStorePageTabDividerColor(),
|
SizedBox(height: 5.w),
|
||||||
controller: _tabController,
|
Expanded(
|
||||||
tabs: _tabs,
|
child: TabBarView(
|
||||||
),
|
controller: _tabController,
|
||||||
],
|
children: _pages,
|
||||||
),
|
),
|
||||||
SizedBox(height: 5.w),
|
),
|
||||||
Expanded(
|
],
|
||||||
child: TabBarView(controller: _tabController, children: _pages),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),),
|
],
|
||||||
),
|
);
|
||||||
],
|
}
|
||||||
);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -49,11 +49,11 @@ class _RoomRocketRewardDialogLoaderState
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
if (widget.initialPopupRecords.isNotEmpty) {
|
if (widget.initialPopupRecords.isNotEmpty) {
|
||||||
_popupRecords.addAll(widget.initialPopupRecords);
|
_appendUniqueRewardRecords(_popupRecords, widget.initialPopupRecords);
|
||||||
_rewards = RoomRocketApiMapper.rewardItemsFromRecords(_popupRecords);
|
_rewards = RoomRocketApiMapper.rewardItemsFromRecords(_popupRecords);
|
||||||
}
|
}
|
||||||
if (widget.initialRoomRecords.isNotEmpty) {
|
if (widget.initialRoomRecords.isNotEmpty) {
|
||||||
_roomRecords.addAll(widget.initialRoomRecords);
|
_appendUniqueRewardRecords(_roomRecords, widget.initialRoomRecords);
|
||||||
}
|
}
|
||||||
_winners = RoomRocketApiMapper.winnersFromRecords(
|
_winners = RoomRocketApiMapper.winnersFromRecords(
|
||||||
_visibleRoomRewardRecords(),
|
_visibleRoomRewardRecords(),
|
||||||
@ -85,7 +85,7 @@ class _RoomRocketRewardDialogLoaderState
|
|||||||
? widget.initialPopupRecords
|
? widget.initialPopupRecords
|
||||||
: await _loadPopupRecords(requestCursor)
|
: await _loadPopupRecords(requestCursor)
|
||||||
: const <SCRoomRocketRewardRecordRes>[];
|
: const <SCRoomRocketRewardRecordRes>[];
|
||||||
if (reset && useInitialPopupRecords) {
|
if (useInitialPopupRecords) {
|
||||||
_usedInitialPopupRecords = true;
|
_usedInitialPopupRecords = true;
|
||||||
}
|
}
|
||||||
final nextRoomRecords = await _loadRoomRewardRecords(requestCursor);
|
final nextRoomRecords = await _loadRoomRewardRecords(requestCursor);
|
||||||
@ -94,25 +94,13 @@ class _RoomRocketRewardDialogLoaderState
|
|||||||
}
|
}
|
||||||
setState(() {
|
setState(() {
|
||||||
if (reset) {
|
if (reset) {
|
||||||
_popupRecords
|
_replaceUniqueRewardRecords(_popupRecords, nextPopupRecords);
|
||||||
..clear()
|
_replaceUniqueRewardRecords(_roomRecords, [
|
||||||
..addAll(nextPopupRecords);
|
...widget.initialRoomRecords,
|
||||||
_roomRecords
|
|
||||||
..clear()
|
|
||||||
..addAll(
|
|
||||||
_mergeRewardRecords([
|
|
||||||
...widget.initialRoomRecords,
|
|
||||||
...nextRoomRecords,
|
|
||||||
]),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
final mergedRoomRecords = _mergeRewardRecords([
|
|
||||||
..._roomRecords,
|
|
||||||
...nextRoomRecords,
|
...nextRoomRecords,
|
||||||
]);
|
]);
|
||||||
_roomRecords
|
} else {
|
||||||
..clear()
|
_appendUniqueRewardRecords(_roomRecords, nextRoomRecords);
|
||||||
..addAll(mergedRoomRecords);
|
|
||||||
}
|
}
|
||||||
_rewards = RoomRocketApiMapper.rewardItemsFromRecords(_popupRecords);
|
_rewards = RoomRocketApiMapper.rewardItemsFromRecords(_popupRecords);
|
||||||
_winners = RoomRocketApiMapper.winnersFromRecords(
|
_winners = RoomRocketApiMapper.winnersFromRecords(
|
||||||
@ -204,20 +192,6 @@ class _RoomRocketRewardDialogLoaderState
|
|||||||
return matched.isEmpty ? _roomRecords : matched;
|
return matched.isEmpty ? _roomRecords : matched;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<SCRoomRocketRewardRecordRes> _mergeRewardRecords(
|
|
||||||
List<SCRoomRocketRewardRecordRes> records,
|
|
||||||
) {
|
|
||||||
final result = <SCRoomRocketRewardRecordRes>[];
|
|
||||||
final seen = <String>{};
|
|
||||||
for (final record in records) {
|
|
||||||
final id = record.id.trim();
|
|
||||||
if (id.isEmpty || seen.add(id)) {
|
|
||||||
result.add(record);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return RoomRocketRewardDialog(
|
return RoomRocketRewardDialog(
|
||||||
@ -234,6 +208,66 @@ class _RoomRocketRewardDialogLoaderState
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _replaceUniqueRewardRecords(
|
||||||
|
List<SCRoomRocketRewardRecordRes> target,
|
||||||
|
List<SCRoomRocketRewardRecordRes> records,
|
||||||
|
) {
|
||||||
|
target
|
||||||
|
..clear()
|
||||||
|
..addAll(debugUniqueRoomRocketRewardRecords(records));
|
||||||
|
}
|
||||||
|
|
||||||
|
void _appendUniqueRewardRecords(
|
||||||
|
List<SCRoomRocketRewardRecordRes> target,
|
||||||
|
List<SCRoomRocketRewardRecordRes> records,
|
||||||
|
) {
|
||||||
|
final seen = target.map(_roomRocketRewardRecordUniqueKey).toSet();
|
||||||
|
for (final record in records) {
|
||||||
|
final key = _roomRocketRewardRecordUniqueKey(record);
|
||||||
|
if (!seen.add(key)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
target.add(record);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@visibleForTesting
|
||||||
|
List<SCRoomRocketRewardRecordRes> debugUniqueRoomRocketRewardRecords(
|
||||||
|
List<SCRoomRocketRewardRecordRes> records,
|
||||||
|
) {
|
||||||
|
final seen = <String>{};
|
||||||
|
final uniqueRecords = <SCRoomRocketRewardRecordRes>[];
|
||||||
|
for (final record in records) {
|
||||||
|
final key = _roomRocketRewardRecordUniqueKey(record);
|
||||||
|
if (!seen.add(key)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
uniqueRecords.add(record);
|
||||||
|
}
|
||||||
|
return uniqueRecords;
|
||||||
|
}
|
||||||
|
|
||||||
|
String _roomRocketRewardRecordUniqueKey(SCRoomRocketRewardRecordRes record) {
|
||||||
|
final id = record.id.trim();
|
||||||
|
if (id.isNotEmpty) {
|
||||||
|
return 'id:$id';
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
'fallback',
|
||||||
|
record.launchNo.trim(),
|
||||||
|
record.roomId.trim(),
|
||||||
|
record.roundNo.toString(),
|
||||||
|
record.level.toString(),
|
||||||
|
record.userId.trim(),
|
||||||
|
record.rewardScene.trim().toUpperCase(),
|
||||||
|
record.rewardType.trim().toUpperCase(),
|
||||||
|
record.rewardItemId.trim(),
|
||||||
|
record.rewardName.trim(),
|
||||||
|
record.rewardAmount.toString(),
|
||||||
|
record.expireDays.toString(),
|
||||||
|
].join('|');
|
||||||
|
}
|
||||||
|
|
||||||
void _rewardDialogDebug(String message) {
|
void _rewardDialogDebug(String message) {
|
||||||
if (!kDebugMode) {
|
if (!kDebugMode) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
55
test/room_rocket_reward_dialog_loader_test.dart
Normal file
55
test/room_rocket_reward_dialog_loader_test.dart
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:yumi/shared/business_logic/models/res/sc_room_rocket_api_res.dart';
|
||||||
|
import 'package:yumi/ui_kit/widgets/room/rocket/room_rocket_reward_dialog_loader.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
group('room rocket reward dialog loader', () {
|
||||||
|
test('deduplicates reward records by id', () {
|
||||||
|
final records = debugUniqueRoomRocketRewardRecords([
|
||||||
|
_rewardRecord(id: 'record-1', rewardAmount: 5000),
|
||||||
|
_rewardRecord(id: 'record-1', rewardAmount: 5200),
|
||||||
|
_rewardRecord(id: 'record-2', rewardAmount: 5200),
|
||||||
|
]);
|
||||||
|
|
||||||
|
expect(records, hasLength(2));
|
||||||
|
expect(records.map((item) => item.id), ['record-1', 'record-2']);
|
||||||
|
expect(records.first.rewardAmount, 5000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('deduplicates id-less reward records by reward identity', () {
|
||||||
|
final records = debugUniqueRoomRocketRewardRecords([
|
||||||
|
_rewardRecord(id: '', rewardAmount: 5000),
|
||||||
|
_rewardRecord(id: '', rewardAmount: 5000),
|
||||||
|
_rewardRecord(id: '', rewardAmount: 5200),
|
||||||
|
]);
|
||||||
|
|
||||||
|
expect(records, hasLength(2));
|
||||||
|
expect(records.map((item) => item.rewardAmount), [5000, 5200]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
SCRoomRocketRewardRecordRes _rewardRecord({
|
||||||
|
required String id,
|
||||||
|
required int rewardAmount,
|
||||||
|
}) {
|
||||||
|
return SCRoomRocketRewardRecordRes.fromJson({
|
||||||
|
'id': id,
|
||||||
|
'launchNo': 'launch-1',
|
||||||
|
'roomId': 'room-1',
|
||||||
|
'dayKey': '2026-05-15',
|
||||||
|
'roundNo': 1,
|
||||||
|
'level': 2,
|
||||||
|
'userId': 'user-1',
|
||||||
|
'userNickname': 'User 1',
|
||||||
|
'rewardScene': 'TOP1',
|
||||||
|
'rewardType': 'GOLD',
|
||||||
|
'rewardItemId': 'gold',
|
||||||
|
'rewardName': 'Yumi',
|
||||||
|
'rewardCover': '',
|
||||||
|
'rewardAmount': rewardAmount,
|
||||||
|
'expireDays': 0,
|
||||||
|
'grantStatus': 'SUCCESS',
|
||||||
|
'popupStatus': 'UNREAD',
|
||||||
|
});
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user