Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Get dialougue with return #14

Closed
Raviteja11122 opened this issue Feb 13, 2020 · 5 comments
Closed

[Feature request] Get dialougue with return #14

Raviteja11122 opened this issue Feb 13, 2020 · 5 comments

Comments

@Raviteja11122
Copy link

Raviteja11122 commented Feb 13, 2020

@jonataslaw
Can I do this same like this using any widget of get.defaultdialogue, get.snackbar or getBar

               bool shouldUpdate = await showDialog(
                  context: this.context,
                  child:new AlertDialog(
                    content: new FlatButton(
                      child: new Text("update home"),
                      onPressed: () => Navigator.pop(context, true),
                    ),
                  ),
                );
                setState(() {
                  shouldUpdate ? this._homeData = "updated" : null;
                });
@jonataslaw
Copy link
Owner

@jonataslaw
Can I do this same like this using any widget of get.defaultdialogue, get.snackbar or getBar

           bool shouldUpdate = await showDialog(
              context: this.context,
              child:new AlertDialog(
                content: new FlatButton(
                  child: new Text("update home"),
                  onPressed: () => Navigator.pop(context, true),
                ),
              ),
            );
            setState(() {
              shouldUpdate ? this._homeData = "updated" : null;
            });

Hi, I didn't quite understand what you meant.
Dialogs, snackbars and bottomsheets can get a return as long as you use them appropriately:

     var shouldUpdate = await Get.dialog(
            AlertDialog(
              content: new FlatButton(
                child: new Text("update home"),
                onPressed: () => Get.back(result: 'myReturnData'),
              ),
            ),
          );
          print(shouldUpdate);

Restarted application in 6.470ms.
I/flutter ( 3007): myReturnData

@jonataslaw
Copy link
Owner

If you have any other questions, or errors, don't hesitate to open another issue. Closing this.

@Raviteja11122
Copy link
Author

OK. thanks
I tried with GetBar widget it does not return value instead it uses callback for returning.

@liugangnhm
Copy link

@Raviteja11122 any solution? dialog return always null

@Raviteja11122
Copy link
Author

@liugangnhm
use like this Get.back(result: result); in get.dialog you will get result value

jonataslaw pushed a commit that referenced this issue Nov 9, 2020
kamazoun added a commit to kamazoundevz/getx that referenced this issue Jan 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants