4inka / flutter_easy_search_bar

Other
13 stars 22 forks source link

Put actions on right flag #14

Closed JEuler closed 1 year ago

JEuler commented 1 year ago

Added flag (with kind of duplicated bad code, but was in hurry). :) Thank you for the nice library.

yustapps commented 1 year ago

That's not right, because if you have more than one actions, search icon appears two times.

The code it would be like this when putActionsOnRight is enabled:


                                      return IconTheme(
                                        data: iconTheme,
                                        child: IconButton(
                                          icon: const Icon(Icons.search),
                                          iconSize: iconTheme.size ?? 24,
                                          onPressed: () {
                                            _controller.forward();
                                            _focusNode.requestFocus();

                                            if (widget.openOverlayOnSearch) {
                                              openOverlay();
                                            }
                                          },
                                          tooltip: MaterialLocalizations.of(context).searchFieldLabel
                                        )
                                      );
                                    }

                                    return IconTheme(
                                      data: iconTheme,
                                      child: widget.actions[index - 1]
                                    );```

I would be very grateful if you update it, thank you!
JEuler commented 1 year ago

I have this code in my app with 3 actions and it is working like expected. 😕

JEuler commented 1 year ago

Could you recheck?

4inka commented 1 year ago

Hello @JEuler,

First of all, I'm sorry for only being able to respond to your issue after a long time. Thank you for you valuable contribution. Just going to reduce the duplicated code and then update the package.

Have a nice day