@@ -43,11 +43,15 @@ class SelectOptionTypeOptionWidget extends StatelessWidget {
4343 builder: (context, state) {
4444 List <Widget > children = [
4545 const TypeOptionSeparator (),
46- const OptionTitle (),
46+ OptionTitle (
47+ popoverMutex: popoverMutex,
48+ ),
4749 if (state.isEditingOption)
48- const Padding (
49- padding: EdgeInsets .only (bottom: 10 ),
50- child: _CreateOptionTextField (),
50+ Padding (
51+ padding: const EdgeInsets .only (bottom: 10 ),
52+ child: _CreateOptionTextField (
53+ popoverMutex: popoverMutex,
54+ ),
5155 ),
5256 if (state.options.isEmpty && ! state.isEditingOption)
5357 const _AddOptionButton (),
@@ -62,7 +66,9 @@ class SelectOptionTypeOptionWidget extends StatelessWidget {
6266}
6367
6468class OptionTitle extends StatelessWidget {
65- const OptionTitle ({Key ? key}) : super (key: key);
69+ final PopoverMutex ? popoverMutex;
70+
71+ const OptionTitle ({this .popoverMutex, Key ? key}) : super (key: key);
6672
6773 @override
6874 Widget build (BuildContext context) {
@@ -78,7 +84,9 @@ class OptionTitle extends StatelessWidget {
7884 ];
7985 if (state.options.isNotEmpty && ! state.isEditingOption) {
8086 children.add (const Spacer ());
81- children.add (const _OptionTitleButton ());
87+ children.add (_OptionTitleButton (
88+ popoverMutex: popoverMutex,
89+ ));
8290 }
8391
8492 return SizedBox (
@@ -91,7 +99,9 @@ class OptionTitle extends StatelessWidget {
9199}
92100
93101class _OptionTitleButton extends StatelessWidget {
94- const _OptionTitleButton ({Key ? key}) : super (key: key);
102+ final PopoverMutex ? popoverMutex;
103+
104+ const _OptionTitleButton ({this .popoverMutex, Key ? key}) : super (key: key);
95105
96106 @override
97107 Widget build (BuildContext context) {
@@ -107,6 +117,7 @@ class _OptionTitleButton extends StatelessWidget {
107117 ),
108118 hoverColor: theme.hover,
109119 onTap: () {
120+ popoverMutex? .close ();
110121 context
111122 .read <SelectOptionTypeOptionBloc >()
112123 .add (const SelectOptionTypeOptionEvent .addingOption ());
@@ -252,7 +263,8 @@ class _AddOptionButton extends StatelessWidget {
252263}
253264
254265class _CreateOptionTextField extends StatelessWidget {
255- const _CreateOptionTextField ({Key ? key}) : super (key: key);
266+ final PopoverMutex ? popoverMutex;
267+ const _CreateOptionTextField ({this .popoverMutex, Key ? key}) : super (key: key);
256268
257269 @override
258270 Widget build (BuildContext context) {
@@ -273,6 +285,9 @@ class _CreateOptionTextField extends StatelessWidget {
273285 .read <SelectOptionTypeOptionBloc >()
274286 .add (SelectOptionTypeOptionEvent .createOption (optionName));
275287 },
288+ onFocused: () {
289+ popoverMutex? .close ();
290+ },
276291 );
277292 },
278293 );
0 commit comments