mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: popover offsets (#1960)
This commit is contained in:
@ -65,6 +65,7 @@ class _SettingButtonState extends State<_SettingButton> {
|
|||||||
return AppFlowyPopover(
|
return AppFlowyPopover(
|
||||||
controller: popoverController,
|
controller: popoverController,
|
||||||
direction: PopoverDirection.leftWithTopAligned,
|
direction: PopoverDirection.leftWithTopAligned,
|
||||||
|
offset: const Offset(-8, 0),
|
||||||
triggerActions: PopoverTriggerFlags.none,
|
triggerActions: PopoverTriggerFlags.none,
|
||||||
constraints: BoxConstraints.loose(const Size(260, 400)),
|
constraints: BoxConstraints.loose(const Size(260, 400)),
|
||||||
margin: EdgeInsets.zero,
|
margin: EdgeInsets.zero,
|
||||||
|
@ -87,7 +87,7 @@ class _SwitchFieldButton extends StatelessWidget {
|
|||||||
asBarrier: true,
|
asBarrier: true,
|
||||||
triggerActions: PopoverTriggerFlags.click,
|
triggerActions: PopoverTriggerFlags.click,
|
||||||
mutex: popoverMutex,
|
mutex: popoverMutex,
|
||||||
offset: const Offset(20, 0),
|
offset: const Offset(8, 0),
|
||||||
popupBuilder: (popOverContext) {
|
popupBuilder: (popOverContext) {
|
||||||
return FieldTypeList(onSelectField: (newFieldType) {
|
return FieldTypeList(onSelectField: (newFieldType) {
|
||||||
context
|
context
|
||||||
|
@ -80,7 +80,7 @@ class DateTypeOptionWidget extends TypeOptionWidget {
|
|||||||
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(8, 0),
|
||||||
constraints: BoxConstraints.loose(const Size(460, 440)),
|
constraints: BoxConstraints.loose(const Size(460, 440)),
|
||||||
popupBuilder: (popoverContext) {
|
popupBuilder: (popoverContext) {
|
||||||
return DateFormatList(
|
return DateFormatList(
|
||||||
@ -107,7 +107,7 @@ class DateTypeOptionWidget extends TypeOptionWidget {
|
|||||||
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(8, 0),
|
||||||
constraints: BoxConstraints.loose(const Size(460, 440)),
|
constraints: BoxConstraints.loose(const Size(460, 440)),
|
||||||
popupBuilder: (BuildContext popoverContext) {
|
popupBuilder: (BuildContext popoverContext) {
|
||||||
return TimeFormatList(
|
return TimeFormatList(
|
||||||
|
@ -77,7 +77,7 @@ class NumberTypeOptionWidget extends TypeOptionWidget {
|
|||||||
mutex: popoverMutex,
|
mutex: popoverMutex,
|
||||||
triggerActions:
|
triggerActions:
|
||||||
PopoverTriggerFlags.hover | PopoverTriggerFlags.click,
|
PopoverTriggerFlags.hover | PopoverTriggerFlags.click,
|
||||||
offset: const Offset(20, 0),
|
offset: const Offset(8, 0),
|
||||||
constraints: BoxConstraints.loose(const Size(460, 440)),
|
constraints: BoxConstraints.loose(const Size(460, 440)),
|
||||||
margin: EdgeInsets.zero,
|
margin: EdgeInsets.zero,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
|
@ -203,7 +203,7 @@ class _OptionCellState extends State<_OptionCell> {
|
|||||||
return AppFlowyPopover(
|
return AppFlowyPopover(
|
||||||
controller: _popoverController,
|
controller: _popoverController,
|
||||||
mutex: widget.popoverMutex,
|
mutex: widget.popoverMutex,
|
||||||
offset: const Offset(20, 0),
|
offset: const Offset(8, 0),
|
||||||
margin: EdgeInsets.zero,
|
margin: EdgeInsets.zero,
|
||||||
asBarrier: true,
|
asBarrier: true,
|
||||||
constraints: BoxConstraints.loose(const Size(460, 460)),
|
constraints: BoxConstraints.loose(const Size(460, 460)),
|
||||||
|
@ -176,7 +176,7 @@ class _AddSortButtonState extends State<_AddSortButton> {
|
|||||||
mutex: widget.popoverMutex,
|
mutex: widget.popoverMutex,
|
||||||
direction: PopoverDirection.bottomWithLeftAligned,
|
direction: PopoverDirection.bottomWithLeftAligned,
|
||||||
constraints: BoxConstraints.loose(const Size(200, 300)),
|
constraints: BoxConstraints.loose(const Size(200, 300)),
|
||||||
offset: const Offset(0, 10),
|
offset: const Offset(0, 8),
|
||||||
triggerActions: PopoverTriggerFlags.none,
|
triggerActions: PopoverTriggerFlags.none,
|
||||||
asBarrier: true,
|
asBarrier: true,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
|
@ -30,20 +30,23 @@ class _FilterButtonState extends State<FilterButton> {
|
|||||||
|
|
||||||
return _wrapPopover(
|
return _wrapPopover(
|
||||||
context,
|
context,
|
||||||
FlowyTextButton(
|
SizedBox(
|
||||||
LocaleKeys.grid_settings_filter.tr(),
|
height: 26,
|
||||||
fontColor: textColor,
|
child: FlowyTextButton(
|
||||||
fillColor: Colors.transparent,
|
LocaleKeys.grid_settings_filter.tr(),
|
||||||
hoverColor: AFThemeExtension.of(context).lightGreyHover,
|
fontColor: textColor,
|
||||||
padding: GridSize.typeOptionContentInsets,
|
fillColor: Colors.transparent,
|
||||||
onPressed: () {
|
hoverColor: AFThemeExtension.of(context).lightGreyHover,
|
||||||
final bloc = context.read<GridFilterMenuBloc>();
|
padding: GridSize.typeOptionContentInsets,
|
||||||
if (bloc.state.filters.isEmpty) {
|
onPressed: () {
|
||||||
_popoverController.show();
|
final bloc = context.read<GridFilterMenuBloc>();
|
||||||
} else {
|
if (bloc.state.filters.isEmpty) {
|
||||||
bloc.add(const GridFilterMenuEvent.toggleMenu());
|
_popoverController.show();
|
||||||
}
|
} else {
|
||||||
},
|
bloc.add(const GridFilterMenuEvent.toggleMenu());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -55,7 +58,7 @@ class _FilterButtonState extends State<FilterButton> {
|
|||||||
controller: _popoverController,
|
controller: _popoverController,
|
||||||
direction: PopoverDirection.bottomWithLeftAligned,
|
direction: PopoverDirection.bottomWithLeftAligned,
|
||||||
constraints: BoxConstraints.loose(const Size(200, 300)),
|
constraints: BoxConstraints.loose(const Size(200, 300)),
|
||||||
offset: const Offset(0, 10),
|
offset: const Offset(0, 8),
|
||||||
triggerActions: PopoverTriggerFlags.none,
|
triggerActions: PopoverTriggerFlags.none,
|
||||||
child: child,
|
child: child,
|
||||||
popupBuilder: (BuildContext context) {
|
popupBuilder: (BuildContext context) {
|
||||||
|
@ -109,7 +109,7 @@ class _GridPropertyCellState extends State<_GridPropertyCell> {
|
|||||||
return AppFlowyPopover(
|
return AppFlowyPopover(
|
||||||
mutex: widget.popoverMutex,
|
mutex: widget.popoverMutex,
|
||||||
controller: _popoverController,
|
controller: _popoverController,
|
||||||
offset: const Offset(20, 0),
|
offset: const Offset(8, 0),
|
||||||
direction: PopoverDirection.leftWithTopAligned,
|
direction: PopoverDirection.leftWithTopAligned,
|
||||||
constraints: BoxConstraints.loose(const Size(240, 400)),
|
constraints: BoxConstraints.loose(const Size(240, 400)),
|
||||||
triggerActions: PopoverTriggerFlags.none,
|
triggerActions: PopoverTriggerFlags.none,
|
||||||
|
@ -41,23 +41,26 @@ class _SettingButtonState extends State<SettingButton> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
builder: (context, settingContext) {
|
builder: (context, settingContext) {
|
||||||
return AppFlowyPopover(
|
return SizedBox(
|
||||||
controller: _popoverController,
|
height: 26,
|
||||||
constraints: BoxConstraints.loose(const Size(260, 400)),
|
child: AppFlowyPopover(
|
||||||
direction: PopoverDirection.bottomWithLeftAligned,
|
controller: _popoverController,
|
||||||
offset: const Offset(0, 10),
|
constraints: BoxConstraints.loose(const Size(260, 400)),
|
||||||
margin: EdgeInsets.zero,
|
direction: PopoverDirection.bottomWithLeftAligned,
|
||||||
triggerActions: PopoverTriggerFlags.none,
|
offset: const Offset(0, 8),
|
||||||
child: FlowyTextButton(
|
margin: EdgeInsets.zero,
|
||||||
LocaleKeys.settings_title.tr(),
|
triggerActions: PopoverTriggerFlags.none,
|
||||||
fillColor: Colors.transparent,
|
child: FlowyTextButton(
|
||||||
hoverColor: AFThemeExtension.of(context).lightGreyHover,
|
LocaleKeys.settings_title.tr(),
|
||||||
padding: GridSize.typeOptionContentInsets,
|
fillColor: Colors.transparent,
|
||||||
onPressed: () => _popoverController.show(),
|
hoverColor: AFThemeExtension.of(context).lightGreyHover,
|
||||||
|
padding: GridSize.typeOptionContentInsets,
|
||||||
|
onPressed: () => _popoverController.show(),
|
||||||
|
),
|
||||||
|
popupBuilder: (BuildContext context) {
|
||||||
|
return _GridSettingListPopover(settingContext: settingContext);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
popupBuilder: (BuildContext context) {
|
|
||||||
return _GridSettingListPopover(settingContext: settingContext);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -58,7 +58,7 @@ class _SortButtonState extends State<SortButton> {
|
|||||||
controller: _popoverController,
|
controller: _popoverController,
|
||||||
direction: PopoverDirection.bottomWithLeftAligned,
|
direction: PopoverDirection.bottomWithLeftAligned,
|
||||||
constraints: BoxConstraints.loose(const Size(200, 300)),
|
constraints: BoxConstraints.loose(const Size(200, 300)),
|
||||||
offset: const Offset(0, 10),
|
offset: const Offset(0, 8),
|
||||||
margin: const EdgeInsets.all(6),
|
margin: const EdgeInsets.all(6),
|
||||||
triggerActions: PopoverTriggerFlags.none,
|
triggerActions: PopoverTriggerFlags.none,
|
||||||
child: child,
|
child: child,
|
||||||
|
@ -145,7 +145,7 @@ class _ChecklistOptionCellState extends State<_ChecklistOptionCell> {
|
|||||||
Widget _wrapPopover(Widget child) {
|
Widget _wrapPopover(Widget child) {
|
||||||
return AppFlowyPopover(
|
return AppFlowyPopover(
|
||||||
controller: _popoverController,
|
controller: _popoverController,
|
||||||
offset: const Offset(20, 0),
|
offset: const Offset(8, 0),
|
||||||
asBarrier: true,
|
asBarrier: true,
|
||||||
constraints: BoxConstraints.loose(const Size(200, 300)),
|
constraints: BoxConstraints.loose(const Size(200, 300)),
|
||||||
mutex: widget.popoverMutex,
|
mutex: widget.popoverMutex,
|
||||||
|
@ -376,7 +376,7 @@ class _DateTypeOptionButton extends StatelessWidget {
|
|||||||
return AppFlowyPopover(
|
return AppFlowyPopover(
|
||||||
mutex: popoverMutex,
|
mutex: popoverMutex,
|
||||||
triggerActions: PopoverTriggerFlags.hover | PopoverTriggerFlags.click,
|
triggerActions: PopoverTriggerFlags.hover | PopoverTriggerFlags.click,
|
||||||
offset: const Offset(20, 0),
|
offset: const Offset(8, 0),
|
||||||
margin: EdgeInsets.zero,
|
margin: EdgeInsets.zero,
|
||||||
constraints: BoxConstraints.loose(const Size(140, 100)),
|
constraints: BoxConstraints.loose(const Size(140, 100)),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
@ -431,7 +431,7 @@ class _CalDateTimeSettingState extends State<_CalDateTimeSetting> {
|
|||||||
AppFlowyPopover(
|
AppFlowyPopover(
|
||||||
mutex: timeSettingPopoverMutex,
|
mutex: timeSettingPopoverMutex,
|
||||||
triggerActions: PopoverTriggerFlags.hover | PopoverTriggerFlags.click,
|
triggerActions: PopoverTriggerFlags.hover | PopoverTriggerFlags.click,
|
||||||
offset: const Offset(20, 0),
|
offset: const Offset(8, 0),
|
||||||
popupBuilder: (BuildContext context) {
|
popupBuilder: (BuildContext context) {
|
||||||
return DateFormatList(
|
return DateFormatList(
|
||||||
selectedFormat: widget.dateTypeOptionPB.dateFormat,
|
selectedFormat: widget.dateTypeOptionPB.dateFormat,
|
||||||
@ -449,7 +449,7 @@ class _CalDateTimeSettingState extends State<_CalDateTimeSetting> {
|
|||||||
AppFlowyPopover(
|
AppFlowyPopover(
|
||||||
mutex: timeSettingPopoverMutex,
|
mutex: timeSettingPopoverMutex,
|
||||||
triggerActions: PopoverTriggerFlags.hover | PopoverTriggerFlags.click,
|
triggerActions: PopoverTriggerFlags.hover | PopoverTriggerFlags.click,
|
||||||
offset: const Offset(20, 0),
|
offset: const Offset(8, 0),
|
||||||
popupBuilder: (BuildContext context) {
|
popupBuilder: (BuildContext context) {
|
||||||
return TimeFormatList(
|
return TimeFormatList(
|
||||||
selectedFormat: widget.dateTypeOptionPB.timeFormat,
|
selectedFormat: widget.dateTypeOptionPB.timeFormat,
|
||||||
|
@ -285,7 +285,7 @@ class _SelectOptionCellState extends State<_SelectOptionCell> {
|
|||||||
);
|
);
|
||||||
return AppFlowyPopover(
|
return AppFlowyPopover(
|
||||||
controller: _popoverController,
|
controller: _popoverController,
|
||||||
offset: const Offset(20, 0),
|
offset: const Offset(8, 0),
|
||||||
margin: EdgeInsets.zero,
|
margin: EdgeInsets.zero,
|
||||||
asBarrier: true,
|
asBarrier: true,
|
||||||
constraints: BoxConstraints.loose(const Size(200, 460)),
|
constraints: BoxConstraints.loose(const Size(200, 460)),
|
||||||
|
@ -127,7 +127,7 @@ class _GridURLCellState extends GridCellState<GridURLCell> {
|
|||||||
constraints: BoxConstraints.loose(const Size(300, 160)),
|
constraints: BoxConstraints.loose(const Size(300, 160)),
|
||||||
direction: PopoverDirection.bottomWithLeftAligned,
|
direction: PopoverDirection.bottomWithLeftAligned,
|
||||||
triggerActions: PopoverTriggerFlags.none,
|
triggerActions: PopoverTriggerFlags.none,
|
||||||
offset: const Offset(0, 20),
|
offset: const Offset(0, 8),
|
||||||
child: SizedBox.expand(
|
child: SizedBox.expand(
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
child: Align(alignment: Alignment.centerLeft, child: richText),
|
child: Align(alignment: Alignment.centerLeft, child: richText),
|
||||||
@ -210,7 +210,7 @@ class _EditURLAccessoryState extends State<_EditURLAccessory>
|
|||||||
constraints: BoxConstraints.loose(const Size(300, 160)),
|
constraints: BoxConstraints.loose(const Size(300, 160)),
|
||||||
controller: _popoverController,
|
controller: _popoverController,
|
||||||
direction: PopoverDirection.bottomWithLeftAligned,
|
direction: PopoverDirection.bottomWithLeftAligned,
|
||||||
offset: const Offset(0, 20),
|
offset: const Offset(0, 8),
|
||||||
child: svgWidget(
|
child: svgWidget(
|
||||||
"editor/edit",
|
"editor/edit",
|
||||||
color: Theme.of(context).colorScheme.onSurface,
|
color: Theme.of(context).colorScheme.onSurface,
|
||||||
|
@ -82,6 +82,7 @@ class ShareActionList extends StatelessWidget {
|
|||||||
final docShareBloc = context.read<DocShareBloc>();
|
final docShareBloc = context.read<DocShareBloc>();
|
||||||
return PopoverActionList<ShareActionWrapper>(
|
return PopoverActionList<ShareActionWrapper>(
|
||||||
direction: PopoverDirection.bottomWithCenterAligned,
|
direction: PopoverDirection.bottomWithCenterAligned,
|
||||||
|
offset: const Offset(0, 8),
|
||||||
actions: ShareAction.values
|
actions: ShareAction.values
|
||||||
.map((action) => ShareActionWrapper(action))
|
.map((action) => ShareActionWrapper(action))
|
||||||
.toList(),
|
.toList(),
|
||||||
|
@ -48,6 +48,7 @@ class AddButton extends StatelessWidget {
|
|||||||
return PopoverActionList<PopoverAction>(
|
return PopoverActionList<PopoverAction>(
|
||||||
direction: PopoverDirection.bottomWithLeftAligned,
|
direction: PopoverDirection.bottomWithLeftAligned,
|
||||||
actions: actions,
|
actions: actions,
|
||||||
|
offset: const Offset(0, 8),
|
||||||
buildChild: (controller) {
|
buildChild: (controller) {
|
||||||
return FlowyIconButton(
|
return FlowyIconButton(
|
||||||
width: 22,
|
width: 22,
|
||||||
|
@ -42,6 +42,7 @@ class BubbleActionList extends StatelessWidget {
|
|||||||
return PopoverActionList<PopoverAction>(
|
return PopoverActionList<PopoverAction>(
|
||||||
direction: PopoverDirection.topWithRightAligned,
|
direction: PopoverDirection.topWithRightAligned,
|
||||||
actions: actions,
|
actions: actions,
|
||||||
|
offset: const Offset(0, -8),
|
||||||
buildChild: (controller) {
|
buildChild: (controller) {
|
||||||
return FlowyTextButton(
|
return FlowyTextButton(
|
||||||
'?',
|
'?',
|
||||||
|
@ -13,6 +13,7 @@ class PopoverActionList<T extends PopoverAction> extends StatefulWidget {
|
|||||||
final Widget Function(PopoverController) buildChild;
|
final Widget Function(PopoverController) buildChild;
|
||||||
final VoidCallback? onClosed;
|
final VoidCallback? onClosed;
|
||||||
final bool asBarrier;
|
final bool asBarrier;
|
||||||
|
final Offset offset;
|
||||||
|
|
||||||
const PopoverActionList({
|
const PopoverActionList({
|
||||||
required this.actions,
|
required this.actions,
|
||||||
@ -22,6 +23,7 @@ class PopoverActionList<T extends PopoverAction> extends StatefulWidget {
|
|||||||
this.onClosed,
|
this.onClosed,
|
||||||
this.direction = PopoverDirection.rightWithTopAligned,
|
this.direction = PopoverDirection.rightWithTopAligned,
|
||||||
this.asBarrier = false,
|
this.asBarrier = false,
|
||||||
|
this.offset = Offset.zero,
|
||||||
this.constraints = const BoxConstraints(
|
this.constraints = const BoxConstraints(
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
maxWidth: 460,
|
maxWidth: 460,
|
||||||
@ -54,6 +56,7 @@ class _PopoverActionListState<T extends PopoverAction>
|
|||||||
constraints: widget.constraints,
|
constraints: widget.constraints,
|
||||||
direction: widget.direction,
|
direction: widget.direction,
|
||||||
mutex: widget.mutex,
|
mutex: widget.mutex,
|
||||||
|
offset: widget.offset,
|
||||||
triggerActions: PopoverTriggerFlags.none,
|
triggerActions: PopoverTriggerFlags.none,
|
||||||
onClose: widget.onClosed,
|
onClose: widget.onClosed,
|
||||||
popupBuilder: (BuildContext popoverContext) {
|
popupBuilder: (BuildContext popoverContext) {
|
||||||
|
Reference in New Issue
Block a user