Home > Software engineering >  inkwell ontab does not work when clicking on the form
inkwell ontab does not work when clicking on the form

Time:07-22

I use the searchField, judging by the documentation, there should be an onTab field in the searcField widget, but apparently the library has been updated and there is no such function anymore, since I need to trigger an event in the block when clicking on the field, I decided to wrap the widget in inkwell, but when clicked, nothing works and the event does not called

BlocBuilder<FillprofileBloc, FillprofileState>(
                  builder: (context, state) {
                    return InkWell(
                      focusColor: Colors.transparent,
                      onTap: () {
          
                        _bloc.add(OnCitySearchTabEvent());
                        
                      },
                      child: SearchField(
                          searchInputDecoration: InputDecoration(

CodePudding user response:

There is a workaround with GestureDetector.

GestureDetector(
  behavior: HitTestBehavior.translucent,
  onPanDown: (_) {
    debugPrint("pan down");
  },
  child: SearchField(),
),

CodePudding user response:

You can use onTap param of TextField itself here. Or wrap your TextField with IgnorePointer to use InkWell

  • Related