fix currency selection
This commit is contained in:
@@ -29,7 +29,7 @@ abstract class SettingsBaseState<T extends StatefulWidget> extends BaseState<T>
|
|||||||
|
|
||||||
List<String> getOptions();
|
List<String> getOptions();
|
||||||
|
|
||||||
void saveOption();
|
void saveOption(int index);
|
||||||
|
|
||||||
void getSelectedValue();
|
void getSelectedValue();
|
||||||
|
|
||||||
@@ -42,9 +42,10 @@ abstract class SettingsBaseState<T extends StatefulWidget> extends BaseState<T>
|
|||||||
return new Container(
|
return new Container(
|
||||||
height: 56.0,
|
height: 56.0,
|
||||||
child: (new FlatButton(onPressed: () {
|
child: (new FlatButton(onPressed: () {
|
||||||
|
final int index = getOptions().indexOf(option);
|
||||||
|
saveOption(index);
|
||||||
setState(() {
|
setState(() {
|
||||||
saveOption();
|
selectedItem = index;
|
||||||
selectedItem = getOptions().indexOf(option);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: new Row(children: <Widget>[
|
child: new Row(children: <Widget>[
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class _CurrenciesState extends SettingsBaseState<CurrenciesScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
saveOption() async {
|
saveOption(int index) async {
|
||||||
await helper.saveCurrency(currencies[selectedItem]);
|
await helper.saveCurrency(currencies[index]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,9 +38,9 @@ class LanguagesState extends SettingsBaseState<LanguagesScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
saveOption() async {
|
saveOption(int index) async {
|
||||||
await helper.saveLocale(languages[selectedItem]);
|
await helper.saveLocale(languages[index]);
|
||||||
await StringsLocalization.load(languages[selectedItem]);
|
await StringsLocalization.load(languages[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
Reference in New Issue
Block a user