Remove i18n package. Add xml files with strings to flutter assets. Create method for passing localized strings to channel.

This commit is contained in:
Ivan Murashov
2018-02-07 00:28:47 +03:00
parent 8c4287a21b
commit c15108fda9
40 changed files with 600 additions and 930 deletions

View File

@@ -4,7 +4,8 @@ import 'package:checker/db.dart';
import 'package:checker/strings.dart';
import 'package:flutter/material.dart';
abstract class SettingsBaseState<T extends StatefulWidget> extends BaseState<T> {
abstract class SettingsBaseState<T extends StatefulWidget>
extends BaseState<T> {
SettingsBaseState(SqliteHelper helper, String app) {
this.helper = helper;
@@ -15,7 +16,7 @@ abstract class SettingsBaseState<T extends StatefulWidget> extends BaseState<T>
@override Widget build(BuildContext context) {
return new Scaffold(appBar: getAppBar(),
body: getScreenContent());
body: getScreenContent());
}
@override
@@ -43,26 +44,27 @@ abstract class SettingsBaseState<T extends StatefulWidget> extends BaseState<T>
Widget getItem(String option) {
return new Container(
height: 56.0,
child: (new FlatButton(onPressed: () {
height: 56.0,
child: (new FlatButton(onPressed: () {
setState(() {
saveOption();
setState(() {
selectedItem = getOptions().indexOf(option);
});
},
child: new Row(children: <Widget>[
new Expanded(child: new Text(option)),
getCheckMark(getOptions().indexOf(option))]))));
selectedItem = getOptions().indexOf(option);
});
},
child: new Row(children: <Widget>[
new Expanded(child: new Text(option)),
getCheckMark(getOptions().indexOf(option))
]))));
}
Widget getCheckMark(int index) {
return index == selectedItem ? new Image.asset(check_png,
width: 28.0,
height: 28.0) : new Image.asset(check_png, color: new Color(0xffffff));
width: 28.0,
height: 28.0) : new Image.asset(check_png, color: new Color(0xffffff));
}
@override
String getTitle() {
return StringsLocalization.settings();
}
}
}