chore: make some overlay as barrier

This commit is contained in:
appflowy 2022-09-20 11:09:25 +08:00
parent 723b34a736
commit d35727b93c
7 changed files with 19 additions and 18 deletions

View File

@ -339,36 +339,30 @@ class _CalDateTimeSettingState extends State<_CalDateTimeSetting> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
List<Widget> children = [ List<Widget> children = [
Popover( AppFlowyPopover(
mutex: _popoverMutex, mutex: _popoverMutex,
asBarrier: true, asBarrier: true,
triggerActions: PopoverTriggerFlags.hover | PopoverTriggerFlags.click, triggerActions: PopoverTriggerFlags.hover | PopoverTriggerFlags.click,
offset: const Offset(20, 0), offset: const Offset(20, 0),
popupBuilder: (BuildContext context) { popupBuilder: (BuildContext context) {
return OverlayContainer( return DateFormatList(
constraints: BoxConstraints.loose(const Size(460, 440)), selectedFormat: widget.dateTypeOptionPB.dateFormat,
child: DateFormatList( onSelected: (format) =>
selectedFormat: widget.dateTypeOptionPB.dateFormat, widget.onEvent(DateCalEvent.setDateFormat(format)),
onSelected: (format) =>
widget.onEvent(DateCalEvent.setDateFormat(format)),
),
); );
}, },
child: const DateFormatButton(), child: const DateFormatButton(),
), ),
Popover( AppFlowyPopover(
mutex: _popoverMutex, mutex: _popoverMutex,
asBarrier: true, asBarrier: true,
triggerActions: PopoverTriggerFlags.hover | PopoverTriggerFlags.click, triggerActions: PopoverTriggerFlags.hover | PopoverTriggerFlags.click,
offset: const Offset(20, 0), offset: const Offset(20, 0),
popupBuilder: (BuildContext context) { popupBuilder: (BuildContext context) {
return OverlayContainer( return TimeFormatList(
constraints: BoxConstraints.loose(const Size(460, 440)), selectedFormat: widget.dateTypeOptionPB.timeFormat,
child: TimeFormatList( onSelected: (format) =>
selectedFormat: widget.dateTypeOptionPB.timeFormat, widget.onEvent(DateCalEvent.setTimeFormat(format)),
onSelected: (format) =>
widget.onEvent(DateCalEvent.setTimeFormat(format)),
),
); );
}, },
child: TimeFormatButton(timeFormat: widget.dateTypeOptionPB.timeFormat), child: TimeFormatButton(timeFormat: widget.dateTypeOptionPB.timeFormat),

View File

@ -243,6 +243,7 @@ class _SelectOptionCellState extends State<_SelectOptionCell> {
return AppFlowyPopover( return AppFlowyPopover(
controller: _popoverController, controller: _popoverController,
offset: const Offset(20, 0), offset: const Offset(20, 0),
asBarrier: true,
constraints: BoxConstraints.loose(const Size(200, 300)), constraints: BoxConstraints.loose(const Size(200, 300)),
mutex: widget.popoverMutex, mutex: widget.popoverMutex,
child: SizedBox( child: SizedBox(

View File

@ -66,6 +66,7 @@ class FieldTypeOptionEditor extends StatelessWidget {
height: GridSize.typeOptionItemHeight, height: GridSize.typeOptionItemHeight,
child: AppFlowyPopover( child: AppFlowyPopover(
constraints: BoxConstraints.loose(const Size(460, 440)), constraints: BoxConstraints.loose(const Size(460, 440)),
asBarrier: true,
triggerActions: PopoverTriggerFlags.click | PopoverTriggerFlags.hover, triggerActions: PopoverTriggerFlags.click | PopoverTriggerFlags.hover,
mutex: popoverMutex, mutex: popoverMutex,
offset: const Offset(20, 0), offset: const Offset(20, 0),

View File

@ -179,7 +179,8 @@ class CreateFieldButton extends StatelessWidget {
return AppFlowyPopover( return AppFlowyPopover(
triggerActions: PopoverTriggerFlags.click, triggerActions: PopoverTriggerFlags.click,
direction: PopoverDirection.bottomWithRightAligned, direction: PopoverDirection.bottomWithRightAligned,
constraints: BoxConstraints.loose(const Size(240, 200)), asBarrier: true,
constraints: BoxConstraints.loose(const Size(240, 600)),
child: FlowyButton( child: FlowyButton(
text: FlowyText.medium( text: FlowyText.medium(
LocaleKeys.grid_field_newColumn.tr(), LocaleKeys.grid_field_newColumn.tr(),

View File

@ -184,6 +184,7 @@ class _OptionCellState extends State<_OptionCell> {
controller: _popoverController, controller: _popoverController,
mutex: widget.popoverMutex, mutex: widget.popoverMutex,
offset: const Offset(20, 0), offset: const Offset(20, 0),
asBarrier: true,
constraints: BoxConstraints.loose(const Size(460, 440)), constraints: BoxConstraints.loose(const Size(460, 440)),
child: SizedBox( child: SizedBox(
height: GridSize.typeOptionItemHeight, height: GridSize.typeOptionItemHeight,

View File

@ -274,7 +274,7 @@ class _RowDetailCellState extends State<_RowDetailCell> {
offset: const Offset(20, 0), offset: const Offset(20, 0),
popupBuilder: (popoverContext) { popupBuilder: (popoverContext) {
return OverlayContainer( return OverlayContainer(
constraints: BoxConstraints.loose(const Size(240, 200)), constraints: BoxConstraints.loose(const Size(240, 600)),
child: FieldEditor( child: FieldEditor(
gridId: widget.cellId.gridId, gridId: widget.cellId.gridId,
fieldName: widget.cellId.fieldContext.field.name, fieldName: widget.cellId.fieldContext.field.name,

View File

@ -12,6 +12,7 @@ class AppFlowyPopover extends StatelessWidget {
final void Function()? onClose; final void Function()? onClose;
final PopoverMutex? mutex; final PopoverMutex? mutex;
final Offset? offset; final Offset? offset;
final bool asBarrier;
const AppFlowyPopover({ const AppFlowyPopover({
Key? key, Key? key,
@ -24,6 +25,7 @@ class AppFlowyPopover extends StatelessWidget {
this.triggerActions = 0, this.triggerActions = 0,
this.offset, this.offset,
this.controller, this.controller,
this.asBarrier = false,
}) : super(key: key); }) : super(key: key);
@override @override
@ -33,6 +35,7 @@ class AppFlowyPopover extends StatelessWidget {
onClose: onClose, onClose: onClose,
direction: direction, direction: direction,
mutex: mutex, mutex: mutex,
asBarrier: asBarrier,
triggerActions: triggerActions, triggerActions: triggerActions,
popupBuilder: (context) { popupBuilder: (context) {
final child = popupBuilder(context); final child = popupBuilder(context);