修复一些已知bug

This commit is contained in:
roxy 2026-04-23 10:25:24 +08:00
parent 5086cdd97c
commit 20106df6f0
6 changed files with 181 additions and 177 deletions

View File

@ -16,7 +16,7 @@ class SCVariant1Config implements AppConfig {
@override @override
String get apiHost => const String.fromEnvironment( String get apiHost => const String.fromEnvironment(
'API_HOST', 'API_HOST',
defaultValue: 'http://192.168.110.43:1100/', defaultValue: 'https://jvapi.haiyihy.com/',
); // 线 --dart-define=API_HOST ); // 线 --dart-define=API_HOST
@override @override

View File

@ -28,19 +28,44 @@ SlideTransition kOpenRoomTransitionBuilder( BuildContext context,
} }
/// fluro的路由跳转工具类 /// fluro的路由跳转工具类
class SCNavigatorUtils { class SCNavigatorUtils {
static bool inChatPage = false; static bool inChatPage = false;
static bool inLoginPage = false; static bool inLoginPage = false;
//
static Future push(BuildContext context, String path, ///
{bool replace = false, ///
bool clearStack = false, static Future<void> pushLoginIfNeeded(
TransitionType? transition, 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, Duration? transitionDuration,
RouteTransitionsBuilder? transitionBuilder}) async { RouteTransitionsBuilder? transitionBuilder}) async {
FocusScope.of(context).unfocus(); FocusScope.of(context).unfocus();
inLoginPage = path.startsWith("${LoginRouter.login}"); inLoginPage = path.startsWith(LoginRouter.login);
inChatPage = path.startsWith("${SCChatRouter.chat}"); inChatPage = path.startsWith(SCChatRouter.chat);
final result = await SCLkApplication.router.navigateTo(context, path, final result = await SCLkApplication.router.navigateTo(context, path,
replace: replace, replace: replace,
clearStack: clearStack, clearStack: clearStack,
@ -76,7 +101,7 @@ class SCNavigatorUtils {
TransitionType? transition}) { TransitionType? transition}) {
FocusScope.of(context).unfocus(); FocusScope.of(context).unfocus();
inLoginPage = path == LoginRouter.login; inLoginPage = path == LoginRouter.login;
inChatPage = path.startsWith("${SCChatRouter.chat}"); inChatPage = path.startsWith(SCChatRouter.chat);
SCLkApplication.router SCLkApplication.router
.navigateTo(context, path, .navigateTo(context, path,
replace: replace, replace: replace,
@ -107,10 +132,10 @@ class SCNavigatorUtils {
return; return;
} }
function(result); function(result);
}).catchError((error) { }).catchError((error) {
print('$error'); debugPrint('$error');
}); });
} }
/// ///
static void goBack(BuildContext context) { static void goBack(BuildContext context) {

View File

@ -1,7 +1,6 @@
import 'dart:ui' as ui; 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/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.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_compontent.dart';
import '../../../ui_kit/components/sc_debounce_widget.dart'; import '../../../ui_kit/components/sc_debounce_widget.dart';
import '../../../ui_kit/components/sc_tts.dart'; import '../../../ui_kit/components/sc_tts.dart';
import '../../../ui_kit/components/dialog/dialog_base.dart'; import '../../../ui_kit/components/dialog/dialog_base.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 '../../../main.dart'; import '../../index/main_route.dart';
import '../../index/main_route.dart';
/// ///
class RoomDetailPage extends StatefulWidget { class RoomDetailPage extends StatefulWidget {
/// ///
final bool isHomeowner; final bool isHomeowner;
const RoomDetailPage(this.isHomeowner, {super.key}); const RoomDetailPage(this.isHomeowner, {super.key});
@override @override
_RoomDetailPageState createState() => _RoomDetailPageState(); State<RoomDetailPage> createState() => _RoomDetailPageState();
} }
class _RoomDetailPageState extends State<RoomDetailPage> { class _RoomDetailPageState extends State<RoomDetailPage> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -49,8 +47,8 @@ class _RoomDetailPageState extends State<RoomDetailPage> {
); );
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SafeArea( return SafeArea(
child: Consumer<RtcProvider>( child: Consumer<RtcProvider>(
builder: (context, ref, child) { builder: (context, ref, child) {
@ -62,9 +60,9 @@ class _RoomDetailPageState extends State<RoomDetailPage> {
child: BackdropFilter( child: BackdropFilter(
filter: ui.ImageFilter.blur(sigmaX: 15, sigmaY: 15), filter: ui.ImageFilter.blur(sigmaX: 15, sigmaY: 15),
child: Container( child: Container(
height: widget.isHomeowner ? 300.w : 400.w, height: widget.isHomeowner ? 300.w : 400.w,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xff09372E).withOpacity(0.5), color: const Color(0xff09372E).withValues(alpha: 0.5),
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: Radius.circular(12.w), topLeft: Radius.circular(12.w),
topRight: Radius.circular(12.w), topRight: Radius.circular(12.w),
@ -473,47 +471,24 @@ class _RoomDetailPageState extends State<RoomDetailPage> {
? Row( ? Row(
children: [ children: [
SizedBox(width: 15.w), SizedBox(width: 15.w),
Expanded( Expanded(
child: SCDebounceWidget( child: SCDebounceWidget(
child: Container( child: _buildHomeownerActionButton(
height: 45.w, context,
decoration: BoxDecoration( SCAppLocalizations.of(
borderRadius: BorderRadius.circular( context,
10.w, )!.roomMember,
), ),
color: SocialChatTheme.primaryLight, onTap: () {
), Navigator.of(context).pop();
child: Row( showBottomInBottomDialog(
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(
context, context,
RoomMemberPage( RoomMemberPage(
roomId: roomId:
Provider.of<RtcProvider>( Provider.of<RtcProvider>(
context!, context,
listen: false, listen: false,
) )
.currenRoom .currenRoom
?.roomProfile ?.roomProfile
?.roomProfile ?.roomProfile
@ -526,40 +501,17 @@ class _RoomDetailPageState extends State<RoomDetailPage> {
), ),
), ),
SizedBox(width: 10.w), SizedBox(width: 10.w),
Expanded( Expanded(
child: SCDebounceWidget( child: SCDebounceWidget(
child: Container( child: _buildHomeownerActionButton(
height: 45.w, context,
decoration: BoxDecoration( SCAppLocalizations.of(
borderRadius: BorderRadius.circular( context,
10.w, )!.roomEdit,
), ),
color: SocialChatTheme.primaryLight, onTap: () {
), VoiceRoomRoute.openRoomEdit(
child: Row( context,
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,
needRestCurrentRoomInfo: false, needRestCurrentRoomInfo: false,
); );
}, },
@ -637,14 +589,18 @@ class _RoomDetailPageState extends State<RoomDetailPage> {
: SCAppLocalizations.of( : SCAppLocalizations.of(
context, context,
)!.leaveRoomIdentityTips, )!.leaveRoomIdentityTips,
btnText: btnText:
SCAppLocalizations.of( SCAppLocalizations.of(
context, context,
)!.confirm, )!.confirm,
onEnsure: () { onEnsure: () {
SCChatRoomRepository() final successMessage =
.changeRoomRole( SCAppLocalizations.of(
ref context,
)!.operationSuccessful;
SCChatRoomRepository()
.changeRoomRole(
ref
.currenRoom .currenRoom
?.roomProfile ?.roomProfile
?.roomProfile ?.roomProfile
@ -682,18 +638,14 @@ class _RoomDetailPageState extends State<RoomDetailPage> {
.MEMBER .MEMBER
.name, .name,
), ),
); );
setState(() {}); setState(() {});
SCTts.show( SCTts.show(
SCAppLocalizations.of( successMessage,
navigatorKey );
.currentState! });
.context, },
)!.operationSuccessful, );
);
});
},
);
}, },
); );
}, },
@ -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,
),
],
),
);
}
}

View File

@ -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_routes.dart';
import 'package:yumi/app/routes/sc_fluro_navigator.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/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 'package:yumi/ui_kit/components/sc_compontent.dart';
import 'last_weekly_cp_splash_cache.dart'; import 'last_weekly_cp_splash_cache.dart';
@ -450,13 +449,13 @@ class _SplashPageState extends State<SplashPage> {
if (user != null && token.isNotEmpty) { if (user != null && token.isNotEmpty) {
SCNavigatorUtils.push(context, SCRoutes.home, replace: true); SCNavigatorUtils.push(context, SCRoutes.home, replace: true);
} else { } else {
SCNavigatorUtils.push(context, LoginRouter.login, replace: true); SCNavigatorUtils.pushLoginIfNeeded(context, replace: true);
} }
} catch (e) { } catch (e) {
if (!mounted) { if (!mounted) {
return; return;
} }
SCNavigatorUtils.push(context, LoginRouter.login, replace: true); SCNavigatorUtils.pushLoginIfNeeded(context, replace: true);
} }
} }

View File

@ -310,26 +310,26 @@ class _MePage2State extends State<MePage2> {
// 1. / // 1. /
if (hasCurrentUser) { if (hasCurrentUser) {
if (isAgent) { if (isAgent) {
items.add( items.add(
_MenuRowData( _MenuRowData(
title: SCAppLocalizations.of(context)!.agentCenter, title: SCAppLocalizations.of(context)!.agentCenter,
assetIcon: 'sc_images/index/at_icon_agent_center.png', assetIcon: 'sc_images/index/sc_icon_agent_center.png',
onTap: () { onTap: () {
SCNavigatorUtils.push( SCNavigatorUtils.push(
context, context,
"${SCMainRoute.webViewPage}?url=${Uri.encodeComponent(SCGlobalConfig.agencyCenterUrl)}&showTitle=false", "${SCMainRoute.webViewPage}?url=${Uri.encodeComponent(SCGlobalConfig.agencyCenterUrl)}&showTitle=false",
); );
}, },
), ),
); );
} else { } else {
items.add( items.add(
_MenuRowData( _MenuRowData(
title: SCAppLocalizations.of(context)!.hostCenter, title: SCAppLocalizations.of(context)!.hostCenter,
assetIcon: 'sc_images/index/at_icon_host_center.png', assetIcon: 'sc_images/index/sc_icon_host_center.png',
onTap: () { onTap: () {
SCNavigatorUtils.push( SCNavigatorUtils.push(
context, context,
"${SCMainRoute.webViewPage}?url=${Uri.encodeComponent(SCGlobalConfig.hostCenterUrl)}&showTitle=false", "${SCMainRoute.webViewPage}?url=${Uri.encodeComponent(SCGlobalConfig.hostCenterUrl)}&showTitle=false",
); );
}, },
@ -341,26 +341,26 @@ class _MePage2State extends State<MePage2> {
// 2. BD // 2. BD
if (!(userProfile.userIdentity?.admin ?? false)) { if (!(userProfile.userIdentity?.admin ?? false)) {
if (userProfile.userIdentity?.bdLeader ?? false) { if (userProfile.userIdentity?.bdLeader ?? false) {
items.add( items.add(
_MenuRowData( _MenuRowData(
title: SCAppLocalizations.of(context)!.bdLeader, title: SCAppLocalizations.of(context)!.bdLeader,
assetIcon: 'sc_images/index/at_icon_bd_leader.png', assetIcon: 'sc_images/index/sc_icon_bd_leader.png',
onTap: () { onTap: () {
SCNavigatorUtils.push( SCNavigatorUtils.push(
context, context,
"${SCMainRoute.webViewPage}?url=${Uri.encodeComponent(SCGlobalConfig.bdLeaderUrl)}&showTitle=false", "${SCMainRoute.webViewPage}?url=${Uri.encodeComponent(SCGlobalConfig.bdLeaderUrl)}&showTitle=false",
); );
}, },
), ),
); );
} else if (userProfile.userIdentity?.bd ?? false) { } else if (userProfile.userIdentity?.bd ?? false) {
items.add( items.add(
_MenuRowData( _MenuRowData(
title: SCAppLocalizations.of(context)!.bdCenter, title: SCAppLocalizations.of(context)!.bdCenter,
assetIcon: 'sc_images/index/at_icon_bd_center.png', assetIcon: 'sc_images/index/sc_icon_bd_center.png',
onTap: () { onTap: () {
SCNavigatorUtils.push( SCNavigatorUtils.push(
context, context,
"${SCMainRoute.webViewPage}?url=${Uri.encodeComponent(SCGlobalConfig.bdCenterUrl)}&showTitle=false", "${SCMainRoute.webViewPage}?url=${Uri.encodeComponent(SCGlobalConfig.bdCenterUrl)}&showTitle=false",
); );
}, },
@ -371,13 +371,13 @@ class _MePage2State extends State<MePage2> {
// 3. // 3.
if (userProfile.userIdentity?.freightAgent ?? false) { if (userProfile.userIdentity?.freightAgent ?? false) {
items.add( items.add(
_MenuRowData( _MenuRowData(
title: SCAppLocalizations.of(context)!.rechargeAgency, title: SCAppLocalizations.of(context)!.rechargeAgency,
assetIcon: 'sc_images/index/at_icon_recharge_agency.png', assetIcon: 'sc_images/index/sc_icon_recharge_agency.png',
onTap: () { onTap: () {
SCNavigatorUtils.push( SCNavigatorUtils.push(
context, context,
"${SCMainRoute.webViewPage}?url=${Uri.encodeComponent(SCGlobalConfig.coinSellerUrl)}&showTitle=false", "${SCMainRoute.webViewPage}?url=${Uri.encodeComponent(SCGlobalConfig.coinSellerUrl)}&showTitle=false",
); );
}, },
@ -387,13 +387,13 @@ class _MePage2State extends State<MePage2> {
// 4. BD逻辑有重叠 // 4. BD逻辑有重叠
if (userProfile.userIdentity?.admin ?? false) { if (userProfile.userIdentity?.admin ?? false) {
items.add( items.add(
_MenuRowData( _MenuRowData(
title: SCAppLocalizations.of(context)!.adminCenter, title: SCAppLocalizations.of(context)!.adminCenter,
assetIcon: 'sc_images/index/at_icon_admin_center.png', assetIcon: 'sc_images/index/sc_icon_admin_center.png',
onTap: () { onTap: () {
SCNavigatorUtils.push( SCNavigatorUtils.push(
context, context,
"${SCMainRoute.webViewPage}?url=${Uri.encodeComponent(SCGlobalConfig.adminUrl)}&showTitle=false", "${SCMainRoute.webViewPage}?url=${Uri.encodeComponent(SCGlobalConfig.adminUrl)}&showTitle=false",
); );
}, },

View File

@ -8,7 +8,6 @@ import 'package:yumi/shared/data_sources/sources/local/data_persistence.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:yumi/app/routes/sc_fluro_navigator.dart'; import 'package:yumi/app/routes/sc_fluro_navigator.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/modules/auth/login_route.dart';
import 'package:yumi/services/audio/rtc_manager.dart'; import 'package:yumi/services/audio/rtc_manager.dart';
import 'package:yumi/services/audio/rtm_manager.dart'; import 'package:yumi/services/audio/rtm_manager.dart';
import 'package:yumi/shared/data_sources/sources/local/floating_screen_manager.dart'; import 'package:yumi/shared/data_sources/sources/local/floating_screen_manager.dart';
@ -141,7 +140,7 @@ class AccountStorage {
listen: false, listen: false,
).exitCurrentVoiceRoomSession(true); ).exitCurrentVoiceRoomSession(true);
Provider.of<RtmProvider>(context, listen: false).logout(); Provider.of<RtmProvider>(context, listen: false).logout();
SCNavigatorUtils.push(context, LoginRouter.login, clearStack: true); SCNavigatorUtils.pushLoginIfNeeded(context, clearStack: true);
SCRoomUtils.closeAllDialogs(); SCRoomUtils.closeAllDialogs();
SCMessageUtils.redPacketFutureCache.clear(); SCMessageUtils.redPacketFutureCache.clear();
SCGlobalConfig.resetVisualEffectSwitchesToRecommendedDefaults(); SCGlobalConfig.resetVisualEffectSwitchesToRecommendedDefaults();