修复一些已知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
|
||||
|
||||
@ -31,6 +31,31 @@ SlideTransition kOpenRoomTransitionBuilder( BuildContext context,
|
||||
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,
|
||||
@ -39,8 +64,8 @@ class SCNavigatorUtils {
|
||||
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,
|
||||
@ -108,7 +133,7 @@ class SCNavigatorUtils {
|
||||
}
|
||||
function(result);
|
||||
}).catchError((error) {
|
||||
print('$error');
|
||||
debugPrint('$error');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import 'dart:ui' as ui;
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
@ -22,7 +21,6 @@ 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';
|
||||
|
||||
///房间详情
|
||||
@ -33,7 +31,7 @@ class RoomDetailPage extends StatefulWidget {
|
||||
const RoomDetailPage(this.isHomeowner, {super.key});
|
||||
|
||||
@override
|
||||
_RoomDetailPageState createState() => _RoomDetailPageState();
|
||||
State<RoomDetailPage> createState() => _RoomDetailPageState();
|
||||
}
|
||||
|
||||
class _RoomDetailPageState extends State<RoomDetailPage> {
|
||||
@ -64,7 +62,7 @@ class _RoomDetailPageState extends State<RoomDetailPage> {
|
||||
child: Container(
|
||||
height: widget.isHomeowner ? 300.w : 400.w,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xff09372E).withOpacity(0.5),
|
||||
color: const Color(0xff09372E).withValues(alpha: 0.5),
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(12.w),
|
||||
topRight: Radius.circular(12.w),
|
||||
@ -475,34 +473,11 @@ class _RoomDetailPageState extends State<RoomDetailPage> {
|
||||
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),
|
||||
],
|
||||
),
|
||||
child: _buildHomeownerActionButton(
|
||||
context,
|
||||
SCAppLocalizations.of(
|
||||
context,
|
||||
)!.roomMember,
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
@ -511,7 +486,7 @@ class _RoomDetailPageState extends State<RoomDetailPage> {
|
||||
RoomMemberPage(
|
||||
roomId:
|
||||
Provider.of<RtcProvider>(
|
||||
context!,
|
||||
context,
|
||||
listen: false,
|
||||
)
|
||||
.currenRoom
|
||||
@ -528,34 +503,11 @@ 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),
|
||||
],
|
||||
),
|
||||
child: _buildHomeownerActionButton(
|
||||
context,
|
||||
SCAppLocalizations.of(
|
||||
context,
|
||||
)!.roomEdit,
|
||||
),
|
||||
onTap: () {
|
||||
VoiceRoomRoute.openRoomEdit(
|
||||
@ -642,6 +594,10 @@ class _RoomDetailPageState extends State<RoomDetailPage> {
|
||||
context,
|
||||
)!.confirm,
|
||||
onEnsure: () {
|
||||
final successMessage =
|
||||
SCAppLocalizations.of(
|
||||
context,
|
||||
)!.operationSuccessful;
|
||||
SCChatRoomRepository()
|
||||
.changeRoomRole(
|
||||
ref
|
||||
@ -685,11 +641,7 @@ class _RoomDetailPageState extends State<RoomDetailPage> {
|
||||
);
|
||||
setState(() {});
|
||||
SCTts.show(
|
||||
SCAppLocalizations.of(
|
||||
navigatorKey
|
||||
.currentState!
|
||||
.context,
|
||||
)!.operationSuccessful,
|
||||
successMessage,
|
||||
);
|
||||
});
|
||||
},
|
||||
@ -933,4 +885,33 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -313,7 +313,7 @@ class _MePage2State extends State<MePage2> {
|
||||
items.add(
|
||||
_MenuRowData(
|
||||
title: SCAppLocalizations.of(context)!.agentCenter,
|
||||
assetIcon: 'sc_images/index/at_icon_agent_center.png',
|
||||
assetIcon: 'sc_images/index/sc_icon_agent_center.png',
|
||||
onTap: () {
|
||||
SCNavigatorUtils.push(
|
||||
context,
|
||||
@ -326,7 +326,7 @@ class _MePage2State extends State<MePage2> {
|
||||
items.add(
|
||||
_MenuRowData(
|
||||
title: SCAppLocalizations.of(context)!.hostCenter,
|
||||
assetIcon: 'sc_images/index/at_icon_host_center.png',
|
||||
assetIcon: 'sc_images/index/sc_icon_host_center.png',
|
||||
onTap: () {
|
||||
SCNavigatorUtils.push(
|
||||
context,
|
||||
@ -344,7 +344,7 @@ class _MePage2State extends State<MePage2> {
|
||||
items.add(
|
||||
_MenuRowData(
|
||||
title: SCAppLocalizations.of(context)!.bdLeader,
|
||||
assetIcon: 'sc_images/index/at_icon_bd_leader.png',
|
||||
assetIcon: 'sc_images/index/sc_icon_bd_leader.png',
|
||||
onTap: () {
|
||||
SCNavigatorUtils.push(
|
||||
context,
|
||||
@ -357,7 +357,7 @@ class _MePage2State extends State<MePage2> {
|
||||
items.add(
|
||||
_MenuRowData(
|
||||
title: SCAppLocalizations.of(context)!.bdCenter,
|
||||
assetIcon: 'sc_images/index/at_icon_bd_center.png',
|
||||
assetIcon: 'sc_images/index/sc_icon_bd_center.png',
|
||||
onTap: () {
|
||||
SCNavigatorUtils.push(
|
||||
context,
|
||||
@ -374,7 +374,7 @@ class _MePage2State extends State<MePage2> {
|
||||
items.add(
|
||||
_MenuRowData(
|
||||
title: SCAppLocalizations.of(context)!.rechargeAgency,
|
||||
assetIcon: 'sc_images/index/at_icon_recharge_agency.png',
|
||||
assetIcon: 'sc_images/index/sc_icon_recharge_agency.png',
|
||||
onTap: () {
|
||||
SCNavigatorUtils.push(
|
||||
context,
|
||||
@ -390,7 +390,7 @@ class _MePage2State extends State<MePage2> {
|
||||
items.add(
|
||||
_MenuRowData(
|
||||
title: SCAppLocalizations.of(context)!.adminCenter,
|
||||
assetIcon: 'sc_images/index/at_icon_admin_center.png',
|
||||
assetIcon: 'sc_images/index/sc_icon_admin_center.png',
|
||||
onTap: () {
|
||||
SCNavigatorUtils.push(
|
||||
context,
|
||||
|
||||
@ -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