2

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 :

  1. wrap MaterialApp widget with a Stack widget
  2. 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

Taleb
  • 1,944
  • 2
  • 11
  • 36

3 Answers3

3

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.

Vinay Jain
  • 398
  • 2
  • 6
2

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.

Ash Khachatryan
  • 427
  • 1
  • 5
  • 18
0

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 .

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 17 '22 at 16:48