Bottom App Navigator on FocusScope.of(context).unfocus(); - flutter

I'm using the persisten_bottom_nav_bar package to handle the bottom navigation in our app. The issue I'm having is that when I call FocusScope.of(context).unfocus(); to get rid of the keyboard, the navigation bar goes dark for a second. Has anyone figure out how to fix this issue?

So I implemented the package incorrectly, I fixed it by changing the parameters to the ones below. The main issue was hideNavigationBarWhenKeyboardShows which was basically rendering the bottomAppBar every-time the keyboard closed.
PersistentTabView(
resizeToAvoidBottomInset: false,
hideNavigationBarWhenKeyboardShows: false
Tip: Add resizeToAvoidBottomInset: false to any screens with textFields to prevent a small white spacing in between the keyboard and the scaffold
Scaffold(
resizeToAvoidBottomInset: false,

Related

Flutter: Transparent appbar is hiding content

I have a transparent app bar that hides some of my content, because the content starts behind the app bar:
My Scaffold looks like this:
return Scaffold(
extendBody: true,
extendBodyBehindAppBar: true,
appBar: getAppBar(),
body: generateMainBody(context),
);
If I would set extendBodyBehindAppBar to false it would work, however, the appbar would not be transparent anymore (when scrolling the area that is not part of that cool shape would be black and not transparent like in the screenshot).
I thought of adding some top padding to just move the cut content down a little bit but surely there has to be a better solution?
In your generateMainBody function, wrap your current return with padding and change the padding padding: const EdgeInsets.only(top: 8.0),. You can increase or decrease the '8.0' to best suit your app.
Since the only solution seems to be some kind of padding I settled with this:
SizedBox(height: MainAppBar.appBarHeight)
I simply added an empty SizedBox that has the height of the AppBar to the top of my content.

Flutter: How to show content behind bottomNavigationBar

I have an app that has a bottomNavigationBar() wrapped in a clipRRect() but the content doesn't show behind it. The same behaviour also happens with transparent SliverAppBar()s in NestedScrollView()s. How can I achieve this?
Edit: Here is an example of the SliverAppBar() problem. The shadow is being hidden by the app bar.
you can try this:
Scaffold(
extendBody: true,
extendBodyBehindAppBar: true,
and give a little padding to the top and bottom of you body content for overlapping at the very top and bottom.

how to yellow and black lines from flutter android emulator

In the android emulator it appears this yellow and black lines when tipping in the form, someone knows how to fix it?
You can add the resizeToAvoidBottomInset parameter to your scaffold to automatically move your contents up when you open your keyboard to prevent a bottom overflow.
Scaffold(
resizeToAvoidBottomInset: false,
child: ...
);
alternatively you can wrap your from in a SingleChildScrollView widget to make any overflow scrollable.
SingleChildScrollView(
child: Column(...),
);

Why is there a white screen after the Flutter keyboard is put away?

When I use Flutter, when the keyboard is closed, there will be a short white screen under the page before I can see the content.
It's because the body of the Scaffold gets resized when you open the keyboard
You can avoid the resizing with resizeToAvoidBottomInset: false or use another backgroundColor on the Scaffold

How to make the keyboard go above my content?

Do you know how can I make my keyboard go above all the content?
Because I can see that flutter thinks that my keyboard is like a container which needs some space.
The resizeToAvoidBottomInset property is use to specify the behavior for this case.
Just set it to false to make the keyboard go above your content:
Scaffold(
resizeToAvoidBottomInset: false,
...
)