Search code examples
flutterflutter-layoutflutter-sliver

Stop expanding SliverAppBar on Textfield child receive focus


I have a textfield for search as SliverAppBar bottom parameter. In my App, this textfield is only visible when the bar is collapsed. (Achieved using OpacityWidget)
My problem is that every time this field gets focus SliverAppBar will be expanded to full size.
How can I prevent this from happening?


Solution

  • Turns out adding custom scroll physics solved the problem.

    NestedScrollView(
              physics: NeverScrollableScrollPhysics(),
    ...
    

    User interaction is somehow not blocked and the only visible change was disabled chaotic scrolling when typing to the textfield in SliverBar 👌