flutter_smart_select icon indicating copy to clipboard operation
flutter_smart_select copied to clipboard

Release focus when smart select bottom sheet is opened

Open FickleLife opened this issue 4 years ago • 1 comments

I have several smart sheets along with TextFields in a form. When I click on a textfield, enter some info in and then click on a smart select, the keyboard correctly hides, however when I make my selection the smart select bottom modal retracts but then the keyboard comes back with the focus on the previously active textfield.

I've looked for a hook in smart select for when the modal opens but I can't find one - I'd like to run FocusScope.of(context).unfocus(); when the bottom sheet is triggered.

I tried adding it to onChanged but the previous textfield still retains focus.

Interestingly, this is working well for a CheckboxListTile I have in the form:

CheckboxListTile(
      isThreeLine: true,
      value: model.productState.v1 ?? false,
      onChanged: (value) {
        FocusScope.of(context).unfocus();
        model.v1 = value;
      },
      title: Text('khabdfr?'),
      checkColor: Colors.green,
   
 ),

Or is there another solution to the issue? Thanks

FickleLife avatar Jan 14 '21 05:01 FickleLife

I released https://pub.dev/packages/flutter_awesome_select with fixed null safety. Could you check that everything works for you?

vasilich6107 avatar Nov 12 '21 23:11 vasilich6107

Hi everyone,

I'm really sorry for not maintaining the smart_select package in a long time. It's been a great project, but it's become too difficult for me to maintain, especially since I've been going through a tough time for the past few years.

In its place, I've released a new package called choice. The combination to smart_select and chips_choice with cleaner, more flexible, and composable API for creating inline or prompted choice widgets with single or multiple selection.

I hope you'll check out choice. I think you'll find it to be a great replacement for smart_select.

Thanks for your understanding.

davigmacode avatar Aug 26 '23 11:08 davigmacode