I want to show an floating notification widget on the entire widgets of the application (on the top of MaterialApp widget).
So i find two possible way to do that :
wrap MaterialApp widget with a Stack widget
insert my widget as OverlayEntry (Overlay.of(context).insert(MyNotificationOverlay()))
So i'm confused to choice best option to improve performance of the app for this requirement(showing notificatioin as floating widget entire the app (for example i want to show upload progress with this notification))
Thanks for your help
OverlayEntry creates in top of widgets. but after finish using you will remove it. If you can write your code by Stack use Stack widget.
Overlay is an kind of dynamic stack. Whenever you want to show some widgets at some specific time (like it would be in an stack) we use overlay. Else when we are sure to have some things in form of stack already, we use stack.
The overlayentry use custom stack but the broblem with overlayEntry it rebuild it self when you use some widget outside it like
Pupop menu button and when writing text form feild .
Related
I have developed an application in Flutter Dart and used an Expanded widget in my application but wherever I used expanded widget, it destroyed my UI and converted that List into an infinite list with no data on it.
Please let me know that reason why does this occur and the potential solution.
Thank you everyone in advance
You can use the expanded widget inside the column and row. Sometimes with use of an expanded widget with the wrong widget will give the error in release mode while it is working in the debug mode.
Make sure you are using the expanded widget inside the column or row and that column and row should not be inside the scroll view or other scrollable widgets.
If still not clear then update the question with the widget hierarchy.
I'm in a case I can't use the Stack widget, I wat to put a widget over another widget.
is there any other way than wrapping them in the Stack widget?
share with me your ideas
I was wondering if it's possible to wrap a widget in the widget tree at runtime with another widget?
An example of this would be you a TextField on screen, when I tap on it I wrap a container around it and re-render the widget tree. This is not for in production use and will only be for debug use so no need to worry about the optimisation of the flutter tree.
Any example of this would be highly appreciated.
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)
In my project i have different container widgets that are placed one above the another in a stack layout and i have performed set of canvas drawing on each container widget based on my scenario. My question is "how to refresh or call set state for a particular container widget without rendering all the widgets"?.
Thanks in advance,
Ashwin
You will need transform your "Container" in a custom statefull widget and then make his state management by your needs. Take a look at BLoC pattern here. With this pattern you will be able to update a specific widget in all widget tree without recreate all widgets.