I'm newbie in the flutter, and when I create a floating button in the navigation bar to show the record form. But when I try to input something to the textfield, the floating button not stay in the bottom (navigation bar)
floating button in the navigation bar
after input something to the textfields
Anyone can help me how to fix this? Thank you
By default, your Scaffold has been instructed to resize itself whenever a keyboard opens up.
This is controlled by the resizeToAvoidBottomInset property of the Scaffold.
When you set it to false, your Scaffold won't resize itself when a Keyboard is open causing your Scaffold to still take up the entire device height behind the Keyboard.
Use it like this,
Scaffold(
resizeToAvoidBottomInset: false
Related
When I use a textfield on the page I designed with expanded, everything gets shrink when the keyboard is opened. How can i disable this.
If you would like not to scroll the page, set Scaffold's resizeToAvoidBottomInset property to false. It will avoid any effect that pops up from the keyboard. But it comes with a caveat If your TextField is placed within the height of keyboard, whatever user types will not be able to see. Try this if it works for you.
you can use singlechildscrollview or listview widget. They will make it scroll.
and you can use MediaQuery.of(context).viewInsets.bottom for padding or margin. Get keyboard height in Flutter.
I am working on Floating Action Bar on top of keyboard if user clicks on one of the EditText. I couldn't start on it and that's why not have any code to present.
I am confused on how to approach this problem. I am considering to use bottom sheet but I am still not getting confidence on it (I think android should have something better to use as base for this view).
I don't need any code snippet but need a direction. I am new to Android and before jumping to implementation, I needed a direction to start with.
Any suggestions? I am implementing
something similar to Outlook app.
So this floating toolbar is just a view that contains icons to press. This view should be located as the bottommost view on the screen. If you're using a ConstraintLayout use app:layout_constraintBottom_toBottomOf="parent".
And the android:windowSoftInputMode for hosting activity can be set to adjustResize (doc).
So when the keyboard opens it pushes this bottommost view up (and now this view is right above the keyboard).
I have an activity with BottomNavigation. If the user needs to click on the submit button soft keyboard hides it. Then he again needs to press the back button to see the submit button. In this case, I used windowSoftInputMode='adjustResize' so that the screen gets resized automatically and the user can scroll up and click on the submit button.
But, I have BottomNavigation too, windowSoftInputMode='adjustResize' makes BottomNavigation float above the soft keyboard. Can anyone suggest a better solution? Any help will be appreciated. Thanks
Thats tricky issue... You have two options in here:
Keep 'adjustResize' and hide BottomNavigation view when keyboard pops up (e.g. simply setVisiblity?)
Change to e.g. 'adjustPan' (or any other) preventing keyboard resizing app and add bottom padding with height of keyboard for whole content container. BottomNavigation will stay hidden under keyboard, but padding will allow scrolling to Submit button
In both cases you need to detect open/close keyboard, in second case you will also need keyboard height measuring. IN HERE and HERE you have big SO topics about this case, check out answers and comments, and pick proper resolution for your purposes
I use a Modal Bottom Sheet to allow the user to enter some text and create Decisions or Tasks.
Some users want to close the keyboard and they tap outside of the Bottom Sheet and close it. This is a big issue because all the text is lost.
The material design documentation states that it can be dismissed when the outside is touched but this doesn't work for me.
I want to intercept the onOutsideClick event and check the keyboard's state:
Keyboard shown: Close the soft keyboard
Keyboard hidden: Dismiss the Bottom Sheet
Should I use a custom BottomSheetBehavior or can I Override some dialog methods?
I use the Android Studio Navigation Drawer Project with one MainActivity and multiple Fragments which are replacing the container inside my MainActivity.
Sometimes when I open my software keyboard the Floating action button appears above the keyboard and sometimes the keyboard covers the fab. Does somebody know why?
It seems that somehow/sometimes your layout is not correctly changed. You should try to use android:windowSoftInputMode="adjustResize" in your activity tag in the manifest.
That should resize the content to the size above the keyboard and therefore the FAB should be always above.
From a UX point of view: Maybe you change the "submit" functionality and move it from a FAB to the toolbar (like the gmail app does). So FAB for a "new" or "add" functionality and as soon as the user can provide input, you show a "send"/"submit" button in the toolbar.