fix currency selection

This commit is contained in:
nikitateplyakov
2018-12-26 19:43:11 +08:00
parent 60ce0b400e
commit 57d33cc943
3 changed files with 10 additions and 9 deletions

View File

@@ -29,7 +29,7 @@ abstract class SettingsBaseState<T extends StatefulWidget> extends BaseState<T>
List<String> getOptions();
void saveOption();
void saveOption(int index);
void getSelectedValue();
@@ -42,9 +42,10 @@ abstract class SettingsBaseState<T extends StatefulWidget> extends BaseState<T>
return new Container(
height: 56.0,
child: (new FlatButton(onPressed: () {
final int index = getOptions().indexOf(option);
saveOption(index);
setState(() {
saveOption();
selectedItem = getOptions().indexOf(option);
selectedItem = index;
});
},
child: new Row(children: <Widget>[

View File

@@ -53,7 +53,7 @@ class _CurrenciesState extends SettingsBaseState<CurrenciesScreen> {
}
@override
saveOption() async {
await helper.saveCurrency(currencies[selectedItem]);
saveOption(int index) async {
await helper.saveCurrency(currencies[index]);
}
}
}

View File

@@ -38,9 +38,9 @@ class LanguagesState extends SettingsBaseState<LanguagesScreen> {
}
@override
saveOption() async {
await helper.saveLocale(languages[selectedItem]);
await StringsLocalization.load(languages[selectedItem]);
saveOption(int index) async {
await helper.saveLocale(languages[index]);
await StringsLocalization.load(languages[index]);
}
@override