Browse Source

修正bugs

gavin.chen 2 years ago
parent
commit
b647ae4927

+ 6 - 3
lib/calendar_page/month_calendar/schedule_popup.dart

@@ -8,18 +8,20 @@ class SchedulePopup extends StatefulWidget {
   const SchedulePopup({
     Key? key,
     required this.scheduleData,
+    required this.onClose,
   }) : super(key: key);
 
   /// 日程数据
   final Schedule scheduleData;
 
+  final VoidCallback onClose;
+
   @override
   SchedulePopupState createState() => SchedulePopupState();
 }
 
 class SchedulePopupState extends State<SchedulePopup> {
   CalendarController calendarController = Get.find<CalendarController>();
-  PopupLayerController popupLayerController = Get.find<PopupLayerController>();
   @override
   void initState() {
     super.initState();
@@ -63,7 +65,8 @@ class SchedulePopupState extends State<SchedulePopup> {
     required IconData icon,
   }) {
     return IconButton(
-      onPressed: () => onPressed(),
+      splashRadius: 20,
+      onPressed: onPressed,
       icon: _buildIcon(
         icon: icon,
         size: 20,
@@ -179,7 +182,7 @@ class SchedulePopupState extends State<SchedulePopup> {
           ),
           _buildIconButton(
             onPressed: () {
-              popupLayerController.onCloseSchedulePopup.emit(this, false);
+              widget.onClose.call();
             },
             icon: Icons.close,
           ),

+ 6 - 0
lib/popup_layer/popup_layer.dart

@@ -165,6 +165,12 @@ class _PopupLayerState extends State<PopupLayer> {
             decoration: _popupBoxDecoration,
             child: SchedulePopup(
               scheduleData: popupLayerController.currScheduleData,
+              onClose: () {
+                setState(() {
+                  _isShowScheduleDetailPopup = false;
+                });
+                popupLayerController.onCloseSchedulePopup.emit(this, null);
+              },
             ),
           ),
         ),