Click on TextField rebuild whole UI in flutter - flutter

Click on TextField rebuild whole UI in flutter (When our screen one or more widget depend on Media Query) How I can solve this issue? This strange behavoiur of media query when we click on textfield and keyBoard open media query rebulid one more same page in stack.How I can solve this issue?

Make useInheritedMediaQuer to true.This will help you to solve this issue
MaterialApp(
useInheritedMediaQuery: true,)

This is normal behavior.When you click on TextField and keyboard opens , the viewinsets value changes then your widget rebuild.
Click here!
You can use MediaQuery.of(context) in seperated widget to prevent rebuild your whole widget for better performance.

Related

Screen resizing after keyboard is shown on TextField tap

Widget Tree - https://i.imgur.com/xZjMRm2.png
So I have this widget tree, the TextField in question is inside the column where it shows a RenderFlex error(please ignore the error, it's only there because I animate the column to appear and disappear on button pressed).
The problem is every time I tap on the TextField my screen is pushed up from the bottom as the keyboard is pushing their way through.
To fix this issue I tried to put the Scaffold property resizeToAvoidBottomInset: false, but it did not fix the issue.
Also when I close the keyboard, the background of my screen changes.
If you need code snippets please let me know.
Thank you for your time :)
i need a code snippets, but you can add SingleChildScrollView at the top of the column.
and for when you close the keyboard, the background of your screen changes, my guess for that is when the keyboard opens the screen rebuilds and this will call the build function so if you initialized any variables or anything related to the background change inside the build function it will rebuild or re-initialized.
i do not know if my answer helps but it will be better to share a code snippest, have a great day.

Custom widget dropdown

If I do not click:
When I press the button in the red circle:
Hello, I want to ask. What widget can I use to get a design like this? When the red circle is pressed, another menu will appear and can be pressed to go to another menu. I tried using the dropdown button but it doesn't work as I want. I have also used ListTileTheme and ExpansionTile but it still doesn't work as I want. Anyone can share an opinion.
Flutter's core dropdown widget works almost exactly like your example, and there is a widget that extends it even further. You should then be able to nest further menus if that's what you need it to do. Flutter DropdownButton2

Flutter: Dismissible Widget using button

I would like to have a dismissible widget. So far I've used the Dismissible widget that works well when you want to swipe to dismiss.
Is there a way to dismiss by clicking a button/icon? Something like this.
Have a look at the package another_flushbar. I used the predecessor flushbar which had loads of options. another_flushbar seems to have the same functionality so you might be able to achieve this

How to open second container in Flutter when I click on IconButton?

I added Row widget with rendering on stack widget. I actually want to add more container, but it shows when I click on IconButton. After clicking it does not shows on screen. So how is possible in Flutter ?
Any suggestion?
you could create a stack widget and when the IconButton is pressed you call a function to display the new container( which probably is inside the stack widget you are going to implement)

Flutter TextField focus rebuilds widget if keyboardType changes

Trying to build my first app on Flutter, but ran into a problem. Searched a lot, but everyone is having a bit different problems (keyboard closes, stream calls, etc.)
I try to use BLoC pattern and rxDart to listen and validate fields. Everything works well if all TextFields have same keyboardType, but I have different inputs (number, link, ...) and every time I tap on an input, keyboard is changed and that triggers Widget to rebuild.
Any way to keep my Streams intact of rebuilding a widget on keyboard change?
Edit: Actually the same happens if I use ShowDialog() on that page and close it with Navigator.of(context).pop();. I understand it's a page change and widget gets rebuilt, but how can I keep data in BLoC's streams of that widget?
Or how do I add to sinks my inputs' values after widget is rebuilt?