Compare commits
No commits in common. "5982be944b34f0b6e028369c13458ebe41744ad5" and "d26cfa20c30b7c8590395edec121ad9125151a1a" have entirely different histories.
5982be944b
...
d26cfa20c3
@ -14,7 +14,6 @@ import '../../../ui_kit/components/sc_tts.dart';
|
|||||||
import '../../../ui_kit/components/text/sc_text.dart';
|
import '../../../ui_kit/components/text/sc_text.dart';
|
||||||
import '../../../ui_kit/widgets/id/sc_special_id_badge.dart';
|
import '../../../ui_kit/widgets/id/sc_special_id_badge.dart';
|
||||||
import '../../../shared/tools/sc_lk_dialog_util.dart';
|
import '../../../shared/tools/sc_lk_dialog_util.dart';
|
||||||
import '../../../ui_kit/widgets/badge/sc_user_badge_strip.dart';
|
|
||||||
import '../../../ui_kit/widgets/room/room_user_info_card.dart';
|
import '../../../ui_kit/widgets/room/room_user_info_card.dart';
|
||||||
|
|
||||||
///房间用户在线列表
|
///房间用户在线列表
|
||||||
@ -108,48 +107,43 @@ class _RoomOnlinePageState
|
|||||||
_openUserCard(userInfo);
|
_openUserCard(userInfo);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(width: 8.w),
|
SizedBox(width: 3.w),
|
||||||
Expanded(
|
Column(
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
msgRoleTag(
|
msgRoleTag(userInfo.roles ?? "", width: 20.w, height: 20.w),
|
||||||
userInfo.roles ?? "",
|
|
||||||
width: 20.w,
|
|
||||||
height: 20.w,
|
|
||||||
),
|
|
||||||
SizedBox(width: 3.w),
|
SizedBox(width: 3.w),
|
||||||
socialchatNickNameText(
|
socialchatNickNameText(
|
||||||
textColor: Colors.black,
|
textColor: Colors.black,
|
||||||
maxWidth: 132.w,
|
maxWidth: 200.w,
|
||||||
userInfo.userNickname ?? "",
|
userInfo.userNickname ?? "",
|
||||||
fontSize: 14.sp,
|
fontSize: 14.sp,
|
||||||
type: userInfo.getVIP()?.name ?? "",
|
type: userInfo.getVIP()?.name ?? "",
|
||||||
needScroll:
|
needScroll:
|
||||||
(userInfo.userNickname?.characters.length ?? 0) >
|
(userInfo.userNickname?.characters.length ?? 0) > 16,
|
||||||
16,
|
|
||||||
),
|
),
|
||||||
getVIPBadge(
|
getVIPBadge(
|
||||||
userInfo.vipLevel ?? userInfo.getVIP()?.name,
|
userInfo.getVIP()?.name,
|
||||||
width: 45.w,
|
width: 45.w,
|
||||||
height: 25.w,
|
height: 25.w,
|
||||||
),
|
),
|
||||||
SizedBox(width: 3.w),
|
// ListView.separated(
|
||||||
getWealthLevel(
|
// scrollDirection: Axis.horizontal,
|
||||||
userInfo.wealthLevel ?? 0,
|
// shrinkWrap: true,
|
||||||
width: 42.w,
|
// itemCount: userInfo.wearBadge?.length ?? 0,
|
||||||
height: 20.w,
|
// itemBuilder: (context, index) {
|
||||||
fontSize: 9.sp,
|
// return netImage(
|
||||||
),
|
// width: 25.w,
|
||||||
SizedBox(width: 2.w),
|
// height: 25.w,
|
||||||
getUserLevel(
|
// url: userInfo.wearBadge?[index].selectUrl ?? "",
|
||||||
userInfo.charmLevel ?? 0,
|
// );
|
||||||
width: 42.w,
|
// },
|
||||||
height: 20.w,
|
// separatorBuilder: (BuildContext context, int index) {
|
||||||
fontSize: 9.sp,
|
// return SizedBox(width: 5.w);
|
||||||
),
|
// },
|
||||||
|
// ),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 3.w),
|
SizedBox(height: 3.w),
|
||||||
@ -190,24 +184,8 @@ class _RoomOnlinePageState
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(height: 2.w),
|
|
||||||
SCUserBadgeStrip(
|
|
||||||
userId: userInfo.id,
|
|
||||||
fallbackBadges:
|
|
||||||
userInfo.wearBadge
|
|
||||||
?.where((item) => item.use ?? false)
|
|
||||||
.toList() ??
|
|
||||||
const <WearBadge>[],
|
|
||||||
height: 23.w,
|
|
||||||
badgeHeight: 21.w,
|
|
||||||
longBadgeWidth: 51.w,
|
|
||||||
spacing: 4.5.w,
|
|
||||||
maxBadges: 8,
|
|
||||||
reserveSpace: true,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,207 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
||||||
import 'package:yumi/app/constants/sc_global_config.dart';
|
|
||||||
import 'package:yumi/app_localizations.dart';
|
|
||||||
import 'package:yumi/shared/business_logic/models/res/store_list_res.dart';
|
|
||||||
import 'package:yumi/shared/data_sources/models/enum/sc_currency_type.dart';
|
|
||||||
import 'package:yumi/shared/data_sources/models/enum/sc_props_type.dart';
|
|
||||||
import 'package:yumi/shared/data_sources/sources/repositories/sc_store_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/widgets/store/props_store_data_card_detail_dialog.dart';
|
|
||||||
import 'package:yumi/ui_kit/widgets/store/store_bag_page_helpers.dart';
|
|
||||||
|
|
||||||
class StoreDataCardPage extends SCPageList {
|
|
||||||
const StoreDataCardPage({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
StoreDataCardPageState createState() => StoreDataCardPageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class StoreDataCardPageState
|
|
||||||
extends SCPageListState<StoreDataCardListResBean, StoreDataCardPage> {
|
|
||||||
double disCount = 1;
|
|
||||||
|
|
||||||
@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: 0.78,
|
|
||||||
);
|
|
||||||
loadData(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
backgroundColor: Colors.transparent,
|
|
||||||
body:
|
|
||||||
items.isEmpty && isLoading
|
|
||||||
? const SCStoreGridSkeleton()
|
|
||||||
: buildList(context),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget buildItem(StoreDataCardListResBean item) {
|
|
||||||
final res = item;
|
|
||||||
final prices = res.res.propsPrices ?? const <PropsPrices>[];
|
|
||||||
final firstPrice = prices.isNotEmpty ? prices.first : null;
|
|
||||||
return GestureDetector(
|
|
||||||
child: Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color:
|
|
||||||
res.isSelecte
|
|
||||||
? const Color(0xff18F2B1).withValues(alpha: 0.1)
|
|
||||||
: SCGlobalConfig.businessLogicStrategy
|
|
||||||
.getStoreItemBackgroundColor(),
|
|
||||||
border: Border.all(
|
|
||||||
color:
|
|
||||||
res.isSelecte
|
|
||||||
? SCGlobalConfig.businessLogicStrategy
|
|
||||||
.getStoreItemSelectedBorderColor()
|
|
||||||
: SCGlobalConfig.businessLogicStrategy
|
|
||||||
.getStoreItemUnselectedBorderColor(),
|
|
||||||
width: 1.w,
|
|
||||||
),
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(8.w)),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(height: 10.w),
|
|
||||||
ClipRRect(
|
|
||||||
borderRadius: BorderRadius.circular(6.w),
|
|
||||||
child: netImage(
|
|
||||||
url: res.res.propsResources?.cover ?? "",
|
|
||||||
width: 72.w,
|
|
||||||
height: 50.w,
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 8.w),
|
|
||||||
buildStoreBagItemTitle(
|
|
||||||
res.res.propsResources?.name ?? "",
|
|
||||||
textColor: Colors.white,
|
|
||||||
fontSize: 11.sp,
|
|
||||||
),
|
|
||||||
SizedBox(height: 3.w),
|
|
||||||
Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
SizedBox(width: 10.w),
|
|
||||||
Expanded(
|
|
||||||
child: Text.rich(
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
TextSpan(
|
|
||||||
children: [
|
|
||||||
WidgetSpan(
|
|
||||||
alignment: PlaceholderAlignment.middle,
|
|
||||||
child: Image.asset(
|
|
||||||
SCGlobalConfig.businessLogicStrategy
|
|
||||||
.getStoreItemGoldIcon(),
|
|
||||||
width: 22.w,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const TextSpan(text: " "),
|
|
||||||
if (disCount < 1)
|
|
||||||
TextSpan(
|
|
||||||
text: "${firstPrice?.amount ?? 0}",
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12.sp,
|
|
||||||
color:
|
|
||||||
SCGlobalConfig.businessLogicStrategy
|
|
||||||
.getStoreItemPriceTextColor(),
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
decoration: TextDecoration.lineThrough,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (disCount < 1) const TextSpan(text: " "),
|
|
||||||
TextSpan(
|
|
||||||
text:
|
|
||||||
"${((firstPrice?.amount ?? 0) * disCount).toInt()}/${firstPrice?.days ?? 0} ${SCAppLocalizations.of(context)!.day}",
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12.sp,
|
|
||||||
color:
|
|
||||||
SCGlobalConfig.businessLogicStrategy
|
|
||||||
.getStoreItemPriceTextColor(),
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
strutStyle: const StrutStyle(
|
|
||||||
height: 1.3,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
forceStrutHeight: true,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(width: 10.w),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onTap: () {
|
|
||||||
_selectItem(res);
|
|
||||||
_showDetail(res.res);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
loadPage({
|
|
||||||
required int page,
|
|
||||||
required Function(List<StoreDataCardListResBean>) onSuccess,
|
|
||||||
Function? onErr,
|
|
||||||
}) async {
|
|
||||||
try {
|
|
||||||
final beans = <StoreDataCardListResBean>[];
|
|
||||||
final storeList = await SCStoreRepositoryImp().storeList(
|
|
||||||
SCCurrencyType.GOLD.name,
|
|
||||||
SCPropsType.DATA_CARD.name,
|
|
||||||
);
|
|
||||||
for (final value in storeList) {
|
|
||||||
beans.add(StoreDataCardListResBean(value, false));
|
|
||||||
}
|
|
||||||
onSuccess(beans);
|
|
||||||
} catch (_) {
|
|
||||||
onErr?.call();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _showDetail(StoreListRes res) {
|
|
||||||
SmartDialog.show(
|
|
||||||
tag: "showPropsDetail",
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
animationType: SmartAnimationType.fade,
|
|
||||||
builder: (_) {
|
|
||||||
return PropsStoreDataCardDetailDialog(res, disCount);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _selectItem(StoreDataCardListResBean res) {
|
|
||||||
for (final value in items) {
|
|
||||||
value.isSelecte = false;
|
|
||||||
}
|
|
||||||
res.isSelecte = true;
|
|
||||||
setState(() {});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class StoreDataCardListResBean {
|
|
||||||
StoreDataCardListResBean(this.res, this.isSelecte);
|
|
||||||
|
|
||||||
StoreListRes res;
|
|
||||||
bool isSelecte;
|
|
||||||
}
|
|
||||||
@ -1,15 +1,22 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:yumi/ui_kit/components/sc_compontent.dart';
|
||||||
import 'package:yumi/ui_kit/components/text/sc_text.dart';
|
import 'package:yumi/ui_kit/components/text/sc_text.dart';
|
||||||
import 'package:yumi/app/constants/sc_global_config.dart';
|
import 'package:yumi/app/constants/sc_global_config.dart';
|
||||||
import 'package:yumi/modules/store/store_route.dart';
|
import 'package:yumi/modules/store/store_route.dart';
|
||||||
import 'package:yumi/modules/store/data_card/store_data_card_page.dart';
|
import 'package:yumi/modules/store/theme/store_theme_page.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:tancent_vap/utils/constant.dart';
|
||||||
|
import 'package:tancent_vap/widgets/vap_view.dart';
|
||||||
import 'package:yumi/app_localizations.dart';
|
import 'package:yumi/app_localizations.dart';
|
||||||
import 'package:yumi/ui_kit/components/appbar/socialchat_appbar.dart';
|
import 'package:yumi/ui_kit/components/appbar/socialchat_appbar.dart';
|
||||||
import 'package:yumi/app/routes/sc_fluro_navigator.dart';
|
import 'package:yumi/app/routes/sc_fluro_navigator.dart';
|
||||||
|
import 'package:yumi/shared/tools/sc_path_utils.dart';
|
||||||
|
import 'package:yumi/shared/data_sources/sources/local/file_cache_manager.dart';
|
||||||
import 'package:yumi/services/auth/user_profile_manager.dart';
|
import 'package:yumi/services/auth/user_profile_manager.dart';
|
||||||
|
import 'package:yumi/ui_kit/widgets/headdress/headdress_widget.dart';
|
||||||
import 'package:yumi/modules/wallet/wallet_route.dart';
|
import 'package:yumi/modules/wallet/wallet_route.dart';
|
||||||
import 'package:yumi/modules/store/chatbox/store_chatbox_page.dart';
|
import 'package:yumi/modules/store/chatbox/store_chatbox_page.dart';
|
||||||
import 'package:yumi/modules/store/headdress/store_headdress_page.dart';
|
import 'package:yumi/modules/store/headdress/store_headdress_page.dart';
|
||||||
@ -18,10 +25,8 @@ import 'package:yumi/modules/store/mountains/store_mountains_page.dart';
|
|||||||
import '../../shared/business_logic/usecases/sc_fixed_width_tabIndicator.dart';
|
import '../../shared/business_logic/usecases/sc_fixed_width_tabIndicator.dart';
|
||||||
|
|
||||||
class StorePage extends StatefulWidget {
|
class StorePage extends StatefulWidget {
|
||||||
const StorePage({super.key});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<StorePage> createState() => _StorePageState();
|
_StorePageState createState() => _StorePageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _StorePageState extends State<StorePage>
|
class _StorePageState extends State<StorePage>
|
||||||
@ -35,11 +40,16 @@ class _StorePageState extends State<StorePage>
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_pages.add(StoreHeaddressPage());
|
_pages.add(StoreHeaddressPage());
|
||||||
_pages.add(StoreMountainsPage());
|
_pages.add(
|
||||||
_pages.add(const StoreDataCardPage());
|
StoreMountainsPage(),
|
||||||
|
);
|
||||||
|
_pages.add(
|
||||||
|
StoreThemePage(),
|
||||||
|
);
|
||||||
_pages.add(StoreChatboxPage());
|
_pages.add(StoreChatboxPage());
|
||||||
_tabController = TabController(length: _pages.length, vsync: this);
|
_tabController = TabController(length: _pages.length, vsync: this);
|
||||||
_tabController.addListener(() {});
|
_tabController.addListener(() {
|
||||||
|
});
|
||||||
Provider.of<SocialChatUserProfileManager>(context, listen: false).balance();
|
Provider.of<SocialChatUserProfileManager>(context, listen: false).balance();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +64,7 @@ class _StorePageState extends State<StorePage>
|
|||||||
_tabs.clear();
|
_tabs.clear();
|
||||||
_tabs.add(Tab(text: SCAppLocalizations.of(context)!.headdress));
|
_tabs.add(Tab(text: SCAppLocalizations.of(context)!.headdress));
|
||||||
_tabs.add(Tab(text: SCAppLocalizations.of(context)!.mountains));
|
_tabs.add(Tab(text: SCAppLocalizations.of(context)!.mountains));
|
||||||
_tabs.add(const Tab(text: 'Profile Card'));
|
_tabs.add(Tab(text: SCAppLocalizations.of(context)!.theme));
|
||||||
_tabs.add(Tab(text: SCAppLocalizations.of(context)!.chatBox));
|
_tabs.add(Tab(text: SCAppLocalizations.of(context)!.chatBox));
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
@ -152,9 +162,9 @@ class _StorePageState extends State<StorePage>
|
|||||||
topLeft: Radius.circular(12.w),
|
topLeft: Radius.circular(12.w),
|
||||||
topRight: Radius.circular(12.w),
|
topRight: Radius.circular(12.w),
|
||||||
),
|
),
|
||||||
color: Color(0xff18F2B1).withValues(alpha: 0.1),
|
color: Color(0xff18F2B1).withOpacity(0.1),
|
||||||
),
|
),
|
||||||
padding: EdgeInsets.only(bottom: 12.w, top: 12.w),
|
padding: EdgeInsets.only(bottom: 12.w,top: 12.w),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(width: 10.w),
|
SizedBox(width: 10.w),
|
||||||
|
|||||||
@ -1,399 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
import 'package:yumi/app/routes/sc_fluro_navigator.dart';
|
|
||||||
import 'package:yumi/app_localizations.dart';
|
|
||||||
import 'package:yumi/modules/store/store_route.dart';
|
|
||||||
import 'package:yumi/services/auth/user_profile_manager.dart';
|
|
||||||
import 'package:yumi/shared/business_logic/models/res/bags_list_res.dart';
|
|
||||||
import 'package:yumi/shared/business_logic/models/res/login_res.dart';
|
|
||||||
import 'package:yumi/shared/data_sources/models/enum/sc_props_type.dart';
|
|
||||||
import 'package:yumi/shared/data_sources/sources/local/user_manager.dart';
|
|
||||||
import 'package:yumi/shared/data_sources/sources/repositories/sc_store_repository_imp.dart';
|
|
||||||
import 'package:yumi/shared/tools/sc_loading_manager.dart';
|
|
||||||
import 'package:yumi/ui_kit/components/dialog/dialog_base.dart';
|
|
||||||
import 'package:yumi/ui_kit/components/sc_compontent.dart';
|
|
||||||
import 'package:yumi/ui_kit/components/sc_debounce_widget.dart';
|
|
||||||
import 'package:yumi/ui_kit/components/sc_page_list.dart';
|
|
||||||
import 'package:yumi/ui_kit/components/sc_tts.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/bag/props_bag_data_card_detail_dialog.dart';
|
|
||||||
import 'package:yumi/ui_kit/widgets/countdown_timer.dart';
|
|
||||||
import 'package:yumi/ui_kit/widgets/store/store_bag_page_helpers.dart';
|
|
||||||
|
|
||||||
class BagsDataCardPage extends SCPageList {
|
|
||||||
const BagsDataCardPage({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
BagsDataCardPageState createState() => BagsDataCardPageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class BagsDataCardPageState
|
|
||||||
extends SCPageListState<BagsListRes, BagsDataCardPage> {
|
|
||||||
PropsResources? myDataCard;
|
|
||||||
BagsListRes? selectedDataCard;
|
|
||||||
|
|
||||||
@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: 0.88,
|
|
||||||
);
|
|
||||||
myDataCard = AccountStorage().getDataCard();
|
|
||||||
loadData(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final hasSelection = selectedDataCard != null;
|
|
||||||
final selectedExpired =
|
|
||||||
(selectedDataCard?.expireTime ?? 0) <
|
|
||||||
DateTime.now().millisecondsSinceEpoch;
|
|
||||||
final selectedInUse =
|
|
||||||
myDataCard?.id == selectedDataCard?.propsResources?.id;
|
|
||||||
|
|
||||||
return Scaffold(
|
|
||||||
backgroundColor: Colors.transparent,
|
|
||||||
body: Column(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child:
|
|
||||||
items.isEmpty && isLoading
|
|
||||||
? const SCBagGridSkeleton()
|
|
||||||
: buildList(context),
|
|
||||||
),
|
|
||||||
hasSelection ? SizedBox(height: 10.w) : const SizedBox.shrink(),
|
|
||||||
hasSelection
|
|
||||||
? Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.only(
|
|
||||||
topLeft: Radius.circular(12.w),
|
|
||||||
topRight: Radius.circular(12.w),
|
|
||||||
),
|
|
||||||
color: const Color(0xff18F2B1).withValues(alpha: 0.1),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(height: 5.w),
|
|
||||||
Row(
|
|
||||||
spacing: 5.w,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
text(
|
|
||||||
"${SCAppLocalizations.of(context)!.expirationTime}:",
|
|
||||||
textColor: Colors.white,
|
|
||||||
fontSize: 12.sp,
|
|
||||||
),
|
|
||||||
CountdownTimer(
|
|
||||||
fontSize: 11.sp,
|
|
||||||
color: SocialChatTheme.primaryLight,
|
|
||||||
expiryDate: DateTime.fromMillisecondsSinceEpoch(
|
|
||||||
selectedDataCard?.expireTime ?? 0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SizedBox(height: 10.w),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
SCDebounceWidget(
|
|
||||||
child: Container(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
width: 120.w,
|
|
||||||
height: 35.w,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(12.w),
|
|
||||||
color: SocialChatTheme.primaryLight,
|
|
||||||
),
|
|
||||||
child: text(
|
|
||||||
SCAppLocalizations.of(context)!.renewal,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
fontSize: 14.sp,
|
|
||||||
textColor: Colors.white,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onTap: () {
|
|
||||||
SCNavigatorUtils.push(
|
|
||||||
context,
|
|
||||||
StoreRoute.list,
|
|
||||||
replace: false,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
SizedBox(width: 10.w),
|
|
||||||
SCDebounceWidget(
|
|
||||||
child: Container(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
width: 120.w,
|
|
||||||
height: 35.w,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(12.w),
|
|
||||||
color:
|
|
||||||
selectedInUse
|
|
||||||
? Colors.white
|
|
||||||
: SocialChatTheme.primaryLight,
|
|
||||||
),
|
|
||||||
child: text(
|
|
||||||
selectedExpired
|
|
||||||
? SCAppLocalizations.of(context)!.renewal
|
|
||||||
: selectedInUse
|
|
||||||
? SCAppLocalizations.of(context)!.inUse
|
|
||||||
: SCAppLocalizations.of(context)!.use,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
fontSize: 14.sp,
|
|
||||||
textColor:
|
|
||||||
selectedInUse
|
|
||||||
? const Color(0xffB1B1B1)
|
|
||||||
: Colors.white,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onTap: () {
|
|
||||||
if (selectedExpired) {
|
|
||||||
SCNavigatorUtils.push(
|
|
||||||
context,
|
|
||||||
StoreRoute.list,
|
|
||||||
replace: false,
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!selectedInUse) {
|
|
||||||
SmartDialog.show(
|
|
||||||
tag: "showConfirmDialog",
|
|
||||||
alignment: Alignment.center,
|
|
||||||
debounce: true,
|
|
||||||
animationType: SmartAnimationType.fade,
|
|
||||||
builder: (_) {
|
|
||||||
return MsgDialog(
|
|
||||||
title: SCAppLocalizations.of(context)!.tips,
|
|
||||||
msg:
|
|
||||||
SCAppLocalizations.of(
|
|
||||||
context,
|
|
||||||
)!.confirmUseTips,
|
|
||||||
btnText:
|
|
||||||
SCAppLocalizations.of(context)!.confirm,
|
|
||||||
onEnsure: () {
|
|
||||||
_use(selectedDataCard!, false);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
SmartDialog.show(
|
|
||||||
tag: "showConfirmDialog",
|
|
||||||
alignment: Alignment.center,
|
|
||||||
debounce: true,
|
|
||||||
animationType: SmartAnimationType.fade,
|
|
||||||
builder: (_) {
|
|
||||||
return MsgDialog(
|
|
||||||
title: SCAppLocalizations.of(context)!.tips,
|
|
||||||
msg:
|
|
||||||
SCAppLocalizations.of(
|
|
||||||
context,
|
|
||||||
)!.confirmUnUseTips,
|
|
||||||
btnText:
|
|
||||||
SCAppLocalizations.of(context)!.confirm,
|
|
||||||
onEnsure: () {
|
|
||||||
_use(selectedDataCard!, true);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SizedBox(height: 10.w),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: const SizedBox.shrink(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget buildItem(BagsListRes item) {
|
|
||||||
final res = item;
|
|
||||||
final selected =
|
|
||||||
selectedDataCard?.propsResources?.id == res.propsResources?.id;
|
|
||||||
return GestureDetector(
|
|
||||||
child: Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: const Color(0xff18F2B1).withValues(alpha: 0.1),
|
|
||||||
border: Border.all(
|
|
||||||
color: selected ? 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),
|
|
||||||
ClipRRect(
|
|
||||||
borderRadius: BorderRadius.circular(6.w),
|
|
||||||
child: netImage(
|
|
||||||
url: res.propsResources?.cover ?? "",
|
|
||||||
width: 72.w,
|
|
||||||
height: 50.w,
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 8.w),
|
|
||||||
buildStoreBagItemTitle(
|
|
||||||
res.propsResources?.name ?? "",
|
|
||||||
textColor: Colors.white,
|
|
||||||
fontSize: 12.sp,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
PositionedDirectional(
|
|
||||||
top: 0,
|
|
||||||
start: 0,
|
|
||||||
child: Container(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 5.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: Row(
|
|
||||||
children: [
|
|
||||||
CountdownTimer(
|
|
||||||
fontSize: 9.sp,
|
|
||||||
color: Colors.white,
|
|
||||||
expiryDate: DateTime.fromMillisecondsSinceEpoch(
|
|
||||||
res.expireTime ?? 0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(width: 3.w),
|
|
||||||
Image.asset(
|
|
||||||
"sc_images/store/sc_icon_bag_clock.png",
|
|
||||||
width: 22.w,
|
|
||||||
height: 22.w,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
PositionedDirectional(
|
|
||||||
bottom: 5.w,
|
|
||||||
end: 5.w,
|
|
||||||
child: GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
selectedDataCard = res;
|
|
||||||
setState(() {});
|
|
||||||
_showDetail(res);
|
|
||||||
},
|
|
||||||
behavior: HitTestBehavior.opaque,
|
|
||||||
child: Container(
|
|
||||||
padding: EdgeInsets.all(5.w),
|
|
||||||
child: Image.asset(
|
|
||||||
"sc_images/store/sc_icon_shop_item_search.png",
|
|
||||||
width: 18.w,
|
|
||||||
height: 18.w,
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onTap: () {
|
|
||||||
selectedDataCard = res;
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
loadPage({
|
|
||||||
required int page,
|
|
||||||
required Function(List<BagsListRes>) onSuccess,
|
|
||||||
Function? onErr,
|
|
||||||
}) async {
|
|
||||||
try {
|
|
||||||
final storeList = await SCStoreRepositoryImp().storeBackpack(
|
|
||||||
AccountStorage().getCurrentUser()?.userProfile?.id ?? "",
|
|
||||||
SCPropsType.DATA_CARD.name,
|
|
||||||
);
|
|
||||||
for (final item in storeList) {
|
|
||||||
if (item.propsResources?.id == myDataCard?.id) {
|
|
||||||
selectedDataCard = item;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onSuccess(storeList);
|
|
||||||
} catch (_) {
|
|
||||||
onErr?.call();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _showDetail(BagsListRes res) {
|
|
||||||
SmartDialog.show(
|
|
||||||
tag: "showPropsDetail",
|
|
||||||
alignment: Alignment.center,
|
|
||||||
animationType: SmartAnimationType.fade,
|
|
||||||
builder: (_) {
|
|
||||||
return PropsBagDataCardDetailDialog(res);
|
|
||||||
},
|
|
||||||
onDismiss: () {
|
|
||||||
myDataCard = AccountStorage().getDataCard();
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _use(BagsListRes res, bool unload) {
|
|
||||||
SCLoadingManager.show(context: context);
|
|
||||||
final profileManager = Provider.of<SocialChatUserProfileManager>(
|
|
||||||
context,
|
|
||||||
listen: false,
|
|
||||||
);
|
|
||||||
final localizations = SCAppLocalizations.of(context)!;
|
|
||||||
SCStoreRepositoryImp()
|
|
||||||
.switchPropsUse(
|
|
||||||
SCPropsType.DATA_CARD.name,
|
|
||||||
res.propsResources?.id ?? "",
|
|
||||||
unload,
|
|
||||||
)
|
|
||||||
.then((value) async {
|
|
||||||
if (!mounted) {
|
|
||||||
SCLoadingManager.hide();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setState(() {});
|
|
||||||
if (!unload) {
|
|
||||||
myDataCard = res.propsResources;
|
|
||||||
SCTts.show(localizations.successfulWear);
|
|
||||||
} else {
|
|
||||||
myDataCard = null;
|
|
||||||
SCTts.show(localizations.successfullyUnloaded);
|
|
||||||
}
|
|
||||||
profileManager.fetchUserProfileData(loadGuardCount: false);
|
|
||||||
SCLoadingManager.hide();
|
|
||||||
})
|
|
||||||
.catchError((e) {
|
|
||||||
SCLoadingManager.hide();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -6,7 +6,6 @@ import 'package:yumi/ui_kit/components/appbar/socialchat_appbar.dart';
|
|||||||
import 'package:yumi/app/routes/sc_fluro_navigator.dart';
|
import 'package:yumi/app/routes/sc_fluro_navigator.dart';
|
||||||
import 'package:yumi/modules/store/store_route.dart';
|
import 'package:yumi/modules/store/store_route.dart';
|
||||||
import 'package:yumi/modules/user/my_items/chatbox/bags_chatbox_page.dart';
|
import 'package:yumi/modules/user/my_items/chatbox/bags_chatbox_page.dart';
|
||||||
import 'package:yumi/modules/user/my_items/data_card/bags_data_card_page.dart';
|
|
||||||
import 'package:yumi/modules/user/my_items/gift/bags_gift_page.dart';
|
import 'package:yumi/modules/user/my_items/gift/bags_gift_page.dart';
|
||||||
import 'package:yumi/modules/user/my_items/headdress/bags_headdress_page.dart';
|
import 'package:yumi/modules/user/my_items/headdress/bags_headdress_page.dart';
|
||||||
import 'package:yumi/modules/user/my_items/mountains/bags_mountains_page.dart';
|
import 'package:yumi/modules/user/my_items/mountains/bags_mountains_page.dart';
|
||||||
@ -34,7 +33,6 @@ class _MyItemsPageState extends State<MyItemsPage>
|
|||||||
_pages.add(BagsMountainsPage());
|
_pages.add(BagsMountainsPage());
|
||||||
_pages.add(BagsGiftPage());
|
_pages.add(BagsGiftPage());
|
||||||
_pages.add(BagsChatboxPage());
|
_pages.add(BagsChatboxPage());
|
||||||
_pages.add(const BagsDataCardPage());
|
|
||||||
_tabController = TabController(length: _pages.length, vsync: this);
|
_tabController = TabController(length: _pages.length, vsync: this);
|
||||||
_tabController.addListener(() {});
|
_tabController.addListener(() {});
|
||||||
}
|
}
|
||||||
@ -52,7 +50,6 @@ class _MyItemsPageState extends State<MyItemsPage>
|
|||||||
_tabs.add(Tab(text: SCAppLocalizations.of(context)!.mountains));
|
_tabs.add(Tab(text: SCAppLocalizations.of(context)!.mountains));
|
||||||
_tabs.add(Tab(text: SCAppLocalizations.of(context)!.gift));
|
_tabs.add(Tab(text: SCAppLocalizations.of(context)!.gift));
|
||||||
_tabs.add(Tab(text: SCAppLocalizations.of(context)!.chatBox));
|
_tabs.add(Tab(text: SCAppLocalizations.of(context)!.chatBox));
|
||||||
_tabs.add(const Tab(text: 'Profile Card'));
|
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
Image.asset(
|
Image.asset(
|
||||||
@ -92,9 +89,10 @@ class _MyItemsPageState extends State<MyItemsPage>
|
|||||||
top: false,
|
top: false,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
Row(
|
||||||
width: double.infinity,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
child: TabBar(
|
children: [
|
||||||
|
TabBar(
|
||||||
tabAlignment: TabAlignment.center,
|
tabAlignment: TabAlignment.center,
|
||||||
isScrollable: true,
|
isScrollable: true,
|
||||||
labelColor: Colors.white,
|
labelColor: Colors.white,
|
||||||
@ -123,6 +121,7 @@ class _MyItemsPageState extends State<MyItemsPage>
|
|||||||
controller: _tabController,
|
controller: _tabController,
|
||||||
tabs: _tabs,
|
tabs: _tabs,
|
||||||
),
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 5.w),
|
SizedBox(height: 5.w),
|
||||||
Expanded(
|
Expanded(
|
||||||
|
|||||||
@ -24,7 +24,6 @@ import 'package:yumi/shared/tools/sc_loading_manager.dart';
|
|||||||
import 'package:yumi/shared/tools/sc_pick_utils.dart';
|
import 'package:yumi/shared/tools/sc_pick_utils.dart';
|
||||||
import 'package:yumi/shared/business_logic/models/res/gift_res.dart';
|
import 'package:yumi/shared/business_logic/models/res/gift_res.dart';
|
||||||
import 'package:yumi/shared/data_sources/sources/local/user_manager.dart';
|
import 'package:yumi/shared/data_sources/sources/local/user_manager.dart';
|
||||||
import 'package:yumi/shared/data_sources/models/enum/sc_props_type.dart';
|
|
||||||
import 'package:yumi/shared/data_sources/sources/repositories/sc_gift_repository_imp.dart';
|
import 'package:yumi/shared/data_sources/sources/repositories/sc_gift_repository_imp.dart';
|
||||||
import 'package:yumi/shared/data_sources/sources/repositories/sc_user_repository_impl.dart';
|
import 'package:yumi/shared/data_sources/sources/repositories/sc_user_repository_impl.dart';
|
||||||
import 'package:yumi/shared/business_logic/models/res/login_res.dart';
|
import 'package:yumi/shared/business_logic/models/res/login_res.dart';
|
||||||
@ -32,7 +31,6 @@ import 'package:yumi/services/audio/rtm_manager.dart';
|
|||||||
import 'package:yumi/services/auth/user_profile_manager.dart';
|
import 'package:yumi/services/auth/user_profile_manager.dart';
|
||||||
import 'package:yumi/services/general/sc_app_general_manager.dart';
|
import 'package:yumi/services/general/sc_app_general_manager.dart';
|
||||||
import 'package:yumi/ui_kit/widgets/badge/sc_user_badge_strip.dart';
|
import 'package:yumi/ui_kit/widgets/badge/sc_user_badge_strip.dart';
|
||||||
import 'package:yumi/ui_kit/widgets/props/sc_data_card_resource_view.dart';
|
|
||||||
|
|
||||||
import '../../../app/constants/sc_screen.dart';
|
import '../../../app/constants/sc_screen.dart';
|
||||||
import '../../../shared/business_logic/models/res/sc_user_counter_res.dart';
|
import '../../../shared/business_logic/models/res/sc_user_counter_res.dart';
|
||||||
@ -67,7 +65,6 @@ class _PersonDetailPageState extends State<PersonDetailPage> {
|
|||||||
|
|
||||||
Map<String, SCUserCounterRes> counterMap = {};
|
Map<String, SCUserCounterRes> counterMap = {};
|
||||||
List<SocialChatGiftRes> giftWallList = [];
|
List<SocialChatGiftRes> giftWallList = [];
|
||||||
List<WearBadge> honorWallBadges = [];
|
|
||||||
|
|
||||||
// 添加滚动控制器
|
// 添加滚动控制器
|
||||||
final ScrollController _scrollController = ScrollController();
|
final ScrollController _scrollController = ScrollController();
|
||||||
@ -137,7 +134,6 @@ class _PersonDetailPageState extends State<PersonDetailPage> {
|
|||||||
isBlacklistLoading = false;
|
isBlacklistLoading = false;
|
||||||
}
|
}
|
||||||
userCounter(widget.tageId);
|
userCounter(widget.tageId);
|
||||||
_loadHonorWall();
|
|
||||||
_loadGiftWall();
|
_loadGiftWall();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,26 +159,6 @@ class _PersonDetailPageState extends State<PersonDetailPage> {
|
|||||||
.catchError((e) {});
|
.catchError((e) {});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _loadHonorWall() {
|
|
||||||
final userId = widget.tageId.trim();
|
|
||||||
if (userId.isEmpty) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final currentUserId =
|
|
||||||
AccountStorage().getCurrentUser()?.userProfile?.id?.trim() ?? "";
|
|
||||||
final future =
|
|
||||||
currentUserId.isNotEmpty && currentUserId == userId
|
|
||||||
? SCAccountRepository().currentUserBadges()
|
|
||||||
: SCAccountRepository().otherUserBadges(userId);
|
|
||||||
future
|
|
||||||
.then((result) {
|
|
||||||
if (!mounted) return;
|
|
||||||
honorWallBadges = result.honorWallBadges;
|
|
||||||
setState(() {});
|
|
||||||
})
|
|
||||||
.catchError((e) {});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_scrollController.dispose();
|
_scrollController.dispose();
|
||||||
@ -580,57 +556,9 @@ class _PersonDetailPageState extends State<PersonDetailPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildProfileDataCardBackground(PropsResources? dataCard) {
|
|
||||||
if (dataCard == null) {
|
|
||||||
return const ColoredBox(color: _profileBg);
|
|
||||||
}
|
|
||||||
return Stack(
|
|
||||||
fit: StackFit.expand,
|
|
||||||
children: [
|
|
||||||
SCDataCardResourceView(resource: dataCard, fit: BoxFit.cover),
|
|
||||||
DecoratedBox(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
gradient: LinearGradient(
|
|
||||||
begin: Alignment.topCenter,
|
|
||||||
end: Alignment.bottomCenter,
|
|
||||||
colors: [
|
|
||||||
Colors.black.withValues(alpha: 0.26),
|
|
||||||
_profileBg.withValues(alpha: 0.54),
|
|
||||||
_profileBg.withValues(alpha: 0.78),
|
|
||||||
],
|
|
||||||
stops: const [0, 0.45, 1],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
PropsResources? _activeDataCard(SocialChatUserProfile? profile) {
|
|
||||||
final now = DateTime.now().millisecondsSinceEpoch;
|
|
||||||
for (final item in profile?.useProps ?? const <UseProps>[]) {
|
|
||||||
final resource = item.propsResources;
|
|
||||||
if (resource?.type != SCPropsType.DATA_CARD.name) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
final expireText = item.expireTime?.trim() ?? "";
|
|
||||||
final expireTime = int.tryParse(expireText);
|
|
||||||
if (expireText.isNotEmpty && (expireTime ?? 0) <= now) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
final source = resource?.sourceUrl?.trim() ?? "";
|
|
||||||
final cover = resource?.cover?.trim() ?? "";
|
|
||||||
if (source.isNotEmpty || cover.isNotEmpty) {
|
|
||||||
return resource;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildProfileHeader(
|
Widget _buildProfileHeader(
|
||||||
SocialChatUserProfileManager ref,
|
SocialChatUserProfileManager ref,
|
||||||
List<PersonPhoto> backgroundPhotos,
|
List<PersonPhoto> backgroundPhotos,
|
||||||
PropsResources? dataCard,
|
|
||||||
) {
|
) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: 520.w,
|
height: 520.w,
|
||||||
@ -682,7 +610,7 @@ class _PersonDetailPageState extends State<PersonDetailPage> {
|
|||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
child: _buildProfileDataCardBackground(dataCard),
|
child: Container(color: _profileBg),
|
||||||
),
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
top: 210.w,
|
top: 210.w,
|
||||||
@ -714,7 +642,7 @@ class _PersonDetailPageState extends State<PersonDetailPage> {
|
|||||||
Widget _buildProfileColumnContent() {
|
Widget _buildProfileColumnContent() {
|
||||||
return Container(
|
return Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
color: Colors.transparent,
|
color: _profileBg,
|
||||||
padding: EdgeInsets.fromLTRB(10.w, 4.w, 10.w, 220.w),
|
padding: EdgeInsets.fromLTRB(10.w, 4.w, 10.w, 220.w),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@ -730,19 +658,8 @@ class _PersonDetailPageState extends State<PersonDetailPage> {
|
|||||||
),
|
),
|
||||||
SizedBox(height: 12.w),
|
SizedBox(height: 12.w),
|
||||||
_buildWallGrid(
|
_buildWallGrid(
|
||||||
itemCount:
|
itemCount: _wallPreviewItemCount,
|
||||||
honorWallBadges.isEmpty
|
itemBuilder: (_) => _buildHonorPlaceholderItem(),
|
||||||
? _wallPreviewItemCount
|
|
||||||
: honorWallBadges.length
|
|
||||||
.clamp(0, _wallPreviewItemCount)
|
|
||||||
.toInt(),
|
|
||||||
itemBuilder: (index) {
|
|
||||||
final badge =
|
|
||||||
index < honorWallBadges.length
|
|
||||||
? honorWallBadges[index]
|
|
||||||
: null;
|
|
||||||
return _buildHonorWallItem(badge);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
SizedBox(height: 18.w),
|
SizedBox(height: 18.w),
|
||||||
_buildProfileSectionTitle(
|
_buildProfileSectionTitle(
|
||||||
@ -827,11 +744,9 @@ class _PersonDetailPageState extends State<PersonDetailPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildHonorWallItem(WearBadge? badge) {
|
Widget _buildHonorPlaceholderItem() {
|
||||||
return _buildWallItemFrame(
|
return _buildWallItemFrame(
|
||||||
child:
|
child: Opacity(
|
||||||
badge == null
|
|
||||||
? Opacity(
|
|
||||||
opacity: 0.45,
|
opacity: 0.45,
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
"sc_images/room/sc_icon_room_music_empty.png",
|
"sc_images/room/sc_icon_room_music_empty.png",
|
||||||
@ -839,22 +754,10 @@ class _PersonDetailPageState extends State<PersonDetailPage> {
|
|||||||
height: 38.w,
|
height: 38.w,
|
||||||
fit: BoxFit.contain,
|
fit: BoxFit.contain,
|
||||||
),
|
),
|
||||||
)
|
|
||||||
: Padding(
|
|
||||||
padding: EdgeInsets.all(8.w),
|
|
||||||
child: netImage(
|
|
||||||
url: _badgeUrl(badge),
|
|
||||||
width: double.infinity,
|
|
||||||
height: double.infinity,
|
|
||||||
fit: BoxFit.contain,
|
|
||||||
noDefaultImg: true,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String _badgeUrl(WearBadge badge) => (badge.selectUrl ?? "").trim();
|
|
||||||
|
|
||||||
Widget _buildGiftWallItem(SocialChatGiftRes? gift) {
|
Widget _buildGiftWallItem(SocialChatGiftRes? gift) {
|
||||||
return _buildWallItemFrame(
|
return _buildWallItemFrame(
|
||||||
child: Stack(
|
child: Stack(
|
||||||
@ -931,7 +834,7 @@ class _PersonDetailPageState extends State<PersonDetailPage> {
|
|||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
child: SizedBox(height: backgroundHeight),
|
child: Container(height: backgroundHeight, color: _profileBg),
|
||||||
),
|
),
|
||||||
if (hasRoom)
|
if (hasRoom)
|
||||||
Positioned(
|
Positioned(
|
||||||
@ -1177,8 +1080,6 @@ class _PersonDetailPageState extends State<PersonDetailPage> {
|
|||||||
: (ref.userProfile?.backgroundPhotos ?? []))
|
: (ref.userProfile?.backgroundPhotos ?? []))
|
||||||
.where((t) => t.status == 1)
|
.where((t) => t.status == 1)
|
||||||
.toList();
|
.toList();
|
||||||
final dataCard =
|
|
||||||
isProfileLoading ? null : _activeDataCard(ref.userProfile);
|
|
||||||
return Directionality(
|
return Directionality(
|
||||||
textDirection:
|
textDirection:
|
||||||
window.locale.languageCode == "ar"
|
window.locale.languageCode == "ar"
|
||||||
@ -1189,9 +1090,7 @@ class _PersonDetailPageState extends State<PersonDetailPage> {
|
|||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Positioned.fill(
|
Positioned.fill(
|
||||||
child: Stack(
|
child: Column(
|
||||||
children: [
|
|
||||||
Column(
|
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 300.w,
|
height: 300.w,
|
||||||
@ -1211,16 +1110,7 @@ class _PersonDetailPageState extends State<PersonDetailPage> {
|
|||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Expanded(child: ColoredBox(color: _profileBg)),
|
Expanded(child: Container(color: _profileBg)),
|
||||||
],
|
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
top: 250.w,
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
bottom: 0,
|
|
||||||
child: _buildProfileDataCardBackground(dataCard),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1559,11 +1449,7 @@ class _PersonDetailPageState extends State<PersonDetailPage> {
|
|||||||
physics: const BouncingScrollPhysics(),
|
physics: const BouncingScrollPhysics(),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
_buildProfileHeader(
|
_buildProfileHeader(ref, backgroundPhotos),
|
||||||
ref,
|
|
||||||
backgroundPhotos,
|
|
||||||
dataCard,
|
|
||||||
),
|
|
||||||
_buildProfileColumnContent(),
|
_buildProfileColumnContent(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -20,13 +20,21 @@ class ProfileWallOfHonorsPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _ProfileWallOfHonorsPageState extends State<ProfileWallOfHonorsPage> {
|
class _ProfileWallOfHonorsPageState extends State<ProfileWallOfHonorsPage> {
|
||||||
static const Color _profileBg = Color(0xff072121);
|
static const Color _profileBg = Color(0xff072121);
|
||||||
|
static const Color _mutedText = Color(0xff8F9A98);
|
||||||
|
|
||||||
|
int _selectedTabIndex = 0;
|
||||||
bool _loading = true;
|
bool _loading = true;
|
||||||
SCUserBadgeRes _badges = SCUserBadgeRes.empty();
|
SCUserBadgeRes _badges = SCUserBadgeRes.empty();
|
||||||
|
|
||||||
List<WearBadge> get _wallBadges => _badges.honorWallBadges;
|
List<WearBadge> get _honorBadges =>
|
||||||
|
_badges.displayBadges.where(_isHonorBadge).toList();
|
||||||
|
|
||||||
int get _totalCount => _wallBadges.length;
|
List<WearBadge> get _eventBadges =>
|
||||||
|
_badges.displayBadges.where(_isEventBadge).toList();
|
||||||
|
|
||||||
|
int get _honorCount => _honorBadges.length;
|
||||||
|
int get _eventCount => _eventBadges.length;
|
||||||
|
int get _totalCount => _honorCount + _eventCount;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -102,6 +110,54 @@ class _ProfileWallOfHonorsPageState extends State<ProfileWallOfHonorsPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildTabs() {
|
||||||
|
return SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
height: 82.w,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(child: _buildTab(index: 0, label: "Honors($_honorCount)")),
|
||||||
|
Expanded(child: _buildTab(index: 1, label: "Event($_eventCount)")),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildTab({required int index, required String label}) {
|
||||||
|
final selected = _selectedTabIndex == index;
|
||||||
|
return GestureDetector(
|
||||||
|
behavior: HitTestBehavior.opaque,
|
||||||
|
onTap: () {
|
||||||
|
if (_selectedTabIndex == index) return;
|
||||||
|
setState(() {
|
||||||
|
_selectedTabIndex = index;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
text(
|
||||||
|
label,
|
||||||
|
fontSize: 20,
|
||||||
|
textColor: selected ? Colors.white : _mutedText,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
maxLines: 1,
|
||||||
|
),
|
||||||
|
SizedBox(height: 9.w),
|
||||||
|
AnimatedContainer(
|
||||||
|
duration: const Duration(milliseconds: 160),
|
||||||
|
width: selected ? 28.w : 0,
|
||||||
|
height: 4.w,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(4.w),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildEmptyState() {
|
Widget _buildEmptyState() {
|
||||||
return SliverFillRemaining(
|
return SliverFillRemaining(
|
||||||
hasScrollBody: false,
|
hasScrollBody: false,
|
||||||
@ -138,7 +194,7 @@ class _ProfileWallOfHonorsPageState extends State<ProfileWallOfHonorsPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildBadgeGrid() {
|
Widget _buildBadgeGrid() {
|
||||||
final list = _wallBadges;
|
final list = _selectedTabIndex == 0 ? _honorBadges : _eventBadges;
|
||||||
if (list.isEmpty) {
|
if (list.isEmpty) {
|
||||||
return _buildEmptyState();
|
return _buildEmptyState();
|
||||||
}
|
}
|
||||||
@ -197,6 +253,29 @@ class _ProfileWallOfHonorsPageState extends State<ProfileWallOfHonorsPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool _isHonorBadge(WearBadge badge) {
|
||||||
|
final sourceType = badge.sourceType?.trim().toUpperCase() ?? "";
|
||||||
|
final type = badge.type?.trim().toUpperCase() ?? "";
|
||||||
|
return sourceType == "ACHIEVEMENT" ||
|
||||||
|
sourceType == "VIP" ||
|
||||||
|
(sourceType.isEmpty &&
|
||||||
|
(type == "LONG" || type == "ACHIEVEMENT" || type == "VIP"));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool _isEventBadge(WearBadge badge) {
|
||||||
|
final sourceType = badge.sourceType?.trim().toUpperCase() ?? "";
|
||||||
|
final type = badge.type?.trim().toUpperCase() ?? "";
|
||||||
|
if (sourceType == "ACTIVITY") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (sourceType.isNotEmpty) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return type == "ACTIVITY" ||
|
||||||
|
type == "SHORT" ||
|
||||||
|
(type != "LONG" && type != "VIP" && type != "ACHIEVEMENT");
|
||||||
|
}
|
||||||
|
|
||||||
String _badgeUrl(WearBadge badge) {
|
String _badgeUrl(WearBadge badge) {
|
||||||
return (badge.selectUrl ?? "").trim();
|
return (badge.selectUrl ?? "").trim();
|
||||||
}
|
}
|
||||||
@ -210,7 +289,9 @@ class _ProfileWallOfHonorsPageState extends State<ProfileWallOfHonorsPage> {
|
|||||||
child: CustomScrollView(
|
child: CustomScrollView(
|
||||||
physics: const BouncingScrollPhysics(),
|
physics: const BouncingScrollPhysics(),
|
||||||
slivers: [
|
slivers: [
|
||||||
SliverToBoxAdapter(child: _buildTopBar()),
|
SliverToBoxAdapter(
|
||||||
|
child: Column(children: [_buildTopBar(), _buildTabs()]),
|
||||||
|
),
|
||||||
_loading ? _buildLoadingState() : _buildBadgeGrid(),
|
_loading ? _buildLoadingState() : _buildBadgeGrid(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -851,8 +851,6 @@ class WearBadge {
|
|||||||
String? sourceType,
|
String? sourceType,
|
||||||
String? type,
|
String? type,
|
||||||
String? userId,
|
String? userId,
|
||||||
int? updateTime,
|
|
||||||
String? updatedAt,
|
|
||||||
bool? use,
|
bool? use,
|
||||||
}) {
|
}) {
|
||||||
_animationUrl = animationUrl;
|
_animationUrl = animationUrl;
|
||||||
@ -868,8 +866,6 @@ class WearBadge {
|
|||||||
_sourceType = sourceType;
|
_sourceType = sourceType;
|
||||||
_type = type;
|
_type = type;
|
||||||
_userId = userId;
|
_userId = userId;
|
||||||
_updateTime = updateTime;
|
|
||||||
_updatedAt = updatedAt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WearBadge.fromJson(dynamic json) {
|
WearBadge.fromJson(dynamic json) {
|
||||||
@ -893,10 +889,6 @@ class WearBadge {
|
|||||||
_stringValue(json['sourceType']) ?? _sourceTypeFromType(rawType);
|
_stringValue(json['sourceType']) ?? _sourceTypeFromType(rawType);
|
||||||
_type = rawType;
|
_type = rawType;
|
||||||
_userId = _stringValue(json['userId']);
|
_userId = _stringValue(json['userId']);
|
||||||
_updateTime = _intValue(
|
|
||||||
json['updateTime'] ?? json['updatedAt'] ?? json['createTime'],
|
|
||||||
);
|
|
||||||
_updatedAt = _stringValue(json['updatedAt']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String? _animationUrl;
|
String? _animationUrl;
|
||||||
@ -912,8 +904,6 @@ class WearBadge {
|
|||||||
String? _sourceType;
|
String? _sourceType;
|
||||||
String? _type;
|
String? _type;
|
||||||
String? _userId;
|
String? _userId;
|
||||||
int? _updateTime;
|
|
||||||
String? _updatedAt;
|
|
||||||
|
|
||||||
WearBadge copyWith({
|
WearBadge copyWith({
|
||||||
String? animationUrl,
|
String? animationUrl,
|
||||||
@ -929,8 +919,6 @@ class WearBadge {
|
|||||||
String? sourceType,
|
String? sourceType,
|
||||||
String? type,
|
String? type,
|
||||||
String? userId,
|
String? userId,
|
||||||
int? updateTime,
|
|
||||||
String? updatedAt,
|
|
||||||
}) => WearBadge(
|
}) => WearBadge(
|
||||||
animationUrl: animationUrl ?? _animationUrl,
|
animationUrl: animationUrl ?? _animationUrl,
|
||||||
badgeKey: badgeKey ?? _badgeKey,
|
badgeKey: badgeKey ?? _badgeKey,
|
||||||
@ -945,8 +933,6 @@ class WearBadge {
|
|||||||
sourceType: sourceType ?? _sourceType,
|
sourceType: sourceType ?? _sourceType,
|
||||||
type: type ?? _type,
|
type: type ?? _type,
|
||||||
userId: userId ?? _userId,
|
userId: userId ?? _userId,
|
||||||
updateTime: updateTime ?? _updateTime,
|
|
||||||
updatedAt: updatedAt ?? _updatedAt,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
String? get animationUrl => _animationUrl;
|
String? get animationUrl => _animationUrl;
|
||||||
@ -975,10 +961,6 @@ class WearBadge {
|
|||||||
|
|
||||||
String? get userId => _userId;
|
String? get userId => _userId;
|
||||||
|
|
||||||
int? get updateTime => _updateTime;
|
|
||||||
|
|
||||||
String? get updatedAt => _updatedAt;
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final map = <String, dynamic>{};
|
final map = <String, dynamic>{};
|
||||||
map['animationUrl'] = _animationUrl;
|
map['animationUrl'] = _animationUrl;
|
||||||
@ -994,8 +976,6 @@ class WearBadge {
|
|||||||
map['sourceType'] = _sourceType;
|
map['sourceType'] = _sourceType;
|
||||||
map['type'] = _type;
|
map['type'] = _type;
|
||||||
map['userId'] = _userId;
|
map['userId'] = _userId;
|
||||||
map['updateTime'] = _updateTime;
|
|
||||||
map['updatedAt'] = _updatedAt;
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,8 +24,7 @@ class RoomUserCardRes {
|
|||||||
List<UseBadge>? useBadge,
|
List<UseBadge>? useBadge,
|
||||||
List<UseProps>? useProps,
|
List<UseProps>? useProps,
|
||||||
UserLevel? userLevel,
|
UserLevel? userLevel,
|
||||||
SocialChatUserProfile? userProfile,
|
SocialChatUserProfile? userProfile,}){
|
||||||
}) {
|
|
||||||
_agent = agent;
|
_agent = agent;
|
||||||
_anchor = anchor;
|
_anchor = anchor;
|
||||||
_follow = follow;
|
_follow = follow;
|
||||||
@ -36,8 +35,12 @@ class RoomUserCardRes {
|
|||||||
_useBadge = useBadge;
|
_useBadge = useBadge;
|
||||||
_useProps = useProps;
|
_useProps = useProps;
|
||||||
_userLevel = userLevel;
|
_userLevel = userLevel;
|
||||||
_userProfile = _profileWithCardHints(userProfile, supperVip, userLevel);
|
final normalizedVipLevel = supperVip?.trim();
|
||||||
}
|
_userProfile =
|
||||||
|
normalizedVipLevel == null || normalizedVipLevel.isEmpty
|
||||||
|
? userProfile
|
||||||
|
: userProfile?.copyWith(vipLevel: normalizedVipLevel);
|
||||||
|
}
|
||||||
|
|
||||||
RoomUserCardRes.fromJson(dynamic json) {
|
RoomUserCardRes.fromJson(dynamic json) {
|
||||||
_agent = json['agent'];
|
_agent = json['agent'];
|
||||||
@ -59,15 +62,15 @@ class RoomUserCardRes {
|
|||||||
_useProps?.add(UseProps.fromJson(v));
|
_useProps?.add(UseProps.fromJson(v));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
_userLevel =
|
_userLevel = json['userLevel'] != null ? UserLevel.fromJson(json['userLevel']) : null;
|
||||||
json['userLevel'] != null
|
|
||||||
? UserLevel.fromJson(json['userLevel'])
|
|
||||||
: null;
|
|
||||||
_userProfile =
|
_userProfile =
|
||||||
json['userProfile'] != null
|
json['userProfile'] != null
|
||||||
? socialChatUserProfileFromJsonWithVipHint(json)
|
? socialChatUserProfileFromJsonWithVipHint(json)
|
||||||
: null;
|
: null;
|
||||||
_userProfile = _profileWithCardHints(_userProfile, _supperVip, _userLevel);
|
final normalizedVipLevel = _supperVip?.trim();
|
||||||
|
if (normalizedVipLevel != null && normalizedVipLevel.isNotEmpty) {
|
||||||
|
_userProfile = _userProfile?.copyWith(vipLevel: normalizedVipLevel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
bool? _agent;
|
bool? _agent;
|
||||||
bool? _anchor;
|
bool? _anchor;
|
||||||
@ -80,8 +83,7 @@ class RoomUserCardRes {
|
|||||||
List<UseProps>? _useProps;
|
List<UseProps>? _useProps;
|
||||||
UserLevel? _userLevel;
|
UserLevel? _userLevel;
|
||||||
SocialChatUserProfile? _userProfile;
|
SocialChatUserProfile? _userProfile;
|
||||||
RoomUserCardRes copyWith({
|
RoomUserCardRes copyWith({ bool? agent,
|
||||||
bool? agent,
|
|
||||||
bool? anchor,
|
bool? anchor,
|
||||||
bool? follow,
|
bool? follow,
|
||||||
bool? friend,
|
bool? friend,
|
||||||
@ -92,8 +94,7 @@ class RoomUserCardRes {
|
|||||||
List<UseProps>? useProps,
|
List<UseProps>? useProps,
|
||||||
UserLevel? userLevel,
|
UserLevel? userLevel,
|
||||||
SocialChatUserProfile? userProfile,
|
SocialChatUserProfile? userProfile,
|
||||||
}) => RoomUserCardRes(
|
}) => RoomUserCardRes( agent: agent ?? _agent,
|
||||||
agent: agent ?? _agent,
|
|
||||||
anchor: anchor ?? _anchor,
|
anchor: anchor ?? _anchor,
|
||||||
follow: follow ?? _follow,
|
follow: follow ?? _follow,
|
||||||
friend: friend ?? _friend,
|
friend: friend ?? _friend,
|
||||||
@ -104,7 +105,7 @@ class RoomUserCardRes {
|
|||||||
useProps: useProps ?? _useProps,
|
useProps: useProps ?? _useProps,
|
||||||
userLevel: userLevel ?? _userLevel,
|
userLevel: userLevel ?? _userLevel,
|
||||||
userProfile: userProfile ?? _userProfile,
|
userProfile: userProfile ?? _userProfile,
|
||||||
);
|
);
|
||||||
bool? get agent => _agent;
|
bool? get agent => _agent;
|
||||||
bool? get anchor => _anchor;
|
bool? get anchor => _anchor;
|
||||||
bool? get follow => _follow;
|
bool? get follow => _follow;
|
||||||
@ -140,28 +141,7 @@ class RoomUserCardRes {
|
|||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
SocialChatUserProfile? _profileWithCardHints(
|
|
||||||
SocialChatUserProfile? profile,
|
|
||||||
String? supperVip,
|
|
||||||
UserLevel? userLevel,
|
|
||||||
) {
|
|
||||||
if (profile == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
var result = profile;
|
|
||||||
final normalizedVipLevel = supperVip?.trim();
|
|
||||||
if (normalizedVipLevel != null && normalizedVipLevel.isNotEmpty) {
|
|
||||||
result = result.copyWith(vipLevel: normalizedVipLevel);
|
|
||||||
}
|
|
||||||
if (userLevel?.wealthLevel != null || userLevel?.charmLevel != null) {
|
|
||||||
result = result.copyWith(
|
|
||||||
wealthLevel: userLevel?.wealthLevel ?? result.wealthLevel,
|
|
||||||
charmLevel: userLevel?.charmLevel ?? result.charmLevel,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// account : ""
|
/// account : ""
|
||||||
@ -211,8 +191,7 @@ class WearBadge {
|
|||||||
String? notSelectUrl,
|
String? notSelectUrl,
|
||||||
String? selectUrl,
|
String? selectUrl,
|
||||||
String? type,
|
String? type,
|
||||||
num? userId,
|
num? userId,}){
|
||||||
}) {
|
|
||||||
_animationUrl = animationUrl;
|
_animationUrl = animationUrl;
|
||||||
_badgeKey = badgeKey;
|
_badgeKey = badgeKey;
|
||||||
_badgeLevel = badgeLevel;
|
_badgeLevel = badgeLevel;
|
||||||
@ -224,7 +203,7 @@ class WearBadge {
|
|||||||
_selectUrl = selectUrl;
|
_selectUrl = selectUrl;
|
||||||
_type = type;
|
_type = type;
|
||||||
_userId = userId;
|
_userId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
WearBadge.fromJson(dynamic json) {
|
WearBadge.fromJson(dynamic json) {
|
||||||
_animationUrl = json['animationUrl'];
|
_animationUrl = json['animationUrl'];
|
||||||
@ -250,8 +229,7 @@ class WearBadge {
|
|||||||
String? _selectUrl;
|
String? _selectUrl;
|
||||||
String? _type;
|
String? _type;
|
||||||
num? _userId;
|
num? _userId;
|
||||||
WearBadge copyWith({
|
WearBadge copyWith({ String? animationUrl,
|
||||||
String? animationUrl,
|
|
||||||
String? badgeKey,
|
String? badgeKey,
|
||||||
num? badgeLevel,
|
num? badgeLevel,
|
||||||
String? badgeName,
|
String? badgeName,
|
||||||
@ -262,8 +240,7 @@ class WearBadge {
|
|||||||
String? selectUrl,
|
String? selectUrl,
|
||||||
String? type,
|
String? type,
|
||||||
num? userId,
|
num? userId,
|
||||||
}) => WearBadge(
|
}) => WearBadge( animationUrl: animationUrl ?? _animationUrl,
|
||||||
animationUrl: animationUrl ?? _animationUrl,
|
|
||||||
badgeKey: badgeKey ?? _badgeKey,
|
badgeKey: badgeKey ?? _badgeKey,
|
||||||
badgeLevel: badgeLevel ?? _badgeLevel,
|
badgeLevel: badgeLevel ?? _badgeLevel,
|
||||||
badgeName: badgeName ?? _badgeName,
|
badgeName: badgeName ?? _badgeName,
|
||||||
@ -274,7 +251,7 @@ class WearBadge {
|
|||||||
selectUrl: selectUrl ?? _selectUrl,
|
selectUrl: selectUrl ?? _selectUrl,
|
||||||
type: type ?? _type,
|
type: type ?? _type,
|
||||||
userId: userId ?? _userId,
|
userId: userId ?? _userId,
|
||||||
);
|
);
|
||||||
String? get animationUrl => _animationUrl;
|
String? get animationUrl => _animationUrl;
|
||||||
String? get badgeKey => _badgeKey;
|
String? get badgeKey => _badgeKey;
|
||||||
num? get badgeLevel => _badgeLevel;
|
num? get badgeLevel => _badgeLevel;
|
||||||
@ -302,13 +279,16 @@ class WearBadge {
|
|||||||
map['userId'] = _userId;
|
map['userId'] = _userId;
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class UserLevel {
|
class UserLevel {
|
||||||
UserLevel({num? charmLevel, num? wealthLevel}) {
|
UserLevel({
|
||||||
|
num? charmLevel,
|
||||||
|
num? wealthLevel,}){
|
||||||
_charmLevel = charmLevel;
|
_charmLevel = charmLevel;
|
||||||
_wealthLevel = wealthLevel;
|
_wealthLevel = wealthLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
UserLevel.fromJson(dynamic json) {
|
UserLevel.fromJson(dynamic json) {
|
||||||
_charmLevel = json['charmLevel'];
|
_charmLevel = json['charmLevel'];
|
||||||
@ -316,10 +296,11 @@ class UserLevel {
|
|||||||
}
|
}
|
||||||
num? _charmLevel;
|
num? _charmLevel;
|
||||||
num? _wealthLevel;
|
num? _wealthLevel;
|
||||||
UserLevel copyWith({num? charmLevel, num? wealthLevel}) => UserLevel(
|
UserLevel copyWith({ num? charmLevel,
|
||||||
charmLevel: charmLevel ?? _charmLevel,
|
num? wealthLevel,
|
||||||
|
}) => UserLevel( charmLevel: charmLevel ?? _charmLevel,
|
||||||
wealthLevel: wealthLevel ?? _wealthLevel,
|
wealthLevel: wealthLevel ?? _wealthLevel,
|
||||||
);
|
);
|
||||||
num? get charmLevel => _charmLevel;
|
num? get charmLevel => _charmLevel;
|
||||||
num? get wealthLevel => _wealthLevel;
|
num? get wealthLevel => _wealthLevel;
|
||||||
|
|
||||||
@ -329,6 +310,7 @@ class UserLevel {
|
|||||||
map['wealthLevel'] = _wealthLevel;
|
map['wealthLevel'] = _wealthLevel;
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class UseBadge {
|
class UseBadge {
|
||||||
@ -343,8 +325,7 @@ class UseBadge {
|
|||||||
String? notSelectUrl,
|
String? notSelectUrl,
|
||||||
String? selectUrl,
|
String? selectUrl,
|
||||||
String? type,
|
String? type,
|
||||||
String? userId,
|
String? userId,}){
|
||||||
}) {
|
|
||||||
_animationUrl = animationUrl;
|
_animationUrl = animationUrl;
|
||||||
_badgeKey = badgeKey;
|
_badgeKey = badgeKey;
|
||||||
_badgeLevel = badgeLevel;
|
_badgeLevel = badgeLevel;
|
||||||
@ -356,7 +337,7 @@ class UseBadge {
|
|||||||
_selectUrl = selectUrl;
|
_selectUrl = selectUrl;
|
||||||
_type = type;
|
_type = type;
|
||||||
_userId = userId;
|
_userId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
UseBadge.fromJson(dynamic json) {
|
UseBadge.fromJson(dynamic json) {
|
||||||
_animationUrl = json['animationUrl'];
|
_animationUrl = json['animationUrl'];
|
||||||
@ -382,8 +363,7 @@ class UseBadge {
|
|||||||
String? _selectUrl;
|
String? _selectUrl;
|
||||||
String? _type;
|
String? _type;
|
||||||
String? _userId;
|
String? _userId;
|
||||||
UseBadge copyWith({
|
UseBadge copyWith({ String? animationUrl,
|
||||||
String? animationUrl,
|
|
||||||
String? badgeKey,
|
String? badgeKey,
|
||||||
num? badgeLevel,
|
num? badgeLevel,
|
||||||
String? badgeName,
|
String? badgeName,
|
||||||
@ -394,8 +374,7 @@ class UseBadge {
|
|||||||
String? selectUrl,
|
String? selectUrl,
|
||||||
String? type,
|
String? type,
|
||||||
String? userId,
|
String? userId,
|
||||||
}) => UseBadge(
|
}) => UseBadge( animationUrl: animationUrl ?? _animationUrl,
|
||||||
animationUrl: animationUrl ?? _animationUrl,
|
|
||||||
badgeKey: badgeKey ?? _badgeKey,
|
badgeKey: badgeKey ?? _badgeKey,
|
||||||
badgeLevel: badgeLevel ?? _badgeLevel,
|
badgeLevel: badgeLevel ?? _badgeLevel,
|
||||||
badgeName: badgeName ?? _badgeName,
|
badgeName: badgeName ?? _badgeName,
|
||||||
@ -406,7 +385,7 @@ class UseBadge {
|
|||||||
selectUrl: selectUrl ?? _selectUrl,
|
selectUrl: selectUrl ?? _selectUrl,
|
||||||
type: type ?? _type,
|
type: type ?? _type,
|
||||||
userId: userId ?? _userId,
|
userId: userId ?? _userId,
|
||||||
);
|
);
|
||||||
String? get animationUrl => _animationUrl;
|
String? get animationUrl => _animationUrl;
|
||||||
String? get badgeKey => _badgeKey;
|
String? get badgeKey => _badgeKey;
|
||||||
num? get badgeLevel => _badgeLevel;
|
num? get badgeLevel => _badgeLevel;
|
||||||
@ -434,4 +413,5 @@ class UseBadge {
|
|||||||
map['userId'] = _userId;
|
map['userId'] = _userId;
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,17 +39,6 @@ class SCUserBadgeRes {
|
|||||||
return badges;
|
return badges;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<WearBadge> get honorWallBadges {
|
|
||||||
final source =
|
|
||||||
shortBadges.isNotEmpty
|
|
||||||
? shortBadges
|
|
||||||
: displayBadges.where(_isHonorWallBadge).toList();
|
|
||||||
final result =
|
|
||||||
source.where((badge) => _badgeUrl(badge).isNotEmpty).toList();
|
|
||||||
result.sort((a, b) => _badgeSortValue(b).compareTo(_badgeSortValue(a)));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
static dynamic _bodyFrom(dynamic json) {
|
static dynamic _bodyFrom(dynamic json) {
|
||||||
if (json is Map) {
|
if (json is Map) {
|
||||||
final body = json['body'];
|
final body = json['body'];
|
||||||
@ -103,31 +92,6 @@ class SCUserBadgeRes {
|
|||||||
type == "ACHIEVEMENT";
|
type == "ACHIEVEMENT";
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool _isHonorWallBadge(WearBadge badge) {
|
|
||||||
final sourceType = badge.sourceType?.trim().toUpperCase() ?? "";
|
|
||||||
final type = badge.type?.trim().toUpperCase() ?? "";
|
|
||||||
if (type == "LONG" || type == "VIP" || sourceType == "VIP") {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (sourceType.isNotEmpty) {
|
|
||||||
return sourceType == "ACTIVITY" || sourceType == "ACHIEVEMENT";
|
|
||||||
}
|
|
||||||
return type == "SHORT" ||
|
|
||||||
type == "ACTIVITY" ||
|
|
||||||
type == "ACHIEVEMENT" ||
|
|
||||||
type == "HONOR_ACTIVITY" ||
|
|
||||||
type == "HONOR_ADMIN";
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _badgeSortValue(WearBadge badge) {
|
|
||||||
return badge.updateTime ??
|
|
||||||
badge.expireTime ??
|
|
||||||
DateTime.tryParse(
|
|
||||||
(badge.updatedAt ?? "").replaceFirst(" ", "T"),
|
|
||||||
)?.millisecondsSinceEpoch ??
|
|
||||||
0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static String? _stringValue(dynamic value) {
|
static String? _stringValue(dynamic value) {
|
||||||
final text = value?.toString().trim();
|
final text = value?.toString().trim();
|
||||||
return text == null || text.isEmpty ? null : text;
|
return text == null || text.isEmpty ? null : text;
|
||||||
|
|||||||
@ -471,43 +471,7 @@ _buildPhoneInput(
|
|||||||
|
|
||||||
///vip标识
|
///vip标识
|
||||||
getVIPBadge(String? type, {double? width, double? height}) {
|
getVIPBadge(String? type, {double? width, double? height}) {
|
||||||
final level = _vipBadgeLevel(type);
|
return Container();
|
||||||
if (level <= 0) {
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
|
||||||
final assetLevel = level.clamp(1, 5).toInt();
|
|
||||||
return Image.asset(
|
|
||||||
"sc_images/vip/sc_vip_badge_$assetLevel.png",
|
|
||||||
width: width,
|
|
||||||
height: height,
|
|
||||||
fit: BoxFit.contain,
|
|
||||||
errorBuilder: (_, __, ___) => const SizedBox.shrink(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
int _vipBadgeLevel(String? type) {
|
|
||||||
final text = type?.trim() ?? "";
|
|
||||||
if (text.isEmpty) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
final plain = int.tryParse(text);
|
|
||||||
if ((plain ?? 0) > 0) {
|
|
||||||
return plain!;
|
|
||||||
}
|
|
||||||
final vipMatch = RegExp(
|
|
||||||
r'(?:S?VIP|NOBLE[_\s-]*VIP)[^\d]*([1-9]\d*)',
|
|
||||||
caseSensitive: false,
|
|
||||||
).firstMatch(text);
|
|
||||||
if (vipMatch != null) {
|
|
||||||
return int.tryParse(vipMatch.group(1) ?? "") ?? 0;
|
|
||||||
}
|
|
||||||
final trailingMatch = RegExp(r'([1-9]\d*)$').firstMatch(text);
|
|
||||||
if (trailingMatch != null) {
|
|
||||||
return int.tryParse(trailingMatch.group(1) ?? "") ?? 0;
|
|
||||||
}
|
|
||||||
return RegExp(r'S?VIP|NOBLE[_\s-]*VIP', caseSensitive: false).hasMatch(text)
|
|
||||||
? 1
|
|
||||||
: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///用户等级
|
///用户等级
|
||||||
|
|||||||
@ -1,162 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_debouncer/flutter_debouncer.dart';
|
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
import 'package:yumi/app/routes/sc_fluro_navigator.dart';
|
|
||||||
import 'package:yumi/app_localizations.dart';
|
|
||||||
import 'package:yumi/modules/store/store_route.dart';
|
|
||||||
import 'package:yumi/services/auth/user_profile_manager.dart';
|
|
||||||
import 'package:yumi/shared/business_logic/models/res/bags_list_res.dart';
|
|
||||||
import 'package:yumi/shared/business_logic/models/res/login_res.dart';
|
|
||||||
import 'package:yumi/shared/data_sources/models/enum/sc_props_type.dart';
|
|
||||||
import 'package:yumi/shared/data_sources/sources/local/user_manager.dart';
|
|
||||||
import 'package:yumi/shared/data_sources/sources/repositories/sc_store_repository_imp.dart';
|
|
||||||
import 'package:yumi/shared/tools/sc_loading_manager.dart';
|
|
||||||
import 'package:yumi/ui_kit/components/sc_tts.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/props/sc_data_card_resource_view.dart';
|
|
||||||
|
|
||||||
class PropsBagDataCardDetailDialog extends StatefulWidget {
|
|
||||||
const PropsBagDataCardDetailDialog(this.res, {super.key});
|
|
||||||
|
|
||||||
final BagsListRes res;
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<PropsBagDataCardDetailDialog> createState() =>
|
|
||||||
_PropsBagDataCardDetailDialogState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _PropsBagDataCardDetailDialogState
|
|
||||||
extends State<PropsBagDataCardDetailDialog> {
|
|
||||||
final debouncer = Debouncer();
|
|
||||||
PropsResources? myDataCard;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
myDataCard = AccountStorage().getDataCard();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final expired =
|
|
||||||
(widget.res.expireTime ?? 0) < DateTime.now().millisecondsSinceEpoch;
|
|
||||||
final inUse = myDataCard?.id == widget.res.propsResources?.id;
|
|
||||||
|
|
||||||
return Container(
|
|
||||||
width: 260.w,
|
|
||||||
height: 330.w,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(10.w)),
|
|
||||||
),
|
|
||||||
child: Stack(
|
|
||||||
children: [
|
|
||||||
Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(height: 20.w),
|
|
||||||
text(
|
|
||||||
'Profile Card',
|
|
||||||
fontSize: 16.sp,
|
|
||||||
textColor: Colors.black,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
SizedBox(height: 20.w),
|
|
||||||
ClipRRect(
|
|
||||||
borderRadius: BorderRadius.circular(10.w),
|
|
||||||
child: SizedBox(
|
|
||||||
width: 214.w,
|
|
||||||
height: 150.w,
|
|
||||||
child: SCDataCardResourceView(
|
|
||||||
resource: widget.res.propsResources,
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 25.w),
|
|
||||||
GestureDetector(
|
|
||||||
child: Container(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
width: 130.w,
|
|
||||||
padding: EdgeInsets.symmetric(vertical: 10.w),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: SocialChatTheme.primaryLight,
|
|
||||||
borderRadius: BorderRadius.circular(12.w),
|
|
||||||
),
|
|
||||||
child: text(
|
|
||||||
expired
|
|
||||||
? SCAppLocalizations.of(context)!.renewal
|
|
||||||
: inUse
|
|
||||||
? SCAppLocalizations.of(context)!.unUse
|
|
||||||
: SCAppLocalizations.of(context)!.use,
|
|
||||||
fontSize: 16.sp,
|
|
||||||
textColor: Colors.white,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onTap: () {
|
|
||||||
debouncer.debounce(
|
|
||||||
duration: const Duration(milliseconds: 350),
|
|
||||||
onDebounce: () {
|
|
||||||
if (expired) {
|
|
||||||
SCNavigatorUtils.push(
|
|
||||||
context,
|
|
||||||
StoreRoute.list,
|
|
||||||
replace: false,
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_use(widget.res, inUse);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
right: 20.w,
|
|
||||||
top: 18.w,
|
|
||||||
child: GestureDetector(
|
|
||||||
child: Icon(Icons.close, size: 20.w),
|
|
||||||
onTap: () {
|
|
||||||
SmartDialog.dismiss(tag: "showPropsDetail");
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _use(BagsListRes res, bool unload) {
|
|
||||||
SCLoadingManager.show();
|
|
||||||
final profileManager = Provider.of<SocialChatUserProfileManager>(
|
|
||||||
context,
|
|
||||||
listen: false,
|
|
||||||
);
|
|
||||||
final localizations = SCAppLocalizations.of(context)!;
|
|
||||||
SCStoreRepositoryImp()
|
|
||||||
.switchPropsUse(
|
|
||||||
SCPropsType.DATA_CARD.name,
|
|
||||||
res.propsResources?.id ?? "",
|
|
||||||
unload,
|
|
||||||
)
|
|
||||||
.then((value) async {
|
|
||||||
await profileManager.fetchUserProfileData(loadGuardCount: false);
|
|
||||||
Future.delayed(const Duration(milliseconds: 400), () {
|
|
||||||
SCLoadingManager.hide();
|
|
||||||
SmartDialog.dismiss(tag: "showPropsDetail");
|
|
||||||
});
|
|
||||||
if (!unload) {
|
|
||||||
SCTts.show(localizations.successfulWear);
|
|
||||||
} else {
|
|
||||||
SCTts.show(localizations.successfullyUnloaded);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catchError((e) {
|
|
||||||
SCLoadingManager.hide();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,494 +0,0 @@
|
|||||||
import 'dart:async';
|
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:tancent_vap/utils/constant.dart';
|
|
||||||
import 'package:tancent_vap/widgets/vap_view.dart';
|
|
||||||
import 'package:video_player/video_player.dart';
|
|
||||||
import 'package:yumi/shared/business_logic/models/res/login_res.dart';
|
|
||||||
import 'package:yumi/shared/data_sources/sources/local/file_cache_manager.dart';
|
|
||||||
import 'package:yumi/shared/tools/sc_path_utils.dart';
|
|
||||||
import 'package:yumi/ui_kit/components/sc_compontent.dart';
|
|
||||||
import 'package:yumi/ui_kit/widgets/room/rocket/room_rocket_pag_effect_overlay.dart';
|
|
||||||
import 'package:yumi/ui_kit/widgets/svga/sc_network_svga_widget.dart';
|
|
||||||
|
|
||||||
class SCDataCardResourceView extends StatelessWidget {
|
|
||||||
const SCDataCardResourceView({
|
|
||||||
super.key,
|
|
||||||
this.resource,
|
|
||||||
this.sourceUrl,
|
|
||||||
this.coverUrl,
|
|
||||||
this.width,
|
|
||||||
this.height,
|
|
||||||
this.fit = BoxFit.cover,
|
|
||||||
this.loop = true,
|
|
||||||
this.fallback,
|
|
||||||
});
|
|
||||||
|
|
||||||
final PropsResources? resource;
|
|
||||||
final String? sourceUrl;
|
|
||||||
final String? coverUrl;
|
|
||||||
final double? width;
|
|
||||||
final double? height;
|
|
||||||
final BoxFit fit;
|
|
||||||
final bool loop;
|
|
||||||
final Widget? fallback;
|
|
||||||
|
|
||||||
static bool isSupported(String? url) {
|
|
||||||
return _isSvga(url) ||
|
|
||||||
_isPag(url) ||
|
|
||||||
_isVapVideo(url) ||
|
|
||||||
_isVideo(url) ||
|
|
||||||
_isImage(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return LayoutBuilder(
|
|
||||||
builder: (context, constraints) {
|
|
||||||
final resolvedWidth = _resolvedSize(width, constraints.maxWidth);
|
|
||||||
final resolvedHeight = _resolvedSize(height, constraints.maxHeight);
|
|
||||||
final cover = _firstNonBlank([coverUrl, resource?.cover]);
|
|
||||||
final source = _firstNonBlank([sourceUrl, resource?.sourceUrl]);
|
|
||||||
final resourceUrl = source.isNotEmpty ? source : cover;
|
|
||||||
final fallbackView =
|
|
||||||
fallback ??
|
|
||||||
_buildImage(
|
|
||||||
cover,
|
|
||||||
width: resolvedWidth,
|
|
||||||
height: resolvedHeight,
|
|
||||||
fit: fit,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (resourceUrl.isEmpty) {
|
|
||||||
return fallbackView;
|
|
||||||
}
|
|
||||||
if (_isSvga(resourceUrl)) {
|
|
||||||
return SCNetworkSvgaWidget(
|
|
||||||
resource: resourceUrl,
|
|
||||||
width: resolvedWidth,
|
|
||||||
height: resolvedHeight,
|
|
||||||
loop: loop,
|
|
||||||
fit: fit,
|
|
||||||
fallback: fallbackView,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (_isPag(resourceUrl)) {
|
|
||||||
return RoomRocketPagPreview(
|
|
||||||
resource: resourceUrl,
|
|
||||||
width: resolvedWidth,
|
|
||||||
height: resolvedHeight,
|
|
||||||
loop: loop,
|
|
||||||
fit: fit,
|
|
||||||
underlayBuilder: (_) => fallbackView,
|
|
||||||
defaultBuilder: (_) => fallbackView,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (_isVapVideo(resourceUrl)) {
|
|
||||||
if (defaultTargetPlatform != TargetPlatform.android) {
|
|
||||||
return fallbackView;
|
|
||||||
}
|
|
||||||
return _LoopingDataCardVapVideo(
|
|
||||||
url: resourceUrl,
|
|
||||||
width: resolvedWidth,
|
|
||||||
height: resolvedHeight,
|
|
||||||
fit: fit,
|
|
||||||
loop: loop,
|
|
||||||
fallback: fallbackView,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (_isVideo(resourceUrl)) {
|
|
||||||
return _LoopingDataCardVideo(
|
|
||||||
url: resourceUrl,
|
|
||||||
width: resolvedWidth,
|
|
||||||
height: resolvedHeight,
|
|
||||||
fit: fit,
|
|
||||||
loop: loop,
|
|
||||||
fallback: fallbackView,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return _buildImage(
|
|
||||||
resourceUrl,
|
|
||||||
width: resolvedWidth,
|
|
||||||
height: resolvedHeight,
|
|
||||||
fit: fit,
|
|
||||||
fallback: fallbackView,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static double? _resolvedSize(double? fixed, double constrained) {
|
|
||||||
if (fixed != null && fixed.isFinite && fixed > 0) {
|
|
||||||
return fixed;
|
|
||||||
}
|
|
||||||
if (constrained.isFinite && constrained > 0) {
|
|
||||||
return constrained;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Widget _buildImage(
|
|
||||||
String url, {
|
|
||||||
double? width,
|
|
||||||
double? height,
|
|
||||||
required BoxFit fit,
|
|
||||||
Widget? fallback,
|
|
||||||
}) {
|
|
||||||
if (url.trim().isEmpty) {
|
|
||||||
return fallback ?? SizedBox(width: width, height: height);
|
|
||||||
}
|
|
||||||
return netImage(
|
|
||||||
url: url.trim(),
|
|
||||||
width: width,
|
|
||||||
height: height,
|
|
||||||
fit: fit,
|
|
||||||
noDefaultImg: fallback != null,
|
|
||||||
loadingWidget: fallback,
|
|
||||||
errorWidget: fallback,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static String _firstNonBlank(Iterable<String?> values) {
|
|
||||||
for (final value in values) {
|
|
||||||
final text = value?.trim() ?? '';
|
|
||||||
if (text.isNotEmpty) {
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool _hasExtension(String? url, List<String> extensions) {
|
|
||||||
final lower = url?.trim().toLowerCase() ?? '';
|
|
||||||
if (lower.isEmpty) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return extensions.any(
|
|
||||||
(extension) =>
|
|
||||||
lower.endsWith(extension) ||
|
|
||||||
lower.contains('$extension?') ||
|
|
||||||
lower.contains('$extension&'),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool _isSvga(String? url) => _hasExtension(url, const ['.svga']);
|
|
||||||
|
|
||||||
static bool _isPag(String? url) => _hasExtension(url, const ['.pag']);
|
|
||||||
|
|
||||||
static bool _isVapVideo(String? url) =>
|
|
||||||
_hasExtension(url, const ['.mp4', '.vap']);
|
|
||||||
|
|
||||||
static bool _isVideo(String? url) =>
|
|
||||||
_hasExtension(url, const ['.mov', '.m4v']);
|
|
||||||
|
|
||||||
static bool _isImage(String? url) => _hasExtension(url, const [
|
|
||||||
'.png',
|
|
||||||
'.jpg',
|
|
||||||
'.jpeg',
|
|
||||||
'.webp',
|
|
||||||
'.gif',
|
|
||||||
'.bmp',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
class _LoopingDataCardVideo extends StatefulWidget {
|
|
||||||
const _LoopingDataCardVideo({
|
|
||||||
required this.url,
|
|
||||||
this.width,
|
|
||||||
this.height,
|
|
||||||
required this.fit,
|
|
||||||
required this.loop,
|
|
||||||
required this.fallback,
|
|
||||||
});
|
|
||||||
|
|
||||||
final String url;
|
|
||||||
final double? width;
|
|
||||||
final double? height;
|
|
||||||
final BoxFit fit;
|
|
||||||
final bool loop;
|
|
||||||
final Widget fallback;
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<_LoopingDataCardVideo> createState() => _LoopingDataCardVideoState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _LoopingDataCardVideoState extends State<_LoopingDataCardVideo> {
|
|
||||||
VideoPlayerController? _controller;
|
|
||||||
bool _ready = false;
|
|
||||||
bool _failed = false;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
_load();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void didUpdateWidget(covariant _LoopingDataCardVideo oldWidget) {
|
|
||||||
super.didUpdateWidget(oldWidget);
|
|
||||||
if (oldWidget.url != widget.url || oldWidget.loop != widget.loop) {
|
|
||||||
_disposeController();
|
|
||||||
_load();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _load() async {
|
|
||||||
final url = widget.url.trim();
|
|
||||||
if (url.isEmpty) {
|
|
||||||
setState(() => _failed = true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setState(() {
|
|
||||||
_ready = false;
|
|
||||||
_failed = false;
|
|
||||||
});
|
|
||||||
final controller = VideoPlayerController.networkUrl(Uri.parse(url));
|
|
||||||
_controller = controller;
|
|
||||||
try {
|
|
||||||
await controller.setLooping(widget.loop);
|
|
||||||
await controller.setVolume(0);
|
|
||||||
await controller.initialize();
|
|
||||||
if (!mounted || _controller != controller) {
|
|
||||||
await controller.dispose();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setState(() => _ready = true);
|
|
||||||
await controller.play();
|
|
||||||
} catch (_) {
|
|
||||||
if (!mounted || _controller != controller) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setState(() {
|
|
||||||
_ready = false;
|
|
||||||
_failed = true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _disposeController() {
|
|
||||||
final controller = _controller;
|
|
||||||
_controller = null;
|
|
||||||
if (controller != null) {
|
|
||||||
controller.dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
_disposeController();
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final controller = _controller;
|
|
||||||
if (_failed || !_ready || controller == null) {
|
|
||||||
return widget.fallback;
|
|
||||||
}
|
|
||||||
final videoSize = controller.value.size;
|
|
||||||
final child =
|
|
||||||
videoSize.width > 0 && videoSize.height > 0
|
|
||||||
? FittedBox(
|
|
||||||
fit: widget.fit,
|
|
||||||
child: SizedBox(
|
|
||||||
width: videoSize.width,
|
|
||||||
height: videoSize.height,
|
|
||||||
child: VideoPlayer(controller),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: VideoPlayer(controller);
|
|
||||||
return SizedBox(
|
|
||||||
width: widget.width,
|
|
||||||
height: widget.height,
|
|
||||||
child: ClipRect(child: child),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class _LoopingDataCardVapVideo extends StatefulWidget {
|
|
||||||
const _LoopingDataCardVapVideo({
|
|
||||||
required this.url,
|
|
||||||
this.width,
|
|
||||||
this.height,
|
|
||||||
required this.fit,
|
|
||||||
required this.loop,
|
|
||||||
required this.fallback,
|
|
||||||
});
|
|
||||||
|
|
||||||
final String url;
|
|
||||||
final double? width;
|
|
||||||
final double? height;
|
|
||||||
final BoxFit fit;
|
|
||||||
final bool loop;
|
|
||||||
final Widget fallback;
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<_LoopingDataCardVapVideo> createState() =>
|
|
||||||
_LoopingDataCardVapVideoState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _LoopingDataCardVapVideoState extends State<_LoopingDataCardVapVideo> {
|
|
||||||
static const int _legacyRgbLeftAlphaRightMode = 3;
|
|
||||||
|
|
||||||
VapController? _controller;
|
|
||||||
int _playToken = 0;
|
|
||||||
bool _failed = false;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void didUpdateWidget(covariant _LoopingDataCardVapVideo oldWidget) {
|
|
||||||
super.didUpdateWidget(oldWidget);
|
|
||||||
if (oldWidget.url != widget.url ||
|
|
||||||
oldWidget.loop != widget.loop ||
|
|
||||||
oldWidget.fit != widget.fit) {
|
|
||||||
_playToken++;
|
|
||||||
_stop();
|
|
||||||
if (_failed) {
|
|
||||||
setState(() => _failed = false);
|
|
||||||
}
|
|
||||||
_play();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
_playToken++;
|
|
||||||
_stop();
|
|
||||||
_controller = null;
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
void _handleViewCreated(VapController controller) {
|
|
||||||
_controller = controller;
|
|
||||||
controller.setAnimListener(
|
|
||||||
onFailed: (_, __, ___) => _markFailed(),
|
|
||||||
onVideoStart: () {
|
|
||||||
if (mounted && _failed) {
|
|
||||||
setState(() => _failed = false);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
_play();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _play() async {
|
|
||||||
final controller = _controller;
|
|
||||||
final url = widget.url.trim();
|
|
||||||
if (controller == null || url.isEmpty) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final token = ++_playToken;
|
|
||||||
try {
|
|
||||||
final playablePath = await _resolvePlayablePath(url);
|
|
||||||
if (!_isCurrent(token, controller)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await controller.stop();
|
|
||||||
if (!_isCurrent(token, controller)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await controller.setMute(true);
|
|
||||||
await controller.enableVersion1(true);
|
|
||||||
await controller.setVideoMode(_legacyRgbLeftAlphaRightMode);
|
|
||||||
await controller.setLoop(widget.loop ? -1 : 0);
|
|
||||||
await controller.setScaleType(_scaleTypeForFit(widget.fit).key);
|
|
||||||
if (!_isCurrent(token, controller)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final pathType = SCPathUtils.getPathType(playablePath);
|
|
||||||
if (pathType == PathType.asset) {
|
|
||||||
unawaited(
|
|
||||||
controller.playAsset(playablePath).catchError((_) {
|
|
||||||
_markFailed();
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
unawaited(
|
|
||||||
controller.playFile(_normalizeFilePath(playablePath)).catchError((_) {
|
|
||||||
_markFailed();
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} catch (_) {
|
|
||||||
if (_isCurrent(token, controller)) {
|
|
||||||
_markFailed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool _isCurrent(int token, VapController controller) {
|
|
||||||
return mounted && token == _playToken && identical(_controller, controller);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<String> _resolvePlayablePath(String url) async {
|
|
||||||
switch (SCPathUtils.getPathType(url)) {
|
|
||||||
case PathType.network:
|
|
||||||
final file = await FileCacheManager.getInstance().getFile(url: url);
|
|
||||||
return file.path;
|
|
||||||
case PathType.asset:
|
|
||||||
case PathType.file:
|
|
||||||
case PathType.unknown:
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String _normalizeFilePath(String path) {
|
|
||||||
final uri = Uri.tryParse(path);
|
|
||||||
if (uri != null && uri.scheme == 'file') {
|
|
||||||
return uri.toFilePath();
|
|
||||||
}
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
void _stop() {
|
|
||||||
final controller = _controller;
|
|
||||||
if (controller != null) {
|
|
||||||
unawaited(controller.stop().catchError((_) {}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _markFailed() {
|
|
||||||
if (!mounted || _failed) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setState(() => _failed = true);
|
|
||||||
}
|
|
||||||
|
|
||||||
ScaleType _scaleTypeForFit(BoxFit fit) {
|
|
||||||
switch (fit) {
|
|
||||||
case BoxFit.cover:
|
|
||||||
case BoxFit.fitWidth:
|
|
||||||
case BoxFit.fitHeight:
|
|
||||||
case BoxFit.none:
|
|
||||||
return ScaleType.centerCrop;
|
|
||||||
case BoxFit.fill:
|
|
||||||
return ScaleType.fitXY;
|
|
||||||
case BoxFit.contain:
|
|
||||||
case BoxFit.scaleDown:
|
|
||||||
return ScaleType.fitCenter;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return SizedBox(
|
|
||||||
width: widget.width,
|
|
||||||
height: widget.height,
|
|
||||||
child: ClipRect(
|
|
||||||
child: Stack(
|
|
||||||
fit: StackFit.expand,
|
|
||||||
children: [
|
|
||||||
widget.fallback,
|
|
||||||
if (!_failed)
|
|
||||||
VapView(
|
|
||||||
scaleType: _scaleTypeForFit(widget.fit),
|
|
||||||
repeat: widget.loop ? -1 : 0,
|
|
||||||
mute: true,
|
|
||||||
onViewCreated: _handleViewCreated,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1296,10 +1296,10 @@ class _MsgItemState extends State<MsgItem> {
|
|||||||
child: SCUserBadgeStrip(
|
child: SCUserBadgeStrip(
|
||||||
userId: userId,
|
userId: userId,
|
||||||
fallbackBadges: fallbackBadges,
|
fallbackBadges: fallbackBadges,
|
||||||
height: 23.w,
|
height: 16.w,
|
||||||
badgeHeight: 21.w,
|
badgeHeight: 14.w,
|
||||||
longBadgeWidth: 51.w,
|
longBadgeWidth: 34.w,
|
||||||
spacing: 4.5.w,
|
spacing: 3.w,
|
||||||
maxBadges: 8,
|
maxBadges: 8,
|
||||||
reserveSpace: true,
|
reserveSpace: true,
|
||||||
),
|
),
|
||||||
@ -1841,10 +1841,10 @@ class _MsgItemState extends State<MsgItem> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 8.w),
|
SizedBox(width: 3.w),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 50.w,
|
height: 48.w,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@ -1887,10 +1887,10 @@ class _MsgItemState extends State<MsgItem> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 8.w),
|
SizedBox(width: 3.w),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 50.w,
|
height: 48.w,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
|||||||
@ -21,7 +21,6 @@ import 'package:yumi/ui_kit/components/sc_compontent.dart';
|
|||||||
import 'package:yumi/app/routes/sc_fluro_navigator.dart';
|
import 'package:yumi/app/routes/sc_fluro_navigator.dart';
|
||||||
import 'package:yumi/shared/tools/sc_lk_dialog_util.dart';
|
import 'package:yumi/shared/tools/sc_lk_dialog_util.dart';
|
||||||
import 'package:yumi/shared/tools/sc_room_utils.dart';
|
import 'package:yumi/shared/tools/sc_room_utils.dart';
|
||||||
import 'package:yumi/shared/data_sources/models/enum/sc_props_type.dart';
|
|
||||||
import 'package:yumi/shared/data_sources/sources/repositories/sc_user_repository_impl.dart';
|
import 'package:yumi/shared/data_sources/sources/repositories/sc_user_repository_impl.dart';
|
||||||
import 'package:yumi/shared/business_logic/models/res/login_res.dart';
|
import 'package:yumi/shared/business_logic/models/res/login_res.dart';
|
||||||
import 'package:yumi/shared/business_logic/models/res/room_user_card_res.dart'
|
import 'package:yumi/shared/business_logic/models/res/room_user_card_res.dart'
|
||||||
@ -31,7 +30,6 @@ import 'package:yumi/services/audio/rtc_manager.dart';
|
|||||||
import 'package:yumi/services/auth/user_profile_manager.dart';
|
import 'package:yumi/services/auth/user_profile_manager.dart';
|
||||||
import 'package:yumi/modules/gift/gift_page.dart';
|
import 'package:yumi/modules/gift/gift_page.dart';
|
||||||
import 'package:yumi/ui_kit/widgets/id/sc_special_id_badge.dart';
|
import 'package:yumi/ui_kit/widgets/id/sc_special_id_badge.dart';
|
||||||
import 'package:yumi/ui_kit/widgets/props/sc_data_card_resource_view.dart';
|
|
||||||
|
|
||||||
import '../../../shared/data_sources/models/enum/sc_room_roles_type.dart';
|
import '../../../shared/data_sources/models/enum/sc_room_roles_type.dart';
|
||||||
import '../../../shared/business_logic/models/res/sc_user_identity_res.dart';
|
import '../../../shared/business_logic/models/res/sc_user_identity_res.dart';
|
||||||
@ -85,7 +83,7 @@ class _RoomUserInfoCardState extends State<RoomUserInfoCard> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final sheetHeight = MediaQuery.of(context).size.height * 0.6;
|
final sheetHeight = MediaQuery.of(context).size.height * 0.4;
|
||||||
|
|
||||||
return Consumer<SocialChatUserProfileManager>(
|
return Consumer<SocialChatUserProfileManager>(
|
||||||
builder: (context, ref, child) {
|
builder: (context, ref, child) {
|
||||||
@ -153,7 +151,6 @@ class _RoomUserInfoCardState extends State<RoomUserInfoCard> {
|
|||||||
}) {
|
}) {
|
||||||
final bottomPadding = MediaQuery.of(context).padding.bottom;
|
final bottomPadding = MediaQuery.of(context).padding.bottom;
|
||||||
final profile = ref.userCardInfo?.userProfile;
|
final profile = ref.userCardInfo?.userProfile;
|
||||||
final dataCard = _activeDataCard(ref.userCardInfo);
|
|
||||||
final canShowReport = currentUserId != widget.userId;
|
final canShowReport = currentUserId != widget.userId;
|
||||||
final canShowSetting =
|
final canShowSetting =
|
||||||
canShowReport &&
|
canShowReport &&
|
||||||
@ -165,9 +162,10 @@ class _RoomUserInfoCardState extends State<RoomUserInfoCard> {
|
|||||||
height: sheetHeight,
|
height: sheetHeight,
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
borderRadius: BorderRadius.vertical(top: Radius.circular(18.w)),
|
borderRadius: BorderRadius.vertical(top: Radius.circular(18.w)),
|
||||||
|
child: DecoratedBox(
|
||||||
|
decoration: _sheetDecoration(),
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Positioned.fill(child: _buildSheetBackground(dataCard)),
|
|
||||||
Positioned.fill(
|
Positioned.fill(
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
physics: const ClampingScrollPhysics(),
|
physics: const ClampingScrollPhysics(),
|
||||||
@ -245,6 +243,7 @@ class _RoomUserInfoCardState extends State<RoomUserInfoCard> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,57 +262,6 @@ class _RoomUserInfoCardState extends State<RoomUserInfoCard> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildSheetBackground(PropsResources? dataCard) {
|
|
||||||
if (dataCard == null) {
|
|
||||||
return DecoratedBox(decoration: _sheetDecoration());
|
|
||||||
}
|
|
||||||
return Stack(
|
|
||||||
fit: StackFit.expand,
|
|
||||||
children: [
|
|
||||||
SCDataCardResourceView(resource: dataCard, fit: BoxFit.cover),
|
|
||||||
DecoratedBox(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
gradient: LinearGradient(
|
|
||||||
begin: Alignment.topCenter,
|
|
||||||
end: Alignment.bottomCenter,
|
|
||||||
colors: [
|
|
||||||
Colors.white.withValues(alpha: 0.08),
|
|
||||||
Colors.white.withValues(alpha: 0.22),
|
|
||||||
Colors.white.withValues(alpha: 0.58),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
PropsResources? _activeDataCard(room_card.RoomUserCardRes? cardInfo) {
|
|
||||||
return _activeDataCardFromUseProps(cardInfo?.userProfile?.useProps) ??
|
|
||||||
_activeDataCardFromUseProps(cardInfo?.useProps);
|
|
||||||
}
|
|
||||||
|
|
||||||
PropsResources? _activeDataCardFromUseProps(List<UseProps>? useProps) {
|
|
||||||
final now = DateTime.now().millisecondsSinceEpoch;
|
|
||||||
for (final item in useProps ?? const <UseProps>[]) {
|
|
||||||
final resource = item.propsResources;
|
|
||||||
if (resource?.type != SCPropsType.DATA_CARD.name) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
final expireText = item.expireTime?.trim() ?? "";
|
|
||||||
final expireTime = int.tryParse(expireText);
|
|
||||||
if (expireText.isNotEmpty && (expireTime ?? 0) <= now) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
final source = resource?.sourceUrl?.trim() ?? "";
|
|
||||||
final cover = resource?.cover?.trim() ?? "";
|
|
||||||
if (source.isNotEmpty || cover.isNotEmpty) {
|
|
||||||
return resource;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildProfileHeader(
|
Widget _buildProfileHeader(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
SocialChatUserProfile? profile,
|
SocialChatUserProfile? profile,
|
||||||
@ -342,7 +290,7 @@ class _RoomUserInfoCardState extends State<RoomUserInfoCard> {
|
|||||||
),
|
),
|
||||||
SizedBox(width: 4.w),
|
SizedBox(width: 4.w),
|
||||||
socialchatNickNameText(
|
socialchatNickNameText(
|
||||||
maxWidth: 116.w,
|
maxWidth: 190.w,
|
||||||
profile?.userNickname ?? "",
|
profile?.userNickname ?? "",
|
||||||
fontSize: 18.sp,
|
fontSize: 18.sp,
|
||||||
textColor: Colors.black,
|
textColor: Colors.black,
|
||||||
@ -350,30 +298,6 @@ class _RoomUserInfoCardState extends State<RoomUserInfoCard> {
|
|||||||
type: "",
|
type: "",
|
||||||
needScroll: (profile?.userNickname?.characters.length ?? 0) > 12,
|
needScroll: (profile?.userNickname?.characters.length ?? 0) > 12,
|
||||||
),
|
),
|
||||||
SizedBox(width: 3.w),
|
|
||||||
getVIPBadge(
|
|
||||||
profile?.vipLevel ?? profile?.getVIP()?.name,
|
|
||||||
width: 45.w,
|
|
||||||
height: 25.w,
|
|
||||||
),
|
|
||||||
SizedBox(width: 3.w),
|
|
||||||
getWealthLevel(
|
|
||||||
profile?.wealthLevel ??
|
|
||||||
ref.userCardInfo?.userLevel?.wealthLevel ??
|
|
||||||
0,
|
|
||||||
width: 42.w,
|
|
||||||
height: 20.w,
|
|
||||||
fontSize: 9.sp,
|
|
||||||
),
|
|
||||||
SizedBox(width: 2.w),
|
|
||||||
getUserLevel(
|
|
||||||
profile?.charmLevel ??
|
|
||||||
ref.userCardInfo?.userLevel?.charmLevel ??
|
|
||||||
0,
|
|
||||||
width: 42.w,
|
|
||||||
height: 20.w,
|
|
||||||
fontSize: 9.sp,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 2.w),
|
SizedBox(height: 2.w),
|
||||||
@ -498,10 +422,10 @@ class _RoomUserInfoCardState extends State<RoomUserInfoCard> {
|
|||||||
return SCUserBadgeStrip(
|
return SCUserBadgeStrip(
|
||||||
userId: userId,
|
userId: userId,
|
||||||
fallbackBadges: _roomCardFallbackBadges(ref, profile),
|
fallbackBadges: _roomCardFallbackBadges(ref, profile),
|
||||||
height: 82.w,
|
height: 55.w,
|
||||||
badgeHeight: 34.5.w,
|
badgeHeight: 23.w,
|
||||||
longBadgeWidth: 87.w,
|
longBadgeWidth: 58.w,
|
||||||
spacing: 10.w,
|
spacing: 8.w,
|
||||||
maxBadges: 12,
|
maxBadges: 12,
|
||||||
wrap: true,
|
wrap: true,
|
||||||
reserveSpace: true,
|
reserveSpace: true,
|
||||||
|
|||||||
@ -1,247 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
import 'package:yumi/app/constants/sc_global_config.dart';
|
|
||||||
import 'package:yumi/app/routes/sc_fluro_navigator.dart';
|
|
||||||
import 'package:yumi/app_localizations.dart';
|
|
||||||
import 'package:yumi/main.dart';
|
|
||||||
import 'package:yumi/modules/wallet/wallet_route.dart';
|
|
||||||
import 'package:yumi/services/auth/user_profile_manager.dart';
|
|
||||||
import 'package:yumi/shared/business_logic/models/res/store_list_res.dart';
|
|
||||||
import 'package:yumi/shared/data_sources/models/enum/sc_currency_type.dart';
|
|
||||||
import 'package:yumi/shared/data_sources/models/enum/sc_props_type.dart';
|
|
||||||
import 'package:yumi/shared/data_sources/sources/repositories/sc_store_repository_imp.dart';
|
|
||||||
import 'package:yumi/shared/tools/sc_loading_manager.dart';
|
|
||||||
import 'package:yumi/ui_kit/components/sc_debounce_widget.dart';
|
|
||||||
import 'package:yumi/ui_kit/components/sc_tts.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/props/sc_data_card_resource_view.dart';
|
|
||||||
|
|
||||||
class PropsStoreDataCardDetailDialog extends StatefulWidget {
|
|
||||||
const PropsStoreDataCardDetailDialog(this.res, this.disCount, {super.key});
|
|
||||||
|
|
||||||
final StoreListRes res;
|
|
||||||
final double disCount;
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<PropsStoreDataCardDetailDialog> createState() =>
|
|
||||||
_PropsStoreDataCardDetailDialogState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _PropsStoreDataCardDetailDialogState
|
|
||||||
extends State<PropsStoreDataCardDetailDialog> {
|
|
||||||
PropsPrices? currentPropsPrice;
|
|
||||||
int currentIndex = 0;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
currentPropsPrice =
|
|
||||||
(widget.res.propsPrices?.isNotEmpty ?? false)
|
|
||||||
? widget.res.propsPrices![currentIndex]
|
|
||||||
: null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return SafeArea(
|
|
||||||
top: false,
|
|
||||||
child: Container(
|
|
||||||
height: 360.w,
|
|
||||||
width: ScreenUtil().screenWidth,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: const Color(0xff03523a),
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(10.w)),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(height: 18.w),
|
|
||||||
ClipRRect(
|
|
||||||
borderRadius: BorderRadius.circular(12.w),
|
|
||||||
child: SizedBox(
|
|
||||||
width: 220.w,
|
|
||||||
height: 145.w,
|
|
||||||
child: SCDataCardResourceView(
|
|
||||||
resource: widget.res.propsResources,
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 18.w),
|
|
||||||
Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
SizedBox(width: 15.w),
|
|
||||||
Expanded(
|
|
||||||
child: text(
|
|
||||||
widget.res.propsResources?.name ?? "",
|
|
||||||
textColor: Colors.white,
|
|
||||||
fontSize: 12.sp,
|
|
||||||
maxLines: 1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Image.asset(
|
|
||||||
"sc_images/general/sc_icon_jb.png",
|
|
||||||
width: 22.w,
|
|
||||||
height: 22.w,
|
|
||||||
),
|
|
||||||
if (widget.disCount < 1)
|
|
||||||
text(
|
|
||||||
"${currentPropsPrice?.amount ?? 0}",
|
|
||||||
textColor: SocialChatTheme.primaryLight,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
decoration: TextDecoration.lineThrough,
|
|
||||||
),
|
|
||||||
if (widget.disCount < 1) SizedBox(width: 5.w),
|
|
||||||
text(
|
|
||||||
"${((currentPropsPrice?.amount ?? 0) * widget.disCount).toInt()}",
|
|
||||||
textColor: SocialChatTheme.primaryLight,
|
|
||||||
fontSize: 13.sp,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
|
||||||
SizedBox(width: 15.w),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SizedBox(height: 10.w),
|
|
||||||
SizedBox(
|
|
||||||
height: 28.w,
|
|
||||||
child: ListView.separated(
|
|
||||||
scrollDirection: Axis.horizontal,
|
|
||||||
shrinkWrap: true,
|
|
||||||
itemCount: widget.res.propsPrices?.length ?? 0,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
return GestureDetector(
|
|
||||||
child: Container(
|
|
||||||
width: 110.w,
|
|
||||||
alignment: Alignment.center,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(5.w),
|
|
||||||
color: const Color(0xff18F2B1).withValues(alpha: 0.1),
|
|
||||||
border: Border.all(
|
|
||||||
color:
|
|
||||||
index == currentIndex
|
|
||||||
? SocialChatTheme.primaryLight
|
|
||||||
: Colors.transparent,
|
|
||||||
width: 1.w,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: text(
|
|
||||||
"${widget.res.propsPrices?[index].days} ${SCAppLocalizations.of(context)!.day}",
|
|
||||||
textColor: SocialChatTheme.primaryLight,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onTap: () {
|
|
||||||
currentIndex = index;
|
|
||||||
currentPropsPrice = widget.res.propsPrices?[index];
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
separatorBuilder: (BuildContext context, int index) {
|
|
||||||
return SizedBox(width: 5.w);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 18.w),
|
|
||||||
Container(
|
|
||||||
color: Colors.black12,
|
|
||||||
width: ScreenUtil().screenWidth,
|
|
||||||
height: 0.5.w,
|
|
||||||
),
|
|
||||||
SizedBox(height: 18.w),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Consumer<SocialChatUserProfileManager>(
|
|
||||||
builder: (context, ref, child) {
|
|
||||||
return GestureDetector(
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
SizedBox(width: 10.w),
|
|
||||||
Image.asset(
|
|
||||||
SCGlobalConfig.businessLogicStrategy
|
|
||||||
.getStorePageGoldIcon(),
|
|
||||||
width: 20.w,
|
|
||||||
height: 20.w,
|
|
||||||
),
|
|
||||||
SizedBox(width: 5.w),
|
|
||||||
text(
|
|
||||||
"${ref.myBalance}",
|
|
||||||
fontSize: 13.sp,
|
|
||||||
textColor: SocialChatTheme.primaryLight,
|
|
||||||
),
|
|
||||||
Icon(
|
|
||||||
Icons.chevron_right,
|
|
||||||
size: 20.w,
|
|
||||||
color: SocialChatTheme.primaryLight,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
onTap: () {
|
|
||||||
SmartDialog.dismiss(tag: "showPropsDetail");
|
|
||||||
SCNavigatorUtils.push(
|
|
||||||
navigatorKey.currentState!.context,
|
|
||||||
WalletRoute.recharge,
|
|
||||||
replace: false,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const Spacer(),
|
|
||||||
SCDebounceWidget(
|
|
||||||
onTap: _purchase,
|
|
||||||
child: Container(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
width: 130.w,
|
|
||||||
padding: EdgeInsets.symmetric(vertical: 10.w),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: SocialChatTheme.primaryLight,
|
|
||||||
borderRadius: BorderRadius.circular(12.w),
|
|
||||||
),
|
|
||||||
child: text(
|
|
||||||
SCAppLocalizations.of(context)!.purchase,
|
|
||||||
fontSize: 16.sp,
|
|
||||||
textColor: Colors.white,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(width: 10.w),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _purchase() {
|
|
||||||
if (currentPropsPrice == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final profileManager = Provider.of<SocialChatUserProfileManager>(
|
|
||||||
context,
|
|
||||||
listen: false,
|
|
||||||
);
|
|
||||||
final localizations = SCAppLocalizations.of(context)!;
|
|
||||||
SCLoadingManager.show();
|
|
||||||
SCStoreRepositoryImp()
|
|
||||||
.storePurchasing(
|
|
||||||
widget.res.id ?? "",
|
|
||||||
SCPropsType.DATA_CARD.name,
|
|
||||||
SCCurrencyType.GOLD.name,
|
|
||||||
"${currentPropsPrice?.days}",
|
|
||||||
)
|
|
||||||
.then((value) {
|
|
||||||
SmartDialog.dismiss(tag: "showPropsDetail");
|
|
||||||
SCLoadingManager.hide();
|
|
||||||
SCTts.show(localizations.purchaseIsSuccessful);
|
|
||||||
profileManager.updateBalance(value);
|
|
||||||
})
|
|
||||||
.catchError((e) {
|
|
||||||
SCLoadingManager.hide();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -264,18 +264,6 @@ class VapView(
|
|||||||
result.success(null)
|
result.success(null)
|
||||||
}
|
}
|
||||||
|
|
||||||
"enableVersion1" -> {
|
|
||||||
val enable = call.argument<Boolean>("enable") ?: false
|
|
||||||
animView.enableVersion1(enable)
|
|
||||||
result.success(null)
|
|
||||||
}
|
|
||||||
|
|
||||||
"setVideoMode" -> {
|
|
||||||
val mode = call.argument<Int>("mode") ?: 1
|
|
||||||
animView.setVideoMode(mode)
|
|
||||||
result.success(null)
|
|
||||||
}
|
|
||||||
|
|
||||||
"setVapTagContent" -> {
|
"setVapTagContent" -> {
|
||||||
val tag = call.argument<String>("tag")
|
val tag = call.argument<String>("tag")
|
||||||
val contentMap = call.argument<Map<String, String>>("content")
|
val contentMap = call.argument<Map<String, String>>("content")
|
||||||
|
|||||||
@ -67,8 +67,6 @@ public class VapFlutterView: NSObject, FlutterPlatformView {
|
|||||||
scaleType = value
|
scaleType = value
|
||||||
}
|
}
|
||||||
result(nil)
|
result(nil)
|
||||||
case "enableVersion1", "setVideoMode":
|
|
||||||
result(nil)
|
|
||||||
case "setVapTagContent":
|
case "setVapTagContent":
|
||||||
if let args = call.arguments as? [String: Any],
|
if let args = call.arguments as? [String: Any],
|
||||||
let tag = args["tag"] as? String,
|
let tag = args["tag"] as? String,
|
||||||
|
|||||||
@ -396,23 +396,6 @@ class VapController {
|
|||||||
await __channel.invokeMethod('setScaleType', {'scaleType': scaleType});
|
await __channel.invokeMethod('setScaleType', {'scaleType': scaleType});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Enables compatibility mode for legacy RGB/alpha split MP4 resources
|
|
||||||
/// that do not contain a VAP config box.
|
|
||||||
Future<void> enableVersion1(bool enable) async {
|
|
||||||
await __channel.invokeMethod('enableVersion1', {'enable': enable});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Sets legacy split MP4 mode.
|
|
||||||
///
|
|
||||||
/// Tencent VAP values:
|
|
||||||
/// - 1: alpha left, RGB right
|
|
||||||
/// - 2: alpha top, RGB bottom
|
|
||||||
/// - 3: RGB left, alpha right
|
|
||||||
/// - 4: RGB top, alpha bottom
|
|
||||||
Future<void> setVideoMode(int mode) async {
|
|
||||||
await __channel.invokeMethod('setVideoMode', {'mode': mode});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Sets content for a specific VAP tag.
|
/// Sets content for a specific VAP tag.
|
||||||
///
|
///
|
||||||
/// VAP tags are placeholders in the animation file that can be replaced
|
/// VAP tags are placeholders in the animation file that can be replaced
|
||||||
|
|||||||
@ -1,82 +0,0 @@
|
|||||||
import 'package:flutter_test/flutter_test.dart';
|
|
||||||
import 'package:yumi/shared/business_logic/models/res/sc_user_badge_res.dart';
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
group('SCUserBadgeRes honor wall badges', () {
|
|
||||||
test('uses short badges only and sorts newest first', () {
|
|
||||||
final result = SCUserBadgeRes.fromJson({
|
|
||||||
'longBadges': [
|
|
||||||
{
|
|
||||||
'id': 'vip',
|
|
||||||
'type': 'LONG',
|
|
||||||
'sourceType': 'VIP',
|
|
||||||
'selectUrl': 'https://example.com/vip.png',
|
|
||||||
'updateTime': 3000,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'shortBadges': [
|
|
||||||
{
|
|
||||||
'id': 'old',
|
|
||||||
'type': 'SHORT',
|
|
||||||
'sourceType': 'ACTIVITY',
|
|
||||||
'selectUrl': 'https://example.com/old.png',
|
|
||||||
'updateTime': 1000,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'id': 'new',
|
|
||||||
'type': 'SHORT',
|
|
||||||
'sourceType': 'ACHIEVEMENT',
|
|
||||||
'selectUrl': 'https://example.com/new.png',
|
|
||||||
'updateTime': 2000,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(result.displayBadges.map((badge) => badge.id), [
|
|
||||||
'vip',
|
|
||||||
'old',
|
|
||||||
'new',
|
|
||||||
]);
|
|
||||||
expect(result.honorWallBadges.map((badge) => badge.id), ['new', 'old']);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('filters long and vip badges from legacy mixed badges', () {
|
|
||||||
final result = SCUserBadgeRes.fromJson({
|
|
||||||
'badges': [
|
|
||||||
{
|
|
||||||
'id': 'long',
|
|
||||||
'type': 'LONG',
|
|
||||||
'selectUrl': 'https://example.com/long.png',
|
|
||||||
'updateTime': 3000,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'id': 'vip',
|
|
||||||
'type': 'VIP',
|
|
||||||
'sourceType': 'VIP',
|
|
||||||
'selectUrl': 'https://example.com/vip.png',
|
|
||||||
'updateTime': 2500,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'id': 'activity',
|
|
||||||
'type': 'ACTIVITY',
|
|
||||||
'sourceType': 'ACTIVITY',
|
|
||||||
'selectUrl': 'https://example.com/activity.png',
|
|
||||||
'updateTime': 1000,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'id': 'achievement',
|
|
||||||
'type': 'ACHIEVEMENT',
|
|
||||||
'sourceType': 'ACHIEVEMENT',
|
|
||||||
'selectUrl': 'https://example.com/achievement.png',
|
|
||||||
'updateTime': 2000,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(result.honorWallBadges.map((badge) => badge.id), [
|
|
||||||
'achievement',
|
|
||||||
'activity',
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user