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

Update RadioButton & setState #26

Closed
Hauraky opened this issue Sep 6, 2019 · 4 comments
Closed

Update RadioButton & setState #26

Hauraky opened this issue Sep 6, 2019 · 4 comments

Comments

@Hauraky
Copy link

Hauraky commented Sep 6, 2019

I am trying to set a RadioList inside alert, I use the setState() to update alert how below reported.

How can I update the alert?

My Code:
Column(
children: [
new RadioListTile(
title: new Text('Accessibile'),
value: 1,
groupValue: radioValue,
onChanged: handleRadioValueChange),
new othersRadioList ..... ,
],
),

void handleRadioValueChange(int value) {
print(value);
setState(() {
radioValue = value;

});

}

@byteslaves
Copy link

心累,我也遇到这个问题了

@byteslaves
Copy link

解决了。基础不好坑死了!!!
参考:https://www.jianshu.com/p/8f81c98f08dd

@robcunha
Copy link

I wrapped the contet property of Alert in a StatefulBuilder widget.
This widget has a method StateSetter that i called _setState. I passed that method to the RadioListTile. So, is jus call _setState((){
});
instead
setState((){
});
Therefore, the content of alert will be updated and the radiobox, checked!

@ibrahimdevs
Copy link
Contributor

@Hauraky you can check #47 , it works.

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

4 participants