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 SettingsTile programatically #18
Comments
Sorry for the very late response. Make sure that you call |
@zanesc can you provide any update? |
closing due to no response. |
@GAM3RG33K I have the same issue, this is the code I have: SettingsGroup(title: "Notifications", children: [
SwitchSettingsTile(
title: "Enable notifications",
settingKey: "notifications_switch",
onChange: (value) async {
await Settings.setValue("notifications_start", value);
await Settings.setValue("notifications_end", value);
setState(() {});
},
childrenIfEnabled: [
CheckboxSettingsTile(
defaultValue: true,
title: "Periods start notifications",
settingKey: "notifications_start",
onChange: (value) async {
if (value) {
enable(forStart: true);
} else {
disable(forStart: true);
if (!Settings.getValue("notifications_end", false)) {
await Settings.setValue("notifications_switch", false);
setState(() {});
}
}
},
),
CheckboxSettingsTile(
title: "Periods end notifications",
settingKey: "notifications_end",
onChange: (value) async {
if (value) {
enable(forStart: false);
} else {
disable(forStart: false);
if (!Settings.getValue("notifications_start", false)) {
await Settings.setValue("notifications_switch", false);
setState(() {});
}
}
},
),
],
),
]) I want the switch tile to be false when both |
@ansshkki if you still have the issue, try wrapping the Container(
key: UniqueKey(),
child: SettingsScreen(...),
) It solved the issue for me, now when |
@msthoma Thank you, that's working! |
Hey, I have built an options screen that has a "Reset to Defaults" option on it but I can't get the SettingsTiles to update after resetting the settings to the defaults by using Settings.setValue(). I have the SettingsContainer inside a ChangeNotifier/Consumer which listens to changes to my cacheProvider. Setting the values triggers an update to the Consumer however the SettingsTiles do not change to the new values.
Is there another way to set the values programatically to update the UI?
The text was updated successfully, but these errors were encountered: