diff --git a/lib/controller/discover/room_controller.dart b/lib/controller/discover/room_controller.dart index 86ea517..4fbc6ea 100644 --- a/lib/controller/discover/room_controller.dart +++ b/lib/controller/discover/room_controller.dart @@ -103,6 +103,7 @@ class RoomController extends GetxController with WidgetsBindingObserver { if (value?.femaleInfo != null) { print("获取数据"); getUserData(value?.femaleInfo?.miId ?? "", 1); + } else { print("清除数据"); femaleData.value = null; @@ -130,6 +131,7 @@ class RoomController extends GetxController with WidgetsBindingObserver { } else { maleData.value = response.data.data!; } + update(); } else { // 响应失败,设置错误信息 final errorMsg = response.data.message ?? '获取数据失败'; diff --git a/lib/controller/mine/deactivate_controller.dart b/lib/controller/mine/deactivate_controller.dart index 6dc6361..0fcb02d 100644 --- a/lib/controller/mine/deactivate_controller.dart +++ b/lib/controller/mine/deactivate_controller.dart @@ -45,7 +45,9 @@ class DeactivateController extends GetxController { conversationController.clearConversations(); } // 清除本地存储 - storage.erase(); + // storage.erase(); + storage.remove('userId'); + storage.remove('token'); // 清除全局数据 GlobalData().logout(); } diff --git a/lib/main.dart b/lib/main.dart index bb55b90..644bfa0 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -25,195 +25,136 @@ import 'package:get_storage/get_storage.dart'; import 'extension/my_cupertino_localizations.dart'; void main() async { - // 设置全局错误处理 - FlutterError.onError = (FlutterErrorDetails details) { - FlutterError.presentError(details); - if (kReleaseMode) { - // 在生产环境中,可以将错误发送到错误收集服务 - print('Flutter Error: ${details.exception}'); - } - }; - - // 处理异步错误 - PlatformDispatcher.instance.onError = (error, stack) { - print('Platform Error: $error'); - print('Stack: $stack'); - return true; - }; - - try { - WidgetsFlutterBinding.ensureInitialized(); - // 初始化GetStorage - await GetStorage.init(); - - // 设置环境配置 - 根据是否为release模式 - EnvConfig.setEnvironment(Environment.dev); - - // 初始化RTC,如果失败也不阻止应用启动 - try { - await RTCManager.instance.initialize(appId: '4c2ea9dcb4c5440593a418df0fdd512d'); - } catch (e) { - print('RTC初始化失败: $e'); - } - - - // 注意:IM初始化改为异步,在应用启动后执行,避免阻塞应用启动 - // IM初始化将在 MyApp 的 initState 中异步执行 - - // 初始化全局依赖 - final networkService = NetworkService(); - Get.put(networkService); - Get.put(networkService.userApi); - Get.put(networkService.homeApi); - // 初始化全局 Overlay 控制器 - Get.put(OverlayController()); - - SystemChrome.setSystemUIOverlayStyle( - const SystemUiOverlayStyle( - statusBarColor: Colors.transparent, - statusBarIconBrightness: Brightness.dark, - statusBarBrightness: Brightness.light, - systemNavigationBarColor: Colors.white, - systemNavigationBarIconBrightness: Brightness.dark, - ), - ); - SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); - if (Platform.isIOS) { - SystemChrome.setEnabledSystemUIMode( - SystemUiMode.manual, - overlays: [SystemUiOverlay.top], - ); - } - } catch (e, stackTrace) { - print('应用初始化失败: $e'); - print('堆栈跟踪: $stackTrace'); - // 即使初始化失败,也尝试启动应用 - } - + // 初始化全局 Overlay 控制器 + Get.put(OverlayController()); + // 初始化GetStorage + await GetStorage.init(); + runApp( - GetMaterialApp( - locale: Locale('zh', 'CN'), // 使用GetX的locale - supportedLocales: const [Locale('zh', 'CN')], - - /// 国际化配置 代理 - localizationsDelegates: const [ - ChineseArabicMonthDelegate(), - GlobalMaterialLocalizations.delegate, - GlobalWidgetsLocalizations.delegate, - GlobalCupertinoLocalizations.delegate, // iOS - ], - theme: ThemeData( - scaffoldBackgroundColor: Colors.white, - // 设置导航栏样式 - appBarTheme: AppBarTheme( - systemOverlayStyle: SystemUiOverlayStyle( - systemNavigationBarColor: Colors.white, - systemNavigationBarIconBrightness: Brightness.light, + ScreenUtilInit( + designSize: const Size(375, 812), + minTextAdapt: true, + builder: (_, child) { + return GetMaterialApp( + locale: Locale('zh', 'CN'), // 使用GetX的locale + supportedLocales: const [Locale('zh', 'CN')], + + /// 国际化配置 代理 + localizationsDelegates: const [ + ChineseArabicMonthDelegate(), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, // iOS + ], + theme: ThemeData( + scaffoldBackgroundColor: Colors.white, + // 设置导航栏样式 + appBarTheme: AppBarTheme( + systemOverlayStyle: SystemUiOverlayStyle( + systemNavigationBarColor: Colors.white, + systemNavigationBarIconBrightness: Brightness.light, + ), + ), ), - ), - ), - builder: (context, child) { - final smartDialogBuilder = FlutterSmartDialog.init(); - return smartDialogBuilder( - context, - Stack( - children: [ - child ?? const SizedBox(), - // 全局 overlay 组件 - Obx(() { - try { - if (Get.isRegistered()) { - final overlayController = Get.find(); - // 视频通话小窗 - if (overlayController.showVideoCallOverlay.value) { - return VideoCallOverlayWidget( - targetUserId: overlayController.videoCallTargetUserId ?? '', - targetUserName: overlayController.videoCallTargetUserName, - targetAvatarUrl: overlayController.videoCallTargetAvatarUrl, - message: overlayController.videoCallTargetMessage, - onClose: () { - overlayController.hideVideoCall(); - }, - ); - } - // 直播房间小窗 - if (overlayController.showOverlay.value) { - return DraggableOverlayWidget( - size: 60, - backgroundColor: const Color.fromRGBO(0, 0, 0, 0.6), - onClose: () { - overlayController.hide(); - }, - ); + builder: (context, child) { + final smartDialogBuilder = FlutterSmartDialog.init(); + return smartDialogBuilder( + context, + Stack( + children: [ + child ?? const SizedBox(), + // 全局 overlay 组件 + Obx(() { + try { + if (Get.isRegistered()) { + final overlayController = Get.find(); + // 视频通话小窗 + if (overlayController.showVideoCallOverlay.value) { + return VideoCallOverlayWidget( + targetUserId: overlayController.videoCallTargetUserId ?? '', + targetUserName: overlayController.videoCallTargetUserName, + targetAvatarUrl: overlayController.videoCallTargetAvatarUrl, + message: overlayController.videoCallTargetMessage, + onClose: () { + overlayController.hideVideoCall(); + }, + ); + } + // 直播房间小窗 + if (overlayController.showOverlay.value) { + return DraggableOverlayWidget( + size: 60, + backgroundColor: const Color.fromRGBO(0, 0, 0, 0.6), + onClose: () { + overlayController.hide(); + }, + ); + } + } + } catch (e) { + Get.log('获取OverlayController失败: $e'); } - } - } catch (e) { - Get.log('获取OverlayController失败: $e'); - } - return const SizedBox.shrink(); - }), - ], - ), + return const SizedBox.shrink(); + }), + ], + ), + ); + }, + home: Agreement(), ); }, - home: MyApp(), - ), + ) ); } -class MyApp extends StatefulWidget { - const MyApp({super.key}); +class Agreement extends StatefulWidget { + const Agreement({super.key}); @override - State createState() => _MyAppState(); + State createState() => _AgreementState(); } -class _MyAppState extends State { - Fluwx fluwx = Fluwx(); - bool _screenUtilInitialized = false; - bool _showAgreementDialog = false; +class _AgreementState extends State { + + bool show = false; + final storage = GetStorage(); @override void initState() { super.initState(); - _initFluwx(); - // 异步初始化IM,避免阻塞应用启动 - _initIMAsync(); // 检查是否已同意协议 _checkAgreement(); } /// 检查是否已同意用户协议(只在第一次安装时显示) - void _checkAgreement() { - final storage = GetStorage(); + void _checkAgreement() async { // 检查是否已经同意过协议,如果已同意则不显示弹框 final hasAgreed = storage.read('hasAgreedUserAgreement') ?? false; + print(hasAgreed); + print("hasAgreed"); if (!hasAgreed) { // 第一次安装,延迟显示弹框,确保UI已初始化 - WidgetsBinding.instance.addPostFrameCallback((_) { - if (mounted) { - setState(() { - _showAgreementDialog = true; - }); - } + show = true; + setState(() { + }); } else { - // 已经同意过协议,不显示弹框 - _showAgreementDialog = false; + await initApp(); + Get.offAll(() => StartPage(), ); } } /// 处理同意协议(保存同意状态,确保下次不再显示) - void _onAgreeAgreement() { - final storage = GetStorage(); + void _onAgreeAgreement() async { // 保存用户已同意协议的状态,确保只在第一次安装时显示 - storage.write('hasAgreedUserAgreement', true); - if (mounted) { - setState(() { - _showAgreementDialog = false; - }); - } + await storage.write('hasAgreedUserAgreement', true); + final hasAgreed = storage.read('hasAgreedUserAgreement') ?? false; + print(hasAgreed); + print("hasAgreed"); + await initApp(); + Get.offAll(() => StartPage(), ); + } /// 处理不同意协议 - 退出应用 @@ -227,6 +168,125 @@ class _MyAppState extends State { } } + initApp() async { + // 设置全局错误处理 + FlutterError.onError = (FlutterErrorDetails details) { + FlutterError.presentError(details); + if (kReleaseMode) { + // 在生产环境中,可以将错误发送到错误收集服务 + print('Flutter Error: ${details.exception}'); + } + }; + + // 处理异步错误 + PlatformDispatcher.instance.onError = (error, stack) { + print('Platform Error: $error'); + print('Stack: $stack'); + return true; + }; + + try { + WidgetsFlutterBinding.ensureInitialized(); + + // 设置环境配置 - 根据是否为release模式 + EnvConfig.setEnvironment(Environment.dev); + + // 初始化RTC,如果失败也不阻止应用启动 + try { + await RTCManager.instance.initialize(appId: '4c2ea9dcb4c5440593a418df0fdd512d'); + } catch (e) { + print('RTC初始化失败: $e'); + } + + + // 注意:IM初始化改为异步,在应用启动后执行,避免阻塞应用启动 + // IM初始化将在 MyApp 的 initState 中异步执行 + + // 初始化全局依赖 + final networkService = NetworkService(); + Get.put(networkService); + Get.put(networkService.userApi); + Get.put(networkService.homeApi); + + SystemChrome.setSystemUIOverlayStyle( + const SystemUiOverlayStyle( + statusBarColor: Colors.transparent, + statusBarIconBrightness: Brightness.dark, + statusBarBrightness: Brightness.light, + systemNavigationBarColor: Colors.white, + systemNavigationBarIconBrightness: Brightness.dark, + ), + ); + SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); + + if (Platform.isIOS) { + SystemChrome.setEnabledSystemUIMode( + SystemUiMode.manual, + overlays: [SystemUiOverlay.top], + ); + } + } catch (e, stackTrace) { + print('应用初始化失败: $e'); + print('堆栈跟踪: $stackTrace'); + // 即使初始化失败,也尝试启动应用 + } + } + + @override + Widget build(BuildContext context) { + return Container( + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.height, + color: Colors.white, + child: show ? UserAgreementDialog( + onAgree: _onAgreeAgreement, + onDisagree: _onDisagreeAgreement, + ) : SizedBox(), + ); + } +} + +class StartPage extends StatefulWidget { + const StartPage({super.key}); + + @override + State createState() => _StartPageState(); +} + +class _StartPageState extends State { + + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + return MyApp(); + } +} + + +class MyApp extends StatefulWidget { + const MyApp({super.key}); + + @override + State createState() => _MyAppState(); +} + +class _MyAppState extends State { + Fluwx fluwx = Fluwx(); + // bool _screenUtilInitialized = false; + bool _showAgreementDialog = false; + + @override + void initState() { + super.initState(); + _initFluwx(); + // 异步初始化IM,避免阻塞应用启动 + _initIMAsync(); + } + /// 异步初始化IM SDK,避免阻塞应用启动 void _initIMAsync() { // 使用 Future.delayed 确保在应用完全启动后再初始化 @@ -278,10 +338,10 @@ class _MyAppState extends State { @override Widget build(BuildContext context) { // ScreenUtil.init 只应该初始化一次,不应该在每次build时调用 - if (!_screenUtilInitialized) { - ScreenUtil.init(context, designSize: const Size(375, 812)); - _screenUtilInitialized = true; - } + // if (!_screenUtilInitialized) { + // ScreenUtil.init(context, designSize: const Size(375, 812)); + // _screenUtilInitialized = true; + // } // 判断token是否为空 final storage = GetStorage(); @@ -305,10 +365,7 @@ class _MyAppState extends State { return Stack( children: [ homeWidget, - UserAgreementDialog( - onAgree: _onAgreeAgreement, - onDisagree: _onDisagreeAgreement, - ), + ], ); } diff --git a/lib/pages/discover/live_room_page.dart b/lib/pages/discover/live_room_page.dart index b14c751..8e41a73 100644 --- a/lib/pages/discover/live_room_page.dart +++ b/lib/pages/discover/live_room_page.dart @@ -241,12 +241,6 @@ class _LiveRoomPageState extends State { final isHost = _roomController.currentRole == CurrentRole.broadcaster; - // 判断是否有嘉宾在连麦 - final hasGuests = - _roomController.rtcChannelDetail.value?.maleInfo != - null || - _roomController.rtcChannelDetail.value?.femaleInfo != - null; // 在 build 方法开始时立即隐藏小窗口(使用 addPostFrameCallback 避免在 build 过程中触发 setState) WidgetsBinding.instance.addPostFrameCallback((_) { @@ -392,257 +386,266 @@ class _LiveRoomPageState extends State { if (isHost) Positioned( right: 15.w, top: 95.w, - child: Column( - children: [ - if (hasGuests) Container( - width: 44.w, - height: 44.w, - margin: EdgeInsets.only(bottom: 5.w), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.w)), - color: const Color.fromRGBO(0, 0, 0, .3) - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Image.asset( - Assets.imagesMicManage, - width: 17.w, - height: 18.w, - ), - Text( - "连麦管理", - style: TextStyle( - fontSize: 9.w, - color: Colors.white + child: Obx((){ + + // 判断是否有嘉宾在连麦 + final hasGuests = + _roomController.rtcChannelDetail.value?.maleInfo != + null || + _roomController.rtcChannelDetail.value?.femaleInfo != + null; + return Column( + children: [ + if (hasGuests) Container( + width: 44.w, + height: 44.w, + margin: EdgeInsets.only(bottom: 5.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6.w)), + color: const Color.fromRGBO(0, 0, 0, .3) + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + Assets.imagesMicManage, + width: 17.w, + height: 18.w, ), - ) - ], - ), - ).onTap(() { - // 关闭设置弹窗 - SmartDialog.dismiss(); - // 弹出解除连麦对话框 - _roomController.setDialogDismiss(true); - SmartDialog.show( - onDismiss: (){ - _roomController.setDialogDismiss(false); - }, - builder: (context) { - return DisconnectMicDialog(); - }, - ); - }), - Container( - width: 44.w, - height: 44.w, - margin: EdgeInsets.only(bottom: 5.w), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.w)), - color: const Color.fromRGBO(0, 0, 0, .3) - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Image.asset( - Assets.imagesKickUser, - width: 19.w, - height: 18.w, - ), - Text( - "踢出房间", - style: TextStyle( - fontSize: 9.w, - color: Colors.white + Text( + "连麦管理", + style: TextStyle( + fontSize: 9.w, + color: Colors.white + ), + ) + ], + ), + ).onTap(() { + // 关闭设置弹窗 + SmartDialog.dismiss(); + // 弹出解除连麦对话框 + _roomController.setDialogDismiss(true); + SmartDialog.show( + onDismiss: (){ + _roomController.setDialogDismiss(false); + }, + builder: (context) { + return DisconnectMicDialog(); + }, + ); + }), + Container( + width: 44.w, + height: 44.w, + margin: EdgeInsets.only(bottom: 5.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6.w)), + color: const Color.fromRGBO(0, 0, 0, .3) + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + Assets.imagesKickUser, + width: 19.w, + height: 18.w, ), - ) - ], - ), - ).onTap(() async { - _roomController.audienceList.clear(); - await _roomController.getAudienceList(null); - // 隐藏键盘 - FocusScope.of(context).unfocus(); - // 隐藏 overlay - SmartDialog.dismiss(); - _roomController.setDialogDismiss(true); - - - SmartDialog.show( - alignment: Alignment.bottomCenter, - maskColor: TDTheme.of(context).fontGyColor2, - onDismiss: (){ - _roomController.setDialogDismiss(false); - }, - - builder: (_) { - return KickList(); - }, - ); - }), - Container( - width: 44.w, - height: 44.w, - margin: EdgeInsets.only(bottom: 5.w), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.w)), - color: const Color.fromRGBO(0, 0, 0, .3) - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Image.asset( - Assets.imagesCloseLive, - width: 15.w, - height: 16.w, - ), - Text( - "结束直播", - style: TextStyle( - fontSize: 9.w, - color: Colors.white + Text( + "踢出房间", + style: TextStyle( + fontSize: 9.w, + color: Colors.white + ), + ) + ], + ), + ).onTap(() async { + _roomController.audienceList.clear(); + await _roomController.getAudienceList(null); + // 隐藏键盘 + FocusScope.of(context).unfocus(); + // 隐藏 overlay + SmartDialog.dismiss(); + _roomController.setDialogDismiss(true); + + + SmartDialog.show( + alignment: Alignment.bottomCenter, + maskColor: TDTheme.of(context).fontGyColor2, + onDismiss: (){ + _roomController.setDialogDismiss(false); + }, + + builder: (_) { + return KickList(); + }, + ); + }), + Container( + width: 44.w, + height: 44.w, + margin: EdgeInsets.only(bottom: 5.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6.w)), + color: const Color.fromRGBO(0, 0, 0, .3) + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + Assets.imagesCloseLive, + width: 15.w, + height: 16.w, ), - ) - ], - ), - ).onTap(() async { - await _roomController.getDurationMins(); - // 隐藏 overlay - SmartDialog.dismiss(); - - SmartDialog.show( - onDismiss: (){ - _roomController.setDialogDismiss(false); - }, - builder: (context) { - return ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(16.w)), - child: Material( - color: Colors.white, - child: Container( - width: 311.w, - height: 189.w, - padding: EdgeInsets.symmetric( - vertical: 20.w, - horizontal: 27.w - ), - child: Column( - children: [ - Text( - "您当前正在视频相亲中\n" - "确定要退出吗?", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 18.w - ), - ), - Container( - margin: EdgeInsets.only(top: 9.w, bottom: 18.w), - height: 23.w, - decoration: BoxDecoration( - gradient: LinearGradient( - begin: Alignment.centerLeft, // 90deg = 从左到右 - end: Alignment.centerRight, - colors: [ - Color.fromRGBO(117, 98, 249, 0), - Color.fromRGBO(117, 98, 249, 0.2), - Color.fromRGBO(117, 98, 249, 0.2), - Color.fromRGBO(117, 98, 249, 0.2), - Color.fromRGBO(117, 98, 249, 0), - ], - stops: [ - 0.0, - 0.2931, - 0.5389, - 0.7708, - 1.0, - ], + Text( + "结束直播", + style: TextStyle( + fontSize: 9.w, + color: Colors.white + ), + ) + ], + ), + ).onTap(() async { + await _roomController.getDurationMins(); + // 隐藏 overlay + SmartDialog.dismiss(); + + SmartDialog.show( + onDismiss: (){ + _roomController.setDialogDismiss(false); + }, + builder: (context) { + return ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(16.w)), + child: Material( + color: Colors.white, + child: Container( + width: 311.w, + height: 189.w, + padding: EdgeInsets.symmetric( + vertical: 20.w, + horizontal: 27.w + ), + child: Column( + children: [ + Text( + "您当前正在视频相亲中\n" + "确定要退出吗?", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 18.w ), ), - child: Center( - child: Text( - "本场有效露脸开播时长${_roomController.durationMins.value}分钟", - style: TextStyle( - fontSize: 12.w, - color: const Color.fromRGBO(117, 98, 249, 1) + Container( + margin: EdgeInsets.only(top: 9.w, bottom: 18.w), + height: 23.w, + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.centerLeft, // 90deg = 从左到右 + end: Alignment.centerRight, + colors: [ + Color.fromRGBO(117, 98, 249, 0), + Color.fromRGBO(117, 98, 249, 0.2), + Color.fromRGBO(117, 98, 249, 0.2), + Color.fromRGBO(117, 98, 249, 0.2), + Color.fromRGBO(117, 98, 249, 0), + ], + stops: [ + 0.0, + 0.2931, + 0.5389, + 0.7708, + 1.0, + ], ), ), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 128.w, - height: 40.w, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(12.w)), - color: const Color.fromRGBO(237, 237, 237, 1) + child: Center( + child: Text( + "本场有效露脸开播时长${_roomController.durationMins.value}分钟", + style: TextStyle( + fontSize: 12.w, + color: const Color.fromRGBO(117, 98, 249, 1) + ), ), - child: Center( - child: Text( - "取消", - style: TextStyle( - fontSize: 15.w, - fontWeight: FontWeight.w400 + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + width: 128.w, + height: 40.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(12.w)), + color: const Color.fromRGBO(237, 237, 237, 1) + ), + child: Center( + child: Text( + "取消", + style: TextStyle( + fontSize: 15.w, + fontWeight: FontWeight.w400 + ), ), ), - ), - ).onTap(() { - - SmartDialog.dismiss(); - }), - Container( - width: 128.w, - height: 40.w, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(12.w)), - color: const Color.fromRGBO(117, 98, 249, 1) - ), - child: Center( - child: Text( - "确认", - style: TextStyle( - color: Colors.white, - fontSize: 15.w, - fontWeight: FontWeight.w400 + ).onTap(() { + + SmartDialog.dismiss(); + }), + Container( + width: 128.w, + height: 40.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(12.w)), + color: const Color.fromRGBO(117, 98, 249, 1) + ), + child: Center( + child: Text( + "确认", + style: TextStyle( + color: Colors.white, + fontSize: 15.w, + fontWeight: FontWeight.w400 + ), ), ), - ), - ).onTap(() async { - // 退出房间时清空RTM消息 - await _roomController.leaveChannel(); - await _roomController.getLiveData(); - await _roomController.getLiveIncome(); - SmartDialog.dismiss(); - if (Get.isRegistered()) { - final roomController = Get.find(); - roomController.chatMessages.clear(); - } - - // 如果还没有执行 pop,手动调用 Get.back() - Get.off(() => SettlementPage()); - // 等待页面关闭后再显示小窗口,确保小窗口能正确显示 - Future.delayed(const Duration(milliseconds: 200), () { - _overlayController.hide(); - }); - - }), - ], - ) - ], + ).onTap(() async { + // 退出房间时清空RTM消息 + await _roomController.leaveChannel(); + await _roomController.getLiveData(); + await _roomController.getLiveIncome(); + SmartDialog.dismiss(); + if (Get.isRegistered()) { + final roomController = Get.find(); + roomController.chatMessages.clear(); + } + + // 如果还没有执行 pop,手动调用 Get.back() + Get.off(() => SettlementPage()); + // 等待页面关闭后再显示小窗口,确保小窗口能正确显示 + Future.delayed(const Duration(milliseconds: 200), () { + _overlayController.hide(); + }); + + }), + ], + ) + ], + ), ), ), - ), - ); - }, - ); - }), - ], - ), + ); + }, + ); + }), + ], + ); + }), ), // SVGA 动画播放组件 const SvgaPlayerWidget(),