refactor: remove useless onTap and don't pass popovermutex when not needed

This commit is contained in:
Cyrine-benabid 2022-10-30 20:30:38 +01:00
parent 339e3d242f
commit 286c89bf74

View File

@ -43,9 +43,7 @@ class SelectOptionTypeOptionWidget extends StatelessWidget {
builder: (context, state) {
List<Widget> children = [
const TypeOptionSeparator(),
OptionTitle(
popoverMutex: popoverMutex,
),
const OptionTitle(),
if (state.isEditingOption)
Padding(
padding: const EdgeInsets.only(bottom: 10),
@ -66,9 +64,7 @@ class SelectOptionTypeOptionWidget extends StatelessWidget {
}
class OptionTitle extends StatelessWidget {
final PopoverMutex? popoverMutex;
const OptionTitle({this.popoverMutex, Key? key}) : super(key: key);
const OptionTitle({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
@ -84,9 +80,7 @@ class OptionTitle extends StatelessWidget {
];
if (state.options.isNotEmpty && !state.isEditingOption) {
children.add(const Spacer());
children.add(_OptionTitleButton(
popoverMutex: popoverMutex,
));
children.add(const _OptionTitleButton());
}
return SizedBox(
@ -99,9 +93,7 @@ class OptionTitle extends StatelessWidget {
}
class _OptionTitleButton extends StatelessWidget {
final PopoverMutex? popoverMutex;
const _OptionTitleButton({this.popoverMutex, Key? key}) : super(key: key);
const _OptionTitleButton({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
@ -117,7 +109,6 @@ class _OptionTitleButton extends StatelessWidget {
),
hoverColor: theme.hover,
onTap: () {
popoverMutex?.close();
context
.read<SelectOptionTypeOptionBloc>()
.add(const SelectOptionTypeOptionEvent.addingOption());
@ -316,9 +307,6 @@ class _CreateOptionTextFieldState extends State<_CreateOptionTextField> {
.read<SelectOptionTypeOptionBloc>()
.add(SelectOptionTypeOptionEvent.createOption(optionName));
},
onTap: () {
widget.popoverMutex?.close();
},
);
},
);