52 lines
1.2 KiB
Dart
52 lines
1.2 KiB
Dart
import 'package:checker/base/settings_base_state.dart';
|
|
import 'package:checker/db.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:checker/strings.dart';
|
|
import 'package:checker/common.dart';
|
|
|
|
class CurrenciesScreen extends StatefulWidget {
|
|
|
|
final SqliteHelper helper;
|
|
final String app;
|
|
|
|
CurrenciesScreen(this.helper, this.app);
|
|
|
|
@override State createState() => new _CurrenciesState(helper, app);
|
|
}
|
|
|
|
class _CurrenciesState extends SettingsBaseState<CurrenciesScreen> {
|
|
|
|
List<int> currencies = const [643, 840, 980];
|
|
|
|
_CurrenciesState(SqliteHelper helper, String app) : super(helper, app);
|
|
|
|
|
|
@override
|
|
List<String> getOptions() {
|
|
|
|
String ruble = StringsLocalization.ruble();
|
|
String dollar = StringsLocalization.dollar();
|
|
String hryvna = StringsLocalization.hryvna();
|
|
|
|
return [ruble, dollar, hryvna];
|
|
}
|
|
|
|
@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]);
|
|
}
|
|
} |