Skip to content

Commit 286781f

Browse files
committed
refactor: PopoverContainerState -> PopoverContainer
1 parent cc0d408 commit 286781f

File tree

7 files changed

+17
-17
lines changed

7 files changed

+17
-17
lines changed

frontend/app_flowy/lib/plugins/grid/presentation/widgets/header/field_type_list.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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();

frontend/app_flowy/lib/plugins/grid/presentation/widgets/header/type_option/date.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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
},

frontend/app_flowy/lib/plugins/grid/presentation/widgets/header/type_option/multi_select.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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,

frontend/app_flowy/lib/plugins/grid/presentation/widgets/header/type_option/number.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
),

frontend/app_flowy/lib/plugins/grid/presentation/widgets/header/type_option/select_option.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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
),

frontend/app_flowy/lib/plugins/grid/presentation/widgets/header/type_option/single_select.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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,

frontend/app_flowy/packages/appflowy_popover/lib/popover.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff 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

289298
class 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
}

0 commit comments

Comments
 (0)