Make a App wide progress bar (Across the pages of whole app) and manage its state as required in Flutter using provider - flutter

Im trying to make a Custom Progress Indicator widget which i can show or hide in any of the pages(Anywhere across the app). My approach is to bind a provider value for the progress widget and toggle the value as required. But I just don't get where exactly i should place the Progress/loader widget to make it work in whole App.
Or should i resort to using progress widget in each of the required pages and toggle it?
I'm coming from a web development background, so is there a equivalent of rootPage/ rootscreen where we can place app wide components (as in React, Ionic).

Related

Refresh a widget programmatically

I'm developing an app in Flutter, and I'm stuck with this: I have a list of widgets that I generate dynamically. When I press a button, I need to show or hide one of the widgets in the list. I use the Visible widget to show or hide them.
The problem is that I need to know how to update any of the specific widgets in my widget list as they are dynamic and are separated, it is getting complicated doing int programmatically.
How can I do it?
PS: I have the same app developed in Android Studio and I do it by traversing for example the child Views of a LinearLayout and then I ask for its id programmatically.

Is there a widget on flutter that can pop up above bottom navigation, with gradient background?

I inherited a project in flutter and I need to create or use a widget that will allow me to display information throughout the entire app. The graphic design that I want to follow has a background with a gradient of colors.
My question is, is there any widget that can appear just above a browser menu at the bottom of the application, that can comply with this type of design?
I have tried with snackbar but I have not found a way to put the gradient background and I tried with flushbar but when it opens (and allows the user to close it) it does not allow navigation.
I've tried "getx" but it does not go well with the rest of the app, because its an already big application with materialApp.
I'm expecting something that can act as a snackbar but have gradient background.

Flutter: Change location injection in widget tree of DropDownMenuItem

I am using a DropdownButton in a Flutter app, and when you click it and the drop down appears, it overlays a webview that I'm using.
That all works perfectly, however webviews in Flutter, when run as a web app (which this is) trap all UI interactions and don't allow clicks to flow through to the Flutter UI elements.
There is a PointerInterceptor component that handles this perfectly, all I need to be able to do is wrap all of the DropdownMenuItems that appear inside of a single pointer interceptor (because if I individually wrap them then there is a really bad performance hit).
However - the DropdownMenuItems appear in the widget tree directly under the MaterialApp widget - and that is too high in the tree for me to wrap in a PointerInterceptor.
That is the reason that I want to know :
Is it possible to specify where in the widget tree the DropdownMenuItem widgets' appear when a DropdownMenuButton is clicked ?

How to check visibility of a Flutter widget even when covered by another

I'm trying to find a way to check the visibility of a Flutter widget when it's either off screen or when it's obscured by another, for example Drawer, Dialog or BottomSheet.
visibility_detector helps with checking whether it's on the screen or not but does not work with the second use case (known limitation).
Is there a lower lever api that I can use to check whether a widget is actually visible to the user?
My use case: I'm adding a widget to the Overlay when something external happens (similar to Tooltip but not on long press). If the user opens for example the Drawer, the widget will appear on top. I want to detect that the child is not visible and delay or cancel the action.
Do I understand your problem?
You have a widget you want to always be on top?
You want the user to interact with that widget first before doing other things?
Use design patterns to make coding easier, your users will thank you.
You can show a Dialog on-top of other widgets with the showGeneralDialog or showDialog functions. Because Dialogs are a design-pattern used in many apps, users will already know how to use them.
Define app behavior with explicit state.
It is too hard to derive app behavior from rendered UI, not all devices are the same size and shape. This means you should try to write a variable that describes your situation and then write the code you need to make that variable's value correct. It sounds like you want a variable like bool overlayIsShowing.

Flutter Webview reloads every time I switch screen

I'm making an app with a BottomNavigationBar with 5 different screens, each of them has a web view. The problem is that everytime I come back to a screen that was previously loaded, it reloads. I have tried using AutomaticKeepAliveClient from copy pasting this code but I doesn't seem to work. I'm new with Flutter so be precise please, thank you.
AutomaticKeepAliveClient is mainly used for keeping a child alive in lazily rendered list views. In your case whenever you switch tabs your current page get disposed and new page materializes on top of it, that means each time when you switch tab a new page is created including all it's widgets.
So if you want to keep your previously loaded web views alive, you have to go with either PageView widget or use Stack widget to load your pages programmatically while the user clicks on a tab.
This is a detailed example about implementing your requirement using PageView widget . you can also find an example with Stack widget under that question.