4inka / flutter_easy_search_bar

Other
13 stars 22 forks source link

Not showing suggestions after pressing close button #24

Open naveenbharadwaj19 opened 9 months ago

naveenbharadwaj19 commented 9 months ago

Hi, I've implemented this package into my project. However, after pressing the close button, suggestions are not appearing. They only show up after I start typing something. I need suggestions to appear immediately after pressing the close button. I've attached an image and minimal code for reference. 2024-01-17 14_47_14-Doctor Book Scan - Brave 2024-01-17 14_47_23-Doctor Book Scan - Brave

EasySearchBar(
              leading: Container(),
              title: Text(
                _.center?.split("..").first ?? "Click to Search Center",
                style: _.center != null && _.center!.isNotEmpty
                    ? Theme.of(context).textTheme.bodySmall
                    : Theme.of(context).textTheme.labelSmall,
              ),
              backgroundColor: Colors.grey[200],
              searchHintText: "Search center",
              elevation: 0,
              openOverlayOnSearch: true,
              searchClearIconTheme: IconThemeData(
                  size: 16, color: Theme.of(context).colorScheme.tertiary),
              iconTheme: IconThemeData(
                  size: 16, color: Theme.of(context).colorScheme.tertiary),
              searchHintStyle: Theme.of(context).textTheme.labelSmall,
              searchCursorColor: Theme.of(context).colorScheme.tertiary,
              searchTextStyle:
                  Theme.of(context).textTheme.bodySmall as TextStyle,
              suggestionTextStyle:
                  Theme.of(context).textTheme.bodySmall as TextStyle,
              onSearch: (v) {},
              onSuggestionTap: (v) {
                try {
                  String selectedCenter =
                      _.centerList.where((e) => e.split("..").first == v).first;
                  _.updateCenter(selectedCenter);
                } catch (e) {
                  logger.d(e);
                  snackBarGet("Something went wrong while searching center");
                }
              },
              suggestions:
                  _.centerList.map((e) => e.split("..").first).toList()..sort(),
            );