This commit is contained in:
Ivan Murashov
2018-03-10 02:41:53 +03:00
parent bd1e0ec17f
commit 60f506a08d
6 changed files with 31 additions and 35 deletions

View File

@@ -30,52 +30,43 @@ main() {
}
initWithSystemValue(String app, String name, SqliteHelper helper) {
platform.invokeMethod('getLocale').then((locale) {
helper.getSettings(false).then((settings) {
if (settings == null) {
createSettingsTable(app, name, locale, helper);
} else {
start(app, name, locale, helper);
}
});
helper.getSettings(false).then((settings) {
if (settings == null) {
createSettingsTable(app, name, helper);
} else {
start(app, name, locale, helper);
}
});
}
createSettingsTable(String app, String name, String locale, SqliteHelper helper) {
platform.invokeMethod('getCurrency').then((currency) {
helper.createAppInfo(currency).then(() {
start(app, name, locale, helper);
createSettingsTable(String app, String name, SqliteHelper helper) {
platform.invokeMethod('getLocale').then((locale) {
platform.invokeMethod('getCurrency').then((currency) {
helper.createAppInfo(currency, locale).then((_) {
start(app, name, locale, helper);
});
});
});
}
start(String app, String name, String locale, SqliteHelper helper) {
StringsLocalization.load(locale).then((_) {
runApp(new Checker(app, name, locale, helper));
runApp(new Checker(app, name, helper));
});
}
class Checker extends StatefulWidget {
/// Класс для работы с бд
final SqliteHelper helper;
/// Тип сборки. Определяет, какие брать ресурсы (цвета, картинки)
final String app;
/// Отображаемое в заголовке приложения названия (когда показывается список запущенных приложений)
final String appName;
/// Локаль приложения
final String locale;
Checker(this.app, this.appName, this.locale, this.helper);
Checker(this.app, this.appName, this.helper);
@override
State<StatefulWidget> createState() => new CheckerState(
this.app,
this.appName,
this.locale,
this.helper);
}
@@ -84,11 +75,8 @@ class CheckerState extends State<Checker> {
SqliteHelper helper;
String app;
String appName;
String locale;
String token;
CheckerState(this.app, this.appName, this.locale, this.helper);
CheckerState(this.app, this.appName, this.helper);
@override
Widget build(BuildContext context) {