File tree Expand file tree Collapse file tree 7 files changed +17
-17
lines changed
packages/appflowy_popover/lib Expand file tree Collapse file tree 7 files changed +17
-17
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ class FieldTypeList extends StatelessWidget with FlowyOverlayDelegate {
2626 fieldType: fieldType,
2727 onSelectField: (fieldType) {
2828 onSelectField (fieldType);
29- PopoverContainerState .of (context).closeAll ();
29+ PopoverContainer .of (context).closeAll ();
3030 },
3131 );
3232 }).toList ();
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ class DateTypeOptionWidget extends TypeOptionWidget {
7676 context
7777 .read <DateTypeOptionBloc >()
7878 .add (DateTypeOptionEvent .didSelectDateFormat (format));
79- PopoverContainerState .of (popoverContext).closeAll ();
79+ PopoverContainer .of (popoverContext).closeAll ();
8080 },
8181 ),
8282 );
@@ -100,7 +100,7 @@ class DateTypeOptionWidget extends TypeOptionWidget {
100100 context
101101 .read <DateTypeOptionBloc >()
102102 .add (DateTypeOptionEvent .didSelectTimeFormat (format));
103- PopoverContainerState .of (popoverContext).closeAll ();
103+ PopoverContainer .of (popoverContext).closeAll ();
104104 }),
105105 );
106106 },
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ class MultiSelectTypeOptionWidget extends TypeOptionWidget {
4141 return SelectOptionTypeOptionWidget (
4242 options: selectOptionAction.typeOption.options,
4343 beginEdit: () {
44- PopoverContainerState .of (context).closeAll ();
44+ PopoverContainer .of (context).closeAll ();
4545 },
4646 popoverMutex: popoverMutex,
4747 typeOptionAction: selectOptionAction,
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ class NumberTypeOptionWidget extends TypeOptionWidget {
8383 context
8484 .read <NumberTypeOptionBloc >()
8585 .add (NumberTypeOptionEvent .didSelectFormat (format));
86- PopoverContainerState .of (popoverContext).closeAll ();
86+ PopoverContainer .of (popoverContext).closeAll ();
8787 },
8888 selectedFormat: state.typeOption.format,
8989 ),
Original file line number Diff line number Diff line change @@ -208,13 +208,13 @@ class _OptionCellState extends State<_OptionCell> {
208208 context
209209 .read <SelectOptionTypeOptionBloc >()
210210 .add (SelectOptionTypeOptionEvent .deleteOption (widget.option));
211- PopoverContainerState .of (popoverContext).closeAll ();
211+ PopoverContainer .of (popoverContext).closeAll ();
212212 },
213213 onUpdated: (updatedOption) {
214214 context
215215 .read <SelectOptionTypeOptionBloc >()
216216 .add (SelectOptionTypeOptionEvent .updateOption (updatedOption));
217- PopoverContainerState .of (popoverContext).closeAll ();
217+ PopoverContainer .of (popoverContext).closeAll ();
218218 },
219219 key: ValueKey (widget.option.id),
220220 ),
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ class SingleSelectTypeOptionWidget extends TypeOptionWidget {
4040 return SelectOptionTypeOptionWidget (
4141 options: selectOptionAction.typeOption.options,
4242 beginEdit: () {
43- PopoverContainerState .of (context).closeAll ();
43+ PopoverContainer .of (context).closeAll ();
4444 },
4545 popoverMutex: popoverMutex,
4646 typeOptionAction: selectOptionAction,
Original file line number Diff line number Diff line change @@ -284,6 +284,15 @@ class PopoverContainer extends StatefulWidget {
284284
285285 @override
286286 State <StatefulWidget > createState () => PopoverContainerState ();
287+
288+ static PopoverContainerState of (BuildContext context) {
289+ if (context is StatefulElement && context.state is PopoverContainerState ) {
290+ return context.state as PopoverContainerState ;
291+ }
292+ final PopoverContainerState ? result =
293+ context.findAncestorStateOfType <PopoverContainerState >();
294+ return result! ;
295+ }
287296}
288297
289298class PopoverContainerState extends State <PopoverContainer > {
@@ -302,13 +311,4 @@ class PopoverContainerState extends State<PopoverContainer> {
302311 close () => widget.onClose ();
303312
304313 closeAll () => widget.onCloseAll ();
305-
306- static PopoverContainerState of (BuildContext context) {
307- if (context is StatefulElement && context.state is PopoverContainerState ) {
308- return context.state as PopoverContainerState ;
309- }
310- final PopoverContainerState ? result =
311- context.findAncestorStateOfType <PopoverContainerState >();
312- return result! ;
313- }
314314}
You can’t perform that action at this time.
0 commit comments