提交 d528a6ed authored 作者: 史晓晨's avatar 史晓晨

feat:修改controller注入;

上级 9172bbee
import 'package:clx_flutter_message/util/extension.dart';
import 'package:clx_flutter_message/util/string_util.dart';
import 'package:clx_flutter_message/util/toast_util.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'clx_flutter_message_platform_interface.dart';
import 'common/constant.dart';
......@@ -125,23 +125,25 @@ abstract class BaseMessageConfig
// 构造方法
BaseMessageConfig() {
notificationLayoutController = NotificationLayoutController();
noticeDialogWidgetController = NoticeDialogWidgetController();
notificationLayoutController =
Get.put(NotificationLayoutController(), permanent: true);
noticeDialogWidgetController =
Get.put(NoticeDialogWidgetController(), permanent: true);
}
NotificationLayoutController? initNotificationLayoutController() {
if (findOtherLogic<NotificationLayoutController>() == null) {
notificationLayoutController = NotificationLayoutController();
}
return notificationLayoutController;
}
NoticeDialogWidgetController? initNoticeDialogWidgetController() {
if (findOtherLogic<NotificationLayoutController>() == null) {
noticeDialogWidgetController = NoticeDialogWidgetController();
}
return noticeDialogWidgetController;
}
// NotificationLayoutController? initNotificationLayoutController() {
// if (findOtherLogic<NotificationLayoutController>() == null) {
// notificationLayoutController = NotificationLayoutController();
// }
// return notificationLayoutController;
// }
//
// NoticeDialogWidgetController? initNoticeDialogWidgetController() {
// if (findOtherLogic<NotificationLayoutController>() == null) {
// noticeDialogWidgetController = NoticeDialogWidgetController();
// }
// return noticeDialogWidgetController;
// }
// 刷新消息、获取未处理消息,重新连接websocket
Future<void> refreshMessage(BuildContext context) async {
......
......@@ -200,7 +200,7 @@ class NoticeDialogWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return GetBuilder<NoticeDialogWidgetController>(
init: messageConfig.messageManagement?.initNoticeDialogWidgetController(),
init: messageConfig.messageManagement?.noticeDialogWidgetController,
id: "NoticeDialogWidget",
builder: (logic) {
return _buildView(logic);
......
......@@ -13,7 +13,7 @@ class NotificationLayoutWidget extends GetView<NotificationLayoutController> {
@override
Widget build(BuildContext context) {
return GetBuilder<NotificationLayoutController>(
init: messageConfig.messageManagement?.initNotificationLayoutController(),
init: messageConfig.messageManagement?.notificationLayoutController,
id: "NotificationLayoutWidget",
builder: (_) {
if (controller.headNode == null) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论