BudhabhooshanPatil / flutter_overlay

A widget that will sit on top of the entire application
7 stars 4 forks source link

How to pass a variable from home page to the overlaid widget? #1

Open safal-305 opened 1 year ago

safal-305 commented 1 year ago

This is not an issue, but more of a doubt or clarification. I have a variable that is given a value from inside a function in the homepage class. I want this variable data to be shown inside the overlaid widget. How do I do this? Could you help me please?

BudhabhooshanPatil commented 1 year ago

Hi @safal-305 ,

    Loader.appLoader.showLoader();
    Loader.appLoader.setText(errorMessage: 'data_here');

First line displays the overlay-loader, second line pass the data to loader-view, I'm passing the String as I'm showing Text widget.

In ValueListenableBuilder basically we listen to values and pass the desired values:

                          ValueListenableBuilder<String>(
                            builder: (context, value, child) {
                              return Text(value);
                            },
                            valueListenable:
                                Loader.appLoader.loaderTextNotifier,
                          ),
safal-305 commented 1 year ago

how do i get the variable from inside the function in homepge to there? I'm new to flutter and id like to ask you some questions. Can we chat? :)