|
@@ -6,18 +6,6 @@ import 'package:calendar_view/popup_layer/popup_layer_controller.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
|
|
-/// 日程详情弹出框宽度
|
|
|
|
-const double _scheduleDetailPopupWidth = 380;
|
|
|
|
-
|
|
|
|
-/// 完成日程列表弹出框最小推荐宽度
|
|
|
|
-const double _moreSchedulePopupMinWidth = 220;
|
|
|
|
-
|
|
|
|
-/// 固定的头部高度
|
|
|
|
-const double _popupLayerMarginTop = 70;
|
|
|
|
-
|
|
|
|
-/// 固定的左侧宽度
|
|
|
|
-const double _popupLayerMarginLeft = 240;
|
|
|
|
-
|
|
|
|
class PopupLayer extends StatefulWidget {
|
|
class PopupLayer extends StatefulWidget {
|
|
const PopupLayer({super.key});
|
|
const PopupLayer({super.key});
|
|
|
|
|
|
@@ -34,6 +22,18 @@ class _PopupLayerState extends State<PopupLayer> {
|
|
GlobalKey moreSchedulePopupKey = GlobalKey();
|
|
GlobalKey moreSchedulePopupKey = GlobalKey();
|
|
GlobalKey scheduleDetailPopupKey = GlobalKey();
|
|
GlobalKey scheduleDetailPopupKey = GlobalKey();
|
|
|
|
|
|
|
|
+ /// 日程详情弹出框宽度
|
|
|
|
+ static const double _scheduleDetailPopupWidth = 380;
|
|
|
|
+
|
|
|
|
+ /// 完成日程列表弹出框最小推荐宽度
|
|
|
|
+ static const double _moreSchedulePopupMinWidth = 220;
|
|
|
|
+
|
|
|
|
+ /// 固定的头部高度
|
|
|
|
+ static const double _popupLayerMarginTop = 70;
|
|
|
|
+
|
|
|
|
+ /// 固定的左侧宽度
|
|
|
|
+ static const double _popupLayerMarginLeft = 240;
|
|
|
|
+
|
|
/// 弹出框装饰器
|
|
/// 弹出框装饰器
|
|
static final BoxDecoration _popupBoxDecoration = BoxDecoration(
|
|
static final BoxDecoration _popupBoxDecoration = BoxDecoration(
|
|
color: Colors.white,
|
|
color: Colors.white,
|
|
@@ -226,7 +226,7 @@ class AutoAlignFlowDelegate extends FlowDelegate {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-/// 日程框自动对齐委托
|
|
|
|
|
|
+/// 日程详情框自动对齐委托
|
|
class ScheduleAutoAlignFlowDelegate extends FlowDelegate {
|
|
class ScheduleAutoAlignFlowDelegate extends FlowDelegate {
|
|
final Offset triggerOffset;
|
|
final Offset triggerOffset;
|
|
final Size triggerSize;
|
|
final Size triggerSize;
|
|
@@ -241,9 +241,15 @@ class ScheduleAutoAlignFlowDelegate extends FlowDelegate {
|
|
if (containerSize.height - y < childSize.height) {
|
|
if (containerSize.height - y < childSize.height) {
|
|
y = containerSize.height - childSize.height;
|
|
y = containerSize.height - childSize.height;
|
|
}
|
|
}
|
|
- if (containerSize.width <
|
|
|
|
- x + childSize.width + _scheduleDetailPopupWidth) {
|
|
|
|
- x = x - _scheduleDetailPopupWidth;
|
|
|
|
|
|
+ if (containerSize.width - x - triggerSize.width < childSize.width) {
|
|
|
|
+ x = x - childSize.width;
|
|
|
|
+ if (x < 0) {
|
|
|
|
+ x = 0;
|
|
|
|
+ y += triggerSize.height + 10;
|
|
|
|
+ if (containerSize.height - y < childSize.height) {
|
|
|
|
+ y = containerSize.height - childSize.height;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
x = x + triggerSize.width;
|
|
x = x + triggerSize.width;
|
|
}
|
|
}
|