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 { List currencies = const [643, 840, 980, 978, 398, 933, 860, 944]; _CurrenciesState(SqliteHelper helper, String app) : super(helper, app); bool isAutomaticallyImplyLeading() => true; @override List 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(); String uzbsum = StringsLocalization.uzbsum(); String azbman = StringsLocalization.azbman(); return [ruble, dollar, hryvna, euro, tenge, belrub, uzbsum, azbman]; } @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]); } }