Files
checker/lib/screens/currencies.dart
2018-04-11 15:53:02 +07:00

53 lines
1.4 KiB
Dart

import 'package:checker/base/base_screen.dart';
import 'package:checker/base/settings_base_state.dart';
import 'package:checker/db.dart';
import 'package:flutter/material.dart';
import 'package:checker/strings.dart';
class CurrenciesScreen extends BaseScreen {
CurrenciesScreen(helper, app) : super(helper, app);
@override State createState() => new _CurrenciesState(helper, app);
}
class _CurrenciesState extends SettingsBaseState<CurrenciesScreen> {
List<int> currencies = const [643, 840, 980, 978, 398, 933];
_CurrenciesState(SqliteHelper helper, String app) : super(helper, app);
bool isAutomaticallyImplyLeading() => true;
@override
List<String> getOptions() {
String ruble = StringsLocalization.rfruble();
String dollar = StringsLocalization.usadollas();
String hryvna = StringsLocalization.ukhryvnia();
String euro = StringsLocalization.euro();
String tenge = StringsLocalization.kztenge();
String belrub = StringsLocalization.beruble();
return [ruble, dollar, hryvna, euro, tenge, belrub];
}
@override
void getSelectedValue() {
helper.getCurrency().then((currency) {
setState(() {
selectedItem = currencies.indexOf(currency);
});
});
}
@override
String getTitle() {
return StringsLocalization.settings();
}
@override
saveOption() async {
await helper.saveCurrency(currencies[selectedItem]);
}
}