修复一些已知bug
This commit is contained in:
parent
5086cdd97c
commit
20106df6f0
@ -16,7 +16,7 @@ class SCVariant1Config implements AppConfig {
|
||||
@override
|
||||
String get apiHost => const String.fromEnvironment(
|
||||
'API_HOST',
|
||||
defaultValue: 'http://192.168.110.43:1100/',
|
||||
defaultValue: 'https://jvapi.haiyihy.com/',
|
||||
); // 默认连线上环境,本地调试可通过 --dart-define=API_HOST 覆盖
|
||||
|
||||
@override
|
||||
|
||||
@ -28,19 +28,44 @@ SlideTransition kOpenRoomTransitionBuilder( BuildContext context,
|
||||
}
|
||||
|
||||
/// fluro的路由跳转工具类
|
||||
class SCNavigatorUtils {
|
||||
static bool inChatPage = false;
|
||||
static bool inLoginPage = false;
|
||||
//不需要页面返回值的跳转
|
||||
static Future push(BuildContext context, String path,
|
||||
{bool replace = false,
|
||||
bool clearStack = false,
|
||||
TransitionType? transition,
|
||||
class SCNavigatorUtils {
|
||||
static bool inChatPage = false;
|
||||
static bool inLoginPage = false;
|
||||
|
||||
/// 登录态失效时,多个入口可能同时尝试跳登录页。
|
||||
/// 统一在这里做一次幂等保护,避免堆叠多个登录页。
|
||||
static Future<void> pushLoginIfNeeded(
|
||||
BuildContext context, {
|
||||
bool replace = false,
|
||||
bool clearStack = false,
|
||||
TransitionType? transition,
|
||||
Duration? transitionDuration,
|
||||
RouteTransitionsBuilder? transitionBuilder,
|
||||
}) async {
|
||||
if (inLoginPage) {
|
||||
return;
|
||||
}
|
||||
await push(
|
||||
context,
|
||||
LoginRouter.login,
|
||||
replace: replace,
|
||||
clearStack: clearStack,
|
||||
transition: transition,
|
||||
transitionDuration: transitionDuration,
|
||||
transitionBuilder: transitionBuilder,
|
||||
);
|
||||
}
|
||||
|
||||
//不需要页面返回值的跳转
|
||||
static Future push(BuildContext context, String path,
|
||||
{bool replace = false,
|
||||
bool clearStack = false,
|
||||
TransitionType? transition,
|
||||
Duration? transitionDuration,
|
||||
RouteTransitionsBuilder? transitionBuilder}) async {
|
||||
FocusScope.of(context).unfocus();
|
||||
inLoginPage = path.startsWith("${LoginRouter.login}");
|
||||
inChatPage = path.startsWith("${SCChatRouter.chat}");
|
||||
inLoginPage = path.startsWith(LoginRouter.login);
|
||||
inChatPage = path.startsWith(SCChatRouter.chat);
|
||||
final result = await SCLkApplication.router.navigateTo(context, path,
|
||||
replace: replace,
|
||||
clearStack: clearStack,
|
||||
@ -76,7 +101,7 @@ class SCNavigatorUtils {
|
||||
TransitionType? transition}) {
|
||||
FocusScope.of(context).unfocus();
|
||||
inLoginPage = path == LoginRouter.login;
|
||||
inChatPage = path.startsWith("${SCChatRouter.chat}");
|
||||
inChatPage = path.startsWith(SCChatRouter.chat);
|
||||
SCLkApplication.router
|
||||
.navigateTo(context, path,
|
||||
replace: replace,
|
||||
@ -107,10 +132,10 @@ class SCNavigatorUtils {
|
||||
return;
|
||||
}
|
||||
function(result);
|
||||
}).catchError((error) {
|
||||
print('$error');
|
||||
});
|
||||
}
|
||||
}).catchError((error) {
|
||||
debugPrint('$error');
|
||||
});
|
||||
}
|
||||
|
||||
/// 直接返回
|
||||
static void goBack(BuildContext context) {
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import 'dart:ui' as ui;
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
@ -19,24 +18,23 @@ import '../../../shared/data_sources/sources/repositories/sc_room_repository_imp
|
||||
import '../../../ui_kit/components/sc_compontent.dart';
|
||||
import '../../../ui_kit/components/sc_debounce_widget.dart';
|
||||
import '../../../ui_kit/components/sc_tts.dart';
|
||||
import '../../../ui_kit/components/dialog/dialog_base.dart';
|
||||
import '../../../ui_kit/components/text/sc_text.dart';
|
||||
import '../../../ui_kit/widgets/id/sc_special_id_badge.dart';
|
||||
import '../../../main.dart';
|
||||
import '../../index/main_route.dart';
|
||||
import '../../../ui_kit/components/dialog/dialog_base.dart';
|
||||
import '../../../ui_kit/components/text/sc_text.dart';
|
||||
import '../../../ui_kit/widgets/id/sc_special_id_badge.dart';
|
||||
import '../../index/main_route.dart';
|
||||
|
||||
///房间详情
|
||||
class RoomDetailPage extends StatefulWidget {
|
||||
///是否是房主
|
||||
final bool isHomeowner;
|
||||
|
||||
const RoomDetailPage(this.isHomeowner, {super.key});
|
||||
|
||||
@override
|
||||
_RoomDetailPageState createState() => _RoomDetailPageState();
|
||||
const RoomDetailPage(this.isHomeowner, {super.key});
|
||||
|
||||
@override
|
||||
State<RoomDetailPage> createState() => _RoomDetailPageState();
|
||||
}
|
||||
|
||||
class _RoomDetailPageState extends State<RoomDetailPage> {
|
||||
class _RoomDetailPageState extends State<RoomDetailPage> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@ -49,8 +47,8 @@ class _RoomDetailPageState extends State<RoomDetailPage> {
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SafeArea(
|
||||
child: Consumer<RtcProvider>(
|
||||
builder: (context, ref, child) {
|
||||
@ -62,9 +60,9 @@ class _RoomDetailPageState extends State<RoomDetailPage> {
|
||||
child: BackdropFilter(
|
||||
filter: ui.ImageFilter.blur(sigmaX: 15, sigmaY: 15),
|
||||
child: Container(
|
||||
height: widget.isHomeowner ? 300.w : 400.w,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xff09372E).withOpacity(0.5),
|
||||
height: widget.isHomeowner ? 300.w : 400.w,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xff09372E).withValues(alpha: 0.5),
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(12.w),
|
||||
topRight: Radius.circular(12.w),
|
||||
@ -473,47 +471,24 @@ class _RoomDetailPageState extends State<RoomDetailPage> {
|
||||
? Row(
|
||||
children: [
|
||||
SizedBox(width: 15.w),
|
||||
Expanded(
|
||||
child: SCDebounceWidget(
|
||||
child: Container(
|
||||
height: 45.w,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(
|
||||
10.w,
|
||||
),
|
||||
color: SocialChatTheme.primaryLight,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(width: 20.w),
|
||||
text(
|
||||
SCAppLocalizations.of(
|
||||
context,
|
||||
)!.roomMember,
|
||||
textColor: Colors.white,
|
||||
fontSize: 14.sp,
|
||||
),
|
||||
Spacer(),
|
||||
Icon(
|
||||
Icons
|
||||
.keyboard_arrow_right_sharp,
|
||||
color: Colors.white,
|
||||
size: 20.w,
|
||||
),
|
||||
SizedBox(width: 15.w),
|
||||
],
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
showBottomInBottomDialog(
|
||||
Expanded(
|
||||
child: SCDebounceWidget(
|
||||
child: _buildHomeownerActionButton(
|
||||
context,
|
||||
SCAppLocalizations.of(
|
||||
context,
|
||||
)!.roomMember,
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
showBottomInBottomDialog(
|
||||
context,
|
||||
RoomMemberPage(
|
||||
roomId:
|
||||
Provider.of<RtcProvider>(
|
||||
context!,
|
||||
listen: false,
|
||||
)
|
||||
roomId:
|
||||
Provider.of<RtcProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
)
|
||||
.currenRoom
|
||||
?.roomProfile
|
||||
?.roomProfile
|
||||
@ -526,40 +501,17 @@ class _RoomDetailPageState extends State<RoomDetailPage> {
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10.w),
|
||||
Expanded(
|
||||
child: SCDebounceWidget(
|
||||
child: Container(
|
||||
height: 45.w,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(
|
||||
10.w,
|
||||
),
|
||||
color: SocialChatTheme.primaryLight,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(width: 20.w),
|
||||
text(
|
||||
SCAppLocalizations.of(
|
||||
context,
|
||||
)!.roomEdit,
|
||||
textColor: Colors.white,
|
||||
fontSize: 14.sp,
|
||||
),
|
||||
Spacer(),
|
||||
Icon(
|
||||
Icons
|
||||
.keyboard_arrow_right_sharp,
|
||||
color: Colors.white,
|
||||
size: 20.w,
|
||||
),
|
||||
SizedBox(width: 15.w),
|
||||
],
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
VoiceRoomRoute.openRoomEdit(
|
||||
context,
|
||||
Expanded(
|
||||
child: SCDebounceWidget(
|
||||
child: _buildHomeownerActionButton(
|
||||
context,
|
||||
SCAppLocalizations.of(
|
||||
context,
|
||||
)!.roomEdit,
|
||||
),
|
||||
onTap: () {
|
||||
VoiceRoomRoute.openRoomEdit(
|
||||
context,
|
||||
needRestCurrentRoomInfo: false,
|
||||
);
|
||||
},
|
||||
@ -637,14 +589,18 @@ class _RoomDetailPageState extends State<RoomDetailPage> {
|
||||
: SCAppLocalizations.of(
|
||||
context,
|
||||
)!.leaveRoomIdentityTips,
|
||||
btnText:
|
||||
SCAppLocalizations.of(
|
||||
context,
|
||||
)!.confirm,
|
||||
onEnsure: () {
|
||||
SCChatRoomRepository()
|
||||
.changeRoomRole(
|
||||
ref
|
||||
btnText:
|
||||
SCAppLocalizations.of(
|
||||
context,
|
||||
)!.confirm,
|
||||
onEnsure: () {
|
||||
final successMessage =
|
||||
SCAppLocalizations.of(
|
||||
context,
|
||||
)!.operationSuccessful;
|
||||
SCChatRoomRepository()
|
||||
.changeRoomRole(
|
||||
ref
|
||||
.currenRoom
|
||||
?.roomProfile
|
||||
?.roomProfile
|
||||
@ -682,18 +638,14 @@ class _RoomDetailPageState extends State<RoomDetailPage> {
|
||||
.MEMBER
|
||||
.name,
|
||||
),
|
||||
);
|
||||
setState(() {});
|
||||
SCTts.show(
|
||||
SCAppLocalizations.of(
|
||||
navigatorKey
|
||||
.currentState!
|
||||
.context,
|
||||
)!.operationSuccessful,
|
||||
);
|
||||
});
|
||||
},
|
||||
);
|
||||
);
|
||||
setState(() {});
|
||||
SCTts.show(
|
||||
successMessage,
|
||||
);
|
||||
});
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
@ -930,7 +882,36 @@ class _RoomDetailPageState extends State<RoomDetailPage> {
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildHomeownerActionButton(BuildContext context, String label) {
|
||||
return Container(
|
||||
height: 45.w,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10.w),
|
||||
color: SocialChatTheme.primaryLight,
|
||||
),
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: text(
|
||||
label,
|
||||
textColor: Colors.white,
|
||||
fontSize: 14.sp,
|
||||
maxLines: 1,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8.w),
|
||||
Icon(
|
||||
Icons.keyboard_arrow_right_sharp,
|
||||
color: Colors.white,
|
||||
size: 20.w,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,7 +10,6 @@ import 'package:yumi/shared/data_sources/sources/local/user_manager.dart';
|
||||
import 'package:yumi/app/routes/sc_routes.dart';
|
||||
import 'package:yumi/app/routes/sc_fluro_navigator.dart';
|
||||
import 'package:yumi/shared/data_sources/sources/local/file_cache_manager.dart';
|
||||
import 'package:yumi/modules/auth/login_route.dart';
|
||||
import 'package:yumi/ui_kit/components/sc_compontent.dart';
|
||||
|
||||
import 'last_weekly_cp_splash_cache.dart';
|
||||
@ -450,13 +449,13 @@ class _SplashPageState extends State<SplashPage> {
|
||||
if (user != null && token.isNotEmpty) {
|
||||
SCNavigatorUtils.push(context, SCRoutes.home, replace: true);
|
||||
} else {
|
||||
SCNavigatorUtils.push(context, LoginRouter.login, replace: true);
|
||||
SCNavigatorUtils.pushLoginIfNeeded(context, replace: true);
|
||||
}
|
||||
} catch (e) {
|
||||
if (!mounted) {
|
||||
return;
|
||||
}
|
||||
SCNavigatorUtils.push(context, LoginRouter.login, replace: true);
|
||||
SCNavigatorUtils.pushLoginIfNeeded(context, replace: true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -310,26 +310,26 @@ class _MePage2State extends State<MePage2> {
|
||||
// 1. 主播/代理入口
|
||||
if (hasCurrentUser) {
|
||||
if (isAgent) {
|
||||
items.add(
|
||||
_MenuRowData(
|
||||
title: SCAppLocalizations.of(context)!.agentCenter,
|
||||
assetIcon: 'sc_images/index/at_icon_agent_center.png',
|
||||
onTap: () {
|
||||
SCNavigatorUtils.push(
|
||||
context,
|
||||
items.add(
|
||||
_MenuRowData(
|
||||
title: SCAppLocalizations.of(context)!.agentCenter,
|
||||
assetIcon: 'sc_images/index/sc_icon_agent_center.png',
|
||||
onTap: () {
|
||||
SCNavigatorUtils.push(
|
||||
context,
|
||||
"${SCMainRoute.webViewPage}?url=${Uri.encodeComponent(SCGlobalConfig.agencyCenterUrl)}&showTitle=false",
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
} else {
|
||||
items.add(
|
||||
_MenuRowData(
|
||||
title: SCAppLocalizations.of(context)!.hostCenter,
|
||||
assetIcon: 'sc_images/index/at_icon_host_center.png',
|
||||
onTap: () {
|
||||
SCNavigatorUtils.push(
|
||||
context,
|
||||
items.add(
|
||||
_MenuRowData(
|
||||
title: SCAppLocalizations.of(context)!.hostCenter,
|
||||
assetIcon: 'sc_images/index/sc_icon_host_center.png',
|
||||
onTap: () {
|
||||
SCNavigatorUtils.push(
|
||||
context,
|
||||
"${SCMainRoute.webViewPage}?url=${Uri.encodeComponent(SCGlobalConfig.hostCenterUrl)}&showTitle=false",
|
||||
);
|
||||
},
|
||||
@ -341,26 +341,26 @@ class _MePage2State extends State<MePage2> {
|
||||
// 2. BD 相关(非管理员时)
|
||||
if (!(userProfile.userIdentity?.admin ?? false)) {
|
||||
if (userProfile.userIdentity?.bdLeader ?? false) {
|
||||
items.add(
|
||||
_MenuRowData(
|
||||
title: SCAppLocalizations.of(context)!.bdLeader,
|
||||
assetIcon: 'sc_images/index/at_icon_bd_leader.png',
|
||||
onTap: () {
|
||||
SCNavigatorUtils.push(
|
||||
context,
|
||||
items.add(
|
||||
_MenuRowData(
|
||||
title: SCAppLocalizations.of(context)!.bdLeader,
|
||||
assetIcon: 'sc_images/index/sc_icon_bd_leader.png',
|
||||
onTap: () {
|
||||
SCNavigatorUtils.push(
|
||||
context,
|
||||
"${SCMainRoute.webViewPage}?url=${Uri.encodeComponent(SCGlobalConfig.bdLeaderUrl)}&showTitle=false",
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
} else if (userProfile.userIdentity?.bd ?? false) {
|
||||
items.add(
|
||||
_MenuRowData(
|
||||
title: SCAppLocalizations.of(context)!.bdCenter,
|
||||
assetIcon: 'sc_images/index/at_icon_bd_center.png',
|
||||
onTap: () {
|
||||
SCNavigatorUtils.push(
|
||||
context,
|
||||
items.add(
|
||||
_MenuRowData(
|
||||
title: SCAppLocalizations.of(context)!.bdCenter,
|
||||
assetIcon: 'sc_images/index/sc_icon_bd_center.png',
|
||||
onTap: () {
|
||||
SCNavigatorUtils.push(
|
||||
context,
|
||||
"${SCMainRoute.webViewPage}?url=${Uri.encodeComponent(SCGlobalConfig.bdCenterUrl)}&showTitle=false",
|
||||
);
|
||||
},
|
||||
@ -371,13 +371,13 @@ class _MePage2State extends State<MePage2> {
|
||||
|
||||
// 3. 货运代理
|
||||
if (userProfile.userIdentity?.freightAgent ?? false) {
|
||||
items.add(
|
||||
_MenuRowData(
|
||||
title: SCAppLocalizations.of(context)!.rechargeAgency,
|
||||
assetIcon: 'sc_images/index/at_icon_recharge_agency.png',
|
||||
onTap: () {
|
||||
SCNavigatorUtils.push(
|
||||
context,
|
||||
items.add(
|
||||
_MenuRowData(
|
||||
title: SCAppLocalizations.of(context)!.rechargeAgency,
|
||||
assetIcon: 'sc_images/index/sc_icon_recharge_agency.png',
|
||||
onTap: () {
|
||||
SCNavigatorUtils.push(
|
||||
context,
|
||||
"${SCMainRoute.webViewPage}?url=${Uri.encodeComponent(SCGlobalConfig.coinSellerUrl)}&showTitle=false",
|
||||
);
|
||||
},
|
||||
@ -387,13 +387,13 @@ class _MePage2State extends State<MePage2> {
|
||||
|
||||
// 4. 管理员(注意:你的原逻辑中管理员和上面BD逻辑有重叠,这里按原样单独处理)
|
||||
if (userProfile.userIdentity?.admin ?? false) {
|
||||
items.add(
|
||||
_MenuRowData(
|
||||
title: SCAppLocalizations.of(context)!.adminCenter,
|
||||
assetIcon: 'sc_images/index/at_icon_admin_center.png',
|
||||
onTap: () {
|
||||
SCNavigatorUtils.push(
|
||||
context,
|
||||
items.add(
|
||||
_MenuRowData(
|
||||
title: SCAppLocalizations.of(context)!.adminCenter,
|
||||
assetIcon: 'sc_images/index/sc_icon_admin_center.png',
|
||||
onTap: () {
|
||||
SCNavigatorUtils.push(
|
||||
context,
|
||||
"${SCMainRoute.webViewPage}?url=${Uri.encodeComponent(SCGlobalConfig.adminUrl)}&showTitle=false",
|
||||
);
|
||||
},
|
||||
|
||||
@ -8,7 +8,6 @@ import 'package:yumi/shared/data_sources/sources/local/data_persistence.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:yumi/app/routes/sc_fluro_navigator.dart';
|
||||
import 'package:yumi/shared/business_logic/models/res/login_res.dart';
|
||||
import 'package:yumi/modules/auth/login_route.dart';
|
||||
import 'package:yumi/services/audio/rtc_manager.dart';
|
||||
import 'package:yumi/services/audio/rtm_manager.dart';
|
||||
import 'package:yumi/shared/data_sources/sources/local/floating_screen_manager.dart';
|
||||
@ -141,7 +140,7 @@ class AccountStorage {
|
||||
listen: false,
|
||||
).exitCurrentVoiceRoomSession(true);
|
||||
Provider.of<RtmProvider>(context, listen: false).logout();
|
||||
SCNavigatorUtils.push(context, LoginRouter.login, clearStack: true);
|
||||
SCNavigatorUtils.pushLoginIfNeeded(context, clearStack: true);
|
||||
SCRoomUtils.closeAllDialogs();
|
||||
SCMessageUtils.redPacketFutureCache.clear();
|
||||
SCGlobalConfig.resetVisualEffectSwitchesToRecommendedDefaults();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user