From 5a1ffc90e310ce375af8fdd550afc691a51d7cf5 Mon Sep 17 00:00:00 2001 From: YangYuhao Date: Tue, 18 Jul 2023 16:05:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E4=B8=80=E4=BA=9B=E9=9C=80?= =?UTF-8?q?=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- circle_app/assets/images/mine/im_toggle.png | Bin 0 -> 2391 bytes .../assets/images/mine/im_toggle_true.png | Bin 0 -> 2371 bytes circle_app/lib/app/call_out/logic.dart | 9 ++ .../app/circle/widgets/info_list_view.dart | 42 +++---- circle_app/lib/app/minefragment/logic.dart | 7 +- circle_app/lib/app/privacy/binding.dart | 10 ++ circle_app/lib/app/privacy/logic.dart | 29 +++++ circle_app/lib/app/privacy/state.dart | 5 + circle_app/lib/app/privacy/view.dart | 117 ++++++++++++++++++ circle_app/lib/app/setup/view.dart | 9 +- circle_app/lib/app/visitorlist/view.dart | 8 +- .../lib/common/Widgets/base_tip_widget.dart | 5 +- .../common/Widgets/open_vip_tip/logic.dart | 53 ++++++++ circle_app/lib/network/api.dart | 7 ++ circle_app/lib/router/app_pages.dart | 7 ++ circle_app/lib/router/app_routers.dart | 5 + circle_app/lib/util/PaymentUtils.dart | 2 +- circle_app/lib/util/eventBus.dart | 34 +++++ circle_app/pubspec.yaml | 2 + 19 files changed, 322 insertions(+), 29 deletions(-) create mode 100644 circle_app/assets/images/mine/im_toggle.png create mode 100644 circle_app/assets/images/mine/im_toggle_true.png create mode 100644 circle_app/lib/app/privacy/binding.dart create mode 100644 circle_app/lib/app/privacy/logic.dart create mode 100644 circle_app/lib/app/privacy/state.dart create mode 100644 circle_app/lib/app/privacy/view.dart create mode 100644 circle_app/lib/util/eventBus.dart diff --git a/circle_app/assets/images/mine/im_toggle.png b/circle_app/assets/images/mine/im_toggle.png new file mode 100644 index 0000000000000000000000000000000000000000..b8f8b613fd5a5209070999b69eaff1b37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niuBean.data!.token.toString(); + + + + + StreamSubscription subscription = EventBusManager.on().listen((event) { + vip = event.vip; + }); + } diff --git a/circle_app/lib/app/circle/widgets/info_list_view.dart b/circle_app/lib/app/circle/widgets/info_list_view.dart index 5991868..4acac5f 100644 --- a/circle_app/lib/app/circle/widgets/info_list_view.dart +++ b/circle_app/lib/app/circle/widgets/info_list_view.dart @@ -266,7 +266,7 @@ class _InfoListViewState extends State with AutomaticKeepAliveClie children: [ Row( children: [ - Container( + SizedBox( height: 30.sp, width: 30.0.sp + 15.sp * @@ -379,7 +379,7 @@ class _InfoListViewState extends State with AutomaticKeepAliveClie '${convertToTenThousand(widget.bean.viewTotal)}人看过', textAlign: TextAlign.left, style: TextStyle( - color: Color(0xff03FEFB), + color: const Color(0xff03FEFB), fontSize: 12.sp, ), ), @@ -433,7 +433,7 @@ class _InfoListViewState extends State with AutomaticKeepAliveClie backgroundColor: Colors.transparent, child: Container( height: 300.sp, - padding: EdgeInsets.all(1.0), + padding: const EdgeInsets.all(1.0), child: Stack( children: [ Container( @@ -469,7 +469,7 @@ class _InfoListViewState extends State with AutomaticKeepAliveClie msg, textAlign: TextAlign.center, style: TextStyle( - color: Color(0xCCF7FAFA), fontSize: 16.sp), + color: const Color(0xCCF7FAFA), fontSize: 16.sp), ),), ), ) @@ -548,12 +548,13 @@ class _InfoListViewState extends State with AutomaticKeepAliveClie Positioned( left: 0, top: 2.sp, - child: Image.asset(getCircleImage('vip_say')), height: 18.sp, + child: Image.asset(getCircleImage('vip_say')), ), Positioned( right: 2.sp, top: 2.sp, + height: 18.sp, child: Stack( alignment: Alignment.center, children: [ @@ -567,7 +568,6 @@ class _InfoListViewState extends State with AutomaticKeepAliveClie ) ], ), - height: 18.sp, ), Container( height: widgetHeight, @@ -575,7 +575,7 @@ class _InfoListViewState extends State with AutomaticKeepAliveClie padding: EdgeInsets.only(top: 12.sp, left: 12.sp, right: 12.sp), child: Column( children: [ - Container( + SizedBox( height: 72.sp, child: Row( // mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -589,7 +589,7 @@ class _InfoListViewState extends State with AutomaticKeepAliveClie Get.toNamed(AppRoutes.UserInfoActivity); return; } - if (widget.bean.is_limit) { + if (widget.bean.is_limit&&widget.bean.amount>0) { showJoinCiclePiker(widget.bean.id.toString(),widget.bean.amount.toString(),widget.bean.oldAmount.toString(),1,(payResult){ widget.bean.is_limit = false; }); @@ -727,7 +727,7 @@ class _InfoListViewState extends State with AutomaticKeepAliveClie // ), // ), errorWidget: (context, url, error) => - Icon(Icons.error), + const Icon(Icons.error), fit: BoxFit.cover, ), ), @@ -747,7 +747,7 @@ class _InfoListViewState extends State with AutomaticKeepAliveClie child: Row( children: [ widgets.isNotEmpty - ? Container( + ? SizedBox( width: 24 + 12.sp * widgets.length - 12.sp, height: 24.sp, child: Stack(children: widgets), @@ -871,7 +871,7 @@ class _InfoListViewState extends State with AutomaticKeepAliveClie padding: EdgeInsets.only(left: 12.sp, right: 12.sp), child: Column( children: [ - Container( + SizedBox( height: 72.sp, child: Row( // mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -1032,7 +1032,7 @@ class _InfoListViewState extends State with AutomaticKeepAliveClie // ), // ), errorWidget: (context, url, error) => - Icon(Icons.error), + const Icon(Icons.error), fit: BoxFit.cover, ), ), @@ -1052,7 +1052,7 @@ class _InfoListViewState extends State with AutomaticKeepAliveClie child: Row( children: [ widgets.isNotEmpty - ? Container( + ? SizedBox( width: 24 + 12.sp * widgets.length - 12.sp, height: 24.sp, child: Stack(children: widgets), @@ -1127,14 +1127,14 @@ class _InfoListViewState extends State with AutomaticKeepAliveClie backgroundColor: Colors.transparent, child: Container( height: 160.sp, - padding: EdgeInsets.all(1.0), + padding: const EdgeInsets.all(1.0), child: Stack( children: [ Container( decoration: BoxDecoration( shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(10.0), - gradient: LinearGradient( + gradient: const LinearGradient( colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], begin: Alignment.topCenter, end: Alignment.bottomCenter, @@ -1146,7 +1146,7 @@ class _InfoListViewState extends State with AutomaticKeepAliveClie decoration: BoxDecoration( shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(10.0), - gradient: LinearGradient( + gradient: const LinearGradient( colors: [Color(0xFF4C3E5F), Color(0xFF324140)], begin: Alignment.topCenter, end: Alignment.bottomCenter, @@ -1172,7 +1172,7 @@ class _InfoListViewState extends State with AutomaticKeepAliveClie "是否确认退出该圈子。", textAlign: TextAlign.center, style: TextStyle( - color: Color(0xCCF7FAFA), fontSize: 16.sp), + color: const Color(0xCCF7FAFA), fontSize: 16.sp), ), ), Row( @@ -1187,7 +1187,7 @@ class _InfoListViewState extends State with AutomaticKeepAliveClie margin: EdgeInsets.only(top: 30.sp), decoration: BoxDecoration( borderRadius: BorderRadius.circular(17), - gradient: LinearGradient( + gradient: const LinearGradient( colors: [ Color(0x26FFFFFF), Color(0x26FFFFFF), @@ -1205,7 +1205,7 @@ class _InfoListViewState extends State with AutomaticKeepAliveClie "否", style: TextStyle( color: Colors.white, - fontSize: 12, + fontSize: 12.sp, ), ), ), @@ -1222,7 +1222,7 @@ class _InfoListViewState extends State with AutomaticKeepAliveClie margin: EdgeInsets.only(top: 24.sp), decoration: BoxDecoration( borderRadius: BorderRadius.circular(17), - gradient: LinearGradient( + gradient: const LinearGradient( colors: [ Color(0xFF06F9FA), Color(0xFFDC5BFD), @@ -1240,7 +1240,7 @@ class _InfoListViewState extends State with AutomaticKeepAliveClie "是", style: TextStyle( color: Colors.white, - fontSize: 12, + fontSize: 12.sp, ), ), ), diff --git a/circle_app/lib/app/minefragment/logic.dart b/circle_app/lib/app/minefragment/logic.dart index b679be2..69f259f 100644 --- a/circle_app/lib/app/minefragment/logic.dart +++ b/circle_app/lib/app/minefragment/logic.dart @@ -45,9 +45,14 @@ class MinefragmentLogic extends GetxController { like_me_count = bean.data.likeMeCount ?? 0; recent_visit_count = bean.data.recentVisitCount ?? 0; joinedCircle = "${"加入了${bean.data.joininterestcount}"}个圈子"; + + + SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); - + if(bean.data.user.vip>0){ + vipMsg = "会员时长剩余${bean.data.vipExpireDays}天"; + } int likeMeCount = sharedPreferences.getInt(SharedPreferencesHelper.LIKEMECOUNT)??0; int recentVisitCount = sharedPreferences.getInt(SharedPreferencesHelper.RECENTVISITCOUNT)??0; diff --git a/circle_app/lib/app/privacy/binding.dart b/circle_app/lib/app/privacy/binding.dart new file mode 100644 index 0000000..71062ce --- /dev/null +++ b/circle_app/lib/app/privacy/binding.dart @@ -0,0 +1,10 @@ +import 'package:get/get.dart'; + +import 'logic.dart'; + +class PrivacyBinding extends Bindings { + @override + void dependencies() { + Get.lazyPut(() => PrivacyLogic()); + } +} diff --git a/circle_app/lib/app/privacy/logic.dart b/circle_app/lib/app/privacy/logic.dart new file mode 100644 index 0000000..fbee286 --- /dev/null +++ b/circle_app/lib/app/privacy/logic.dart @@ -0,0 +1,29 @@ +import 'dart:async'; + +import 'package:get/get.dart'; + +import '../../util/SharedPreferencesHelper.dart'; +import '../../util/eventBus.dart'; +import 'state.dart'; + +class PrivacyLogic extends GetxController { + int vip = 0; + + @override + void onInit() { + // TODO: implement onInit + super.onInit(); + SharedPreferencesHelper.getInstance().then((sharedPreferences) { + vip = sharedPreferences.getInt(SharedPreferencesHelper.VIP); + update(); + }); + + + + StreamSubscription subscription = EventBusManager.on().listen((event) { + vip = event.vip; + }); + } + bool isOpen = false; + final PrivacyState state = PrivacyState(); +} diff --git a/circle_app/lib/app/privacy/state.dart b/circle_app/lib/app/privacy/state.dart new file mode 100644 index 0000000..234fbe9 --- /dev/null +++ b/circle_app/lib/app/privacy/state.dart @@ -0,0 +1,5 @@ +class PrivacyState { + PrivacyState() { + ///Initialize variables + } +} diff --git a/circle_app/lib/app/privacy/view.dart b/circle_app/lib/app/privacy/view.dart new file mode 100644 index 0000000..7da4877 --- /dev/null +++ b/circle_app/lib/app/privacy/view.dart @@ -0,0 +1,117 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; + +import '../../common/Widgets/open_vip_tip/view.dart'; +import '../../components/my_app_bar.dart'; +import '../../util/util.dart'; +import 'logic.dart'; + +class PrivacyPage extends StatelessWidget { + PrivacyPage({Key? key}) : super(key: key); + + final logic = Get.find(); + final state = Get.find().state; + + @override + Widget build(BuildContext context) { + // _getFormat(context); + return GetBuilder(builder: (logic) { + return Container( + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage(getBaseImage("home_back")), + fit: BoxFit.cover, + ), + ), + child: Scaffold( + backgroundColor: Colors.transparent, + appBar: const MyAppBar(centerTitle: '隐私设置',), + body: SafeArea( + child: Container( + height: 60.sp, + margin: EdgeInsets.only(left: 16.sp, top: 16.sp, right: 16.sp), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + '神秘隐身', + style: TextStyle( + color: const Color(0xFFF7FAFA), + fontSize: 16.sp, + ), + ), + Padding( + padding: EdgeInsets.only(left: 4.sp), + child: Image.asset( + getBaseImage("vip"), + width: 24, + height: 24, + // Set visibility based on your logic + // For example, `visibility: isVisible ? Visibility.visible : Visibility.gone` + // replace `isVisible` with your actual variable or condition + // visibility: isVisible ? Visibility.visible : Visibility.gone, + // use `visible` instead of `Visibility.visible` if using flutter_svg package + ), + ), + ], + ), + Padding( + padding: EdgeInsets.only(top: 8.sp), + child: Text( + '开启后,其他人无法看见您', + style: TextStyle( + color: const Color(0xFFB7BECC), + fontSize: 12.sp, + ), + ), + ), + ], + ), + Expanded( + child: Align( + alignment: Alignment.centerRight, + child: GestureDetector( + onTap: (){ + if(logic.vip>0){ + logic.isOpen = !logic.isOpen; + logic.update(); + }else{ + showRechargeDialog(); + showToast("请先升级vip"); + } + + }, + child: Image.asset( + getMineImage(logic.isOpen? "im_toggle_true":"im_toggle"), + width: 24.sp, + height: 24.sp, + ), + ), + ), + ), + ], + ), + ), + ),), + ); + }); + } + + showRechargeDialog(){ + Get.bottomSheet( + Scaffold( + backgroundColor: Colors.transparent, + body: Open_vip_tipPage(false), + ), + isScrollControlled: true, + enableDrag: false); + + } +} + diff --git a/circle_app/lib/app/setup/view.dart b/circle_app/lib/app/setup/view.dart index e3236a5..68875e1 100644 --- a/circle_app/lib/app/setup/view.dart +++ b/circle_app/lib/app/setup/view.dart @@ -71,7 +71,14 @@ class SetupPage extends StatelessWidget { // SizedBox(height: 16.sp), // _buildItemRow('聊天设置', getHomeImage("icon_in")), // SizedBox(height: 16.sp), - + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + Get.toNamed(AppRoutes.PrivacyActivity); + }, + child: _buildItemRow('隐私设置', getHomeImage("icon_in")), + ), + SizedBox(height: 16.sp), GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { diff --git a/circle_app/lib/app/visitorlist/view.dart b/circle_app/lib/app/visitorlist/view.dart index c48d7fe..6670ebf 100644 --- a/circle_app/lib/app/visitorlist/view.dart +++ b/circle_app/lib/app/visitorlist/view.dart @@ -28,7 +28,7 @@ class VisitorlistPage extends StatelessWidget { ), child: Scaffold( backgroundColor: Colors.transparent, - appBar: MyAppBar( + appBar: const MyAppBar( centerTitle:"最近访客", ), body: SafeArea( @@ -58,7 +58,7 @@ class VisitorlistPage extends StatelessWidget { Get.toNamed(AppRoutes.UserInfoActivity, arguments: item.user.id.toString()); }, child: Container( - margin: EdgeInsets.only(bottom: 21), + margin: const EdgeInsets.only(bottom: 21), child: Row( children: [ Stack(children: [ @@ -134,7 +134,7 @@ class VisitorlistPage extends StatelessWidget { borderRadius: BorderRadius.circular(14), ), child: Center( - child: Text("私聊", style: TextStyle(fontSize: 14, color: Colors.white)), + child: Text("私聊", style: TextStyle(fontSize: 14.sp, color: Colors.white)), ) , @@ -154,7 +154,7 @@ class VisitorlistPage extends StatelessWidget { Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(17.sp), - gradient: LinearGradient( + gradient: const LinearGradient( colors: [ Color.fromRGBO(141, 255, 248, 1.0), Color.fromRGBO(181, 211, 255, 1.0), diff --git a/circle_app/lib/common/Widgets/base_tip_widget.dart b/circle_app/lib/common/Widgets/base_tip_widget.dart index aedfa1b..1edae26 100644 --- a/circle_app/lib/common/Widgets/base_tip_widget.dart +++ b/circle_app/lib/common/Widgets/base_tip_widget.dart @@ -68,7 +68,10 @@ joiinCircileTipWdiget(String cicleId, String pirce, String oldPrice, fontSize: 12.sp)), )), Platform.isIOS - ? Container() + ? Container( + height: 1, + width: 1, + ) : Positioned( bottom: 108.sp, child: Container( diff --git a/circle_app/lib/common/Widgets/open_vip_tip/logic.dart b/circle_app/lib/common/Widgets/open_vip_tip/logic.dart index 25ea9cd..189ffde 100644 --- a/circle_app/lib/common/Widgets/open_vip_tip/logic.dart +++ b/circle_app/lib/common/Widgets/open_vip_tip/logic.dart @@ -1,9 +1,12 @@ + import 'package:circle_app/util/util.dart'; import 'package:get/get.dart'; import '../../../network/api.dart'; import '../../../network/dio_manager.dart'; import '../../../util/PaymentUtils.dart'; +import '../../../util/SharedPreferencesHelper.dart'; +import '../../../util/eventBus.dart'; import 'state.dart'; class Open_vip_tipLogic extends GetxController { @@ -53,8 +56,11 @@ class Open_vip_tipLogic extends GetxController { openAliPay(bean.data.payUrl, (isSuccess, errorMsg) { if (isSuccess) { // 处理支付成功 + refreshVipStatus(); + } else { // 处理支付失败,errorMessage 可能为 null + refreshVipStatus(); } }); } else { @@ -70,6 +76,7 @@ class Open_vip_tipLogic extends GetxController { openWxPay(bean.data, (bool isSuccess, String? errorMessage) { if (isSuccess) { // 处理支付成功 + refreshVipStatus(); } else { // 处理支付失败,errorMessage 可能为 null } @@ -79,6 +86,22 @@ class Open_vip_tipLogic extends GetxController { } } } + + + refreshVipStatus()async{ + var data = await DioManager.instance.get(url: Api.getVipStatus); + var bean = BaseResponse.fromJson( + data, (data) => VipInfo.fromJson(data)); + if(bean.isSuccess()){ + SharedPreferencesHelper.getInstance().then((sharedPreferences) { + sharedPreferences.setInt(SharedPreferencesHelper.VIP,bean.data.vipLevel); + EventBusManager.fire(CommentVipEvent(bean.data.vipLevel)); + Get.back(); + }); + } + + + } } class PayUrlBean { @@ -155,3 +178,33 @@ class PriceBean { ); } } + +class VipInfo { + int? vipLevel; + String? expireDate; + int? expireDays; + + VipInfo({ + this.vipLevel, + this.expireDate, + this.expireDays, + }); + + factory VipInfo.fromJson(Map json) { + return VipInfo( + vipLevel: json['vip'] as int, + expireDate: json['vip_expire_date'] as String, + expireDays: json['vip_expire_days'] as int, + ); + } + + Map toJson() { + final Map data = {}; + data['vip'] = vipLevel; + data['vip_expire_date'] = expireDate; + data['vip_expire_days'] = expireDays; + return data; + } +} + + diff --git a/circle_app/lib/network/api.dart b/circle_app/lib/network/api.dart index 0ef9cb9..9adf271 100644 --- a/circle_app/lib/network/api.dart +++ b/circle_app/lib/network/api.dart @@ -42,6 +42,13 @@ class Api { + //vip状态 + static const getVipStatus = 'mall-service/my/vip'; + + + + + //刷新token static const refreshToken = 'user-service/login/token/refresh'; diff --git a/circle_app/lib/router/app_pages.dart b/circle_app/lib/router/app_pages.dart index 9b3fa63..c7c3ad2 100644 --- a/circle_app/lib/router/app_pages.dart +++ b/circle_app/lib/router/app_pages.dart @@ -35,6 +35,7 @@ import 'package:circle_app/app/offaccount/binding.dart'; import 'package:circle_app/app/offaccount/view.dart'; import 'package:circle_app/app/photoinfo/binding.dart'; import 'package:circle_app/app/photoinfo/view.dart'; +import 'package:circle_app/app/privacy/view.dart'; import 'package:circle_app/app/report/binding.dart'; import 'package:circle_app/app/report/view.dart'; import 'package:circle_app/app/select_circle/binding.dart'; @@ -58,6 +59,7 @@ import 'package:get/get_navigation/src/routes/get_route.dart'; import '../app/blacklist/view.dart'; import '../app/circle/binding.dart'; +import '../app/privacy/binding.dart'; import '../app/splash/view.dart'; import '../app/visitorlist/binding.dart'; import 'app_routers.dart'; @@ -200,5 +202,10 @@ class AppPages { page: () => Sys_notify_listPage(), binding: Sys_notify_listBinding(), ), + GetPage( + name: AppRoutes.PrivacyActivity, + page: () => PrivacyPage(), + binding: PrivacyBinding(), + ), ]; } diff --git a/circle_app/lib/router/app_routers.dart b/circle_app/lib/router/app_routers.dart index 80716ff..74e0e42 100644 --- a/circle_app/lib/router/app_routers.dart +++ b/circle_app/lib/router/app_routers.dart @@ -29,4 +29,9 @@ abstract class AppRoutes { static const MyFeedBackListActivity = '/mine/MyFeedBackListActivity'; static const Sys_notify_list = '/msg/Sys_notify_list'; + + static const PrivacyActivity = '/user/PrivacyActivity'; + + + } \ No newline at end of file diff --git a/circle_app/lib/util/PaymentUtils.dart b/circle_app/lib/util/PaymentUtils.dart index a4fb2a1..90e9a53 100644 --- a/circle_app/lib/util/PaymentUtils.dart +++ b/circle_app/lib/util/PaymentUtils.dart @@ -77,7 +77,7 @@ void _listenPay(AlipayResp resp) { showToast("重复请求"); break; case 6001: - showToast("取消支付"); + showToast("支付已取消"); break; case 6002: showToast("网络连接出错"); diff --git a/circle_app/lib/util/eventBus.dart b/circle_app/lib/util/eventBus.dart new file mode 100644 index 0000000..1d07bb2 --- /dev/null +++ b/circle_app/lib/util/eventBus.dart @@ -0,0 +1,34 @@ + + +import 'dart:async'; + +import 'package:event_bus/event_bus.dart'; + +class EventBusManager { + + static EventBus? _eventBus; + static EventBus get eventBus { + if (_eventBus == null) { + _eventBus = EventBus(); + } + return _eventBus!; + } + + static void fire(dynamic event) { + eventBus.fire(event); + } + + static Stream on() { + return eventBus.on(); + } + + static void cancelSubscription(StreamSubscription subscription) { + subscription.cancel(); + } +} + + +class CommentVipEvent{ + int vip = 0; + CommentVipEvent(this.vip); +} diff --git a/circle_app/pubspec.yaml b/circle_app/pubspec.yaml index af9771e..aee693b 100644 --- a/circle_app/pubspec.yaml +++ b/circle_app/pubspec.yaml @@ -90,6 +90,8 @@ dependencies: alipay_kit: 5.0.0 # 微信SDK插件 fluwx: ^3.8.1+1 + #event_bus: + event_bus: ^2.0.0