mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: update view state when close the popover (#1251)
This commit is contained in:
parent
ca8be6ab10
commit
89d036158b
@ -175,7 +175,7 @@ class ShareActionList extends StatelessWidget {
|
|||||||
actions: ShareAction.values
|
actions: ShareAction.values
|
||||||
.map((action) => ShareActionWrapper(action))
|
.map((action) => ShareActionWrapper(action))
|
||||||
.toList(),
|
.toList(),
|
||||||
withChild: (controller) {
|
buildChild: (controller) {
|
||||||
return RoundedTextButton(
|
return RoundedTextButton(
|
||||||
title: LocaleKeys.shareAction_buttonText.tr(),
|
title: LocaleKeys.shareAction_buttonText.tr(),
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
|
@ -157,7 +157,7 @@ class AppActionList extends StatelessWidget {
|
|||||||
actions: AppDisclosureAction.values
|
actions: AppDisclosureAction.values
|
||||||
.map((action) => DisclosureActionWrapper(action))
|
.map((action) => DisclosureActionWrapper(action))
|
||||||
.toList(),
|
.toList(),
|
||||||
withChild: (controller) {
|
buildChild: (controller) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
behavior: HitTestBehavior.opaque,
|
behavior: HitTestBehavior.opaque,
|
||||||
onTap: () => ExpandableController.of(context,
|
onTap: () => ExpandableController.of(context,
|
||||||
|
@ -177,7 +177,7 @@ class ViewDisclosureButton extends StatelessWidget {
|
|||||||
actions: ViewDisclosureAction.values
|
actions: ViewDisclosureAction.values
|
||||||
.map((action) => ViewDisclosureActionWrapper(action))
|
.map((action) => ViewDisclosureActionWrapper(action))
|
||||||
.toList(),
|
.toList(),
|
||||||
withChild: (controller) {
|
buildChild: (controller) {
|
||||||
return FlowyIconButton(
|
return FlowyIconButton(
|
||||||
iconPadding: const EdgeInsets.all(5),
|
iconPadding: const EdgeInsets.all(5),
|
||||||
width: 26,
|
width: 26,
|
||||||
@ -193,6 +193,9 @@ class ViewDisclosureButton extends StatelessWidget {
|
|||||||
onAction(action.inner);
|
onAction(action.inner);
|
||||||
controller.close();
|
controller.close();
|
||||||
},
|
},
|
||||||
|
onClosed: () {
|
||||||
|
onEdit(false);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ class BubbleActionList extends StatelessWidget {
|
|||||||
return PopoverActionList<PopoverAction>(
|
return PopoverActionList<PopoverAction>(
|
||||||
direction: PopoverDirection.topWithRightAligned,
|
direction: PopoverDirection.topWithRightAligned,
|
||||||
actions: actions,
|
actions: actions,
|
||||||
withChild: (controller) {
|
buildChild: (controller) {
|
||||||
return FlowyTextButton(
|
return FlowyTextButton(
|
||||||
'?',
|
'?',
|
||||||
tooltip: LocaleKeys.questionBubble_help.tr(),
|
tooltip: LocaleKeys.questionBubble_help.tr(),
|
||||||
|
@ -13,12 +13,14 @@ class PopoverActionList<T extends PopoverAction> extends StatefulWidget {
|
|||||||
final Function(T, PopoverController) onSelected;
|
final Function(T, PopoverController) onSelected;
|
||||||
final BoxConstraints constraints;
|
final BoxConstraints constraints;
|
||||||
final PopoverDirection direction;
|
final PopoverDirection direction;
|
||||||
final Widget Function(PopoverController) withChild;
|
final Widget Function(PopoverController) buildChild;
|
||||||
|
final VoidCallback? onClosed;
|
||||||
|
|
||||||
const PopoverActionList({
|
const PopoverActionList({
|
||||||
required this.actions,
|
required this.actions,
|
||||||
required this.withChild,
|
required this.buildChild,
|
||||||
required this.onSelected,
|
required this.onSelected,
|
||||||
|
this.onClosed,
|
||||||
this.direction = PopoverDirection.rightWithTopAligned,
|
this.direction = PopoverDirection.rightWithTopAligned,
|
||||||
this.constraints = const BoxConstraints(
|
this.constraints = const BoxConstraints(
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
@ -44,13 +46,14 @@ class _PopoverActionListState<T extends PopoverAction>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final child = widget.withChild(popoverController);
|
final child = widget.buildChild(popoverController);
|
||||||
|
|
||||||
return AppFlowyPopover(
|
return AppFlowyPopover(
|
||||||
controller: popoverController,
|
controller: popoverController,
|
||||||
constraints: widget.constraints,
|
constraints: widget.constraints,
|
||||||
direction: widget.direction,
|
direction: widget.direction,
|
||||||
triggerActions: PopoverTriggerFlags.none,
|
triggerActions: PopoverTriggerFlags.none,
|
||||||
|
onClose: widget.onClosed,
|
||||||
popupBuilder: (BuildContext popoverContext) {
|
popupBuilder: (BuildContext popoverContext) {
|
||||||
final List<Widget> children = widget.actions.map((action) {
|
final List<Widget> children = widget.actions.map((action) {
|
||||||
if (action is ActionCell) {
|
if (action is ActionCell) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user