Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Unable to show search bar #44

Open
Switernal opened this issue Apr 11, 2021 · 4 comments
Open

Unable to show search bar #44

Switernal opened this issue Apr 11, 2021 · 4 comments

Comments

@Switernal
Copy link

When I try to tap on the search button, the search bar doesn't open and just throws an error:

The method 'addLocalHistoryEntry' was called on null.
Receiver: null
Tried calling: addLocalHistoryEntry(Instance of 'LocalHistoryEntry')

What's the matter with it?

@ArcticZeroo
Copy link
Owner

I am unable to reproduce this in the example from the latest pr #46 . Can you show some code?

@juvanjan
Copy link

@ArcticZeroo The issue was on my side. I was able to fix it.

@SteMMo33
Copy link

Hello,
flutter_search_bar: ^2.1.0

I'm having the same problem: at the beginning I see the 'default' appbar with title and the lens icon.
If I press the icon I see nothing but in the debug/run window I note that the 'build' function is recalled (setstate() ?) - no errors.

The code I used is basically the one from the example:

 searchBar = new SearchBar(
        inBar: true,
        buildDefaultAppBar: buildAppBar,
        setState: setState,
        hintText: "Filter",
        onSubmitted: onSearchSubmitted,
        onCleared: () {
          print("cleared");
        },
        onClosed: () {
          print("closed");
        }
    );

AppBar buildAppBar(BuildContext context) {
    return new AppBar(
        title: new Text(widget.title),
        actions: [searchBar.getSearchAction(context)]);
  }


  @override
  Widget build(BuildContext context) {
    //
    return Scaffold(
      appBar: buildAppBar(context),
...

@SteMMo33
Copy link

Solved,
I re-checked the code. The error was in the appbar: row.

@override
  Widget build(BuildContext context) {
    //
    return Scaffold(
      appBar: searchBar.build(context),

Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants