Copy values from android resources to flutter assets
This commit is contained in:
@@ -1,60 +0,0 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/white"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="24dp"
|
||||
android:layout_marginRight="24dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:gravity="center_vertical|left"
|
||||
android:text="@string/logout_title"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="24dp"
|
||||
android:layout_marginRight="24dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:fontFamily="sans-serif-light"
|
||||
android:scaleType="center"
|
||||
android:text="@string/logout_text"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/positiveButton"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="42dp"
|
||||
android:layout_gravity="right|end"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:scaleType="center"
|
||||
android:text="@string/logout_yes"
|
||||
android:textColor="#eb0004"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/negativeButton"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="42dp"
|
||||
android:layout_gravity="right|end"
|
||||
android:layout_marginRight="64dp"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:text="@string/logout_no"
|
||||
android:textColor="#eb0004"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
12
assets/values-ru/strings.xml
Normal file
12
assets/values-ru/strings.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<resources>
|
||||
<string name="app_name">Dinect</string>
|
||||
<string name="scanner_title">Сканер карты</string>
|
||||
<string name="scan">Сканировать</string>
|
||||
<string name="faq">Справка</string>
|
||||
<string name="exit">Закрыть приложение</string>
|
||||
<string name="settings">Настройки</string>
|
||||
<string name="identifier_not_found">"Идентификатор %s не найден"</string>
|
||||
<string name="enter_manual">Введите номер карты</string>
|
||||
<string name="enter_phone">Телефон 79XXXXXXXXX</string>
|
||||
<string name="error_contact_support">Можете воспользоваться ручным вводом или позвонить на номер:%s</string>
|
||||
</resources>
|
||||
12
assets/values-ua/strings.xml
Normal file
12
assets/values-ua/strings.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<resources>
|
||||
<string name="app_name">Dinect</string>
|
||||
<string name="scanner_title">Сканер карти</string>
|
||||
<string name="scan">Сканувати</string>
|
||||
<string name="faq">Допомога</string>
|
||||
<string name="exit">Закрыть приложение</string>
|
||||
<string name="settings">Налаштування</string>
|
||||
<string name="identifier_not_found">"Ідентифікатор %s не знайден"</string>
|
||||
<string name="enter_manual">Введіть штрихкод вручну</string>
|
||||
<string name="enter_phone">Телефон 79XXXXXXXXX</string>
|
||||
<string name="error_contact_support">Можете скористатися ручним введенням або зателефонувати на номер:\n%s</string>
|
||||
</resources>
|
||||
@@ -4,7 +4,6 @@
|
||||
.svn/
|
||||
|
||||
.DS_Store
|
||||
*.swp
|
||||
profile
|
||||
|
||||
DerivedData/
|
||||
@@ -12,22 +11,12 @@ build/
|
||||
GeneratedPluginRegistrant.h
|
||||
GeneratedPluginRegistrant.m
|
||||
|
||||
*.pbxuser
|
||||
*.mode1v3
|
||||
*.mode2v3
|
||||
*.perspectivev3
|
||||
|
||||
!default.pbxuser
|
||||
!default.mode1v3
|
||||
!default.mode2v3
|
||||
!default.perspectivev3
|
||||
|
||||
xcuserdata
|
||||
|
||||
*.moved-aside
|
||||
|
||||
*.pyc
|
||||
*sync/
|
||||
Icon?
|
||||
.tags*
|
||||
|
||||
@@ -11,8 +11,10 @@ import 'package:checker/screens/finish_registration.dart';
|
||||
import 'package:checker/screens/registration.dart';
|
||||
import 'package:checker/strings.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:xml/xml.dart' as xml;
|
||||
|
||||
class SplashScreen extends StatefulWidget {
|
||||
@override
|
||||
@@ -53,6 +55,11 @@ class _SplashScreenState extends BaseState<SplashScreen> {
|
||||
helper.getSettings(false).then((settings) {
|
||||
if (settings == null) {
|
||||
createSettingsTable(locale);
|
||||
getTranslates(locale).then((strings) {
|
||||
// platform.invokeMethod('pushTranslates').then((locale) {
|
||||
//
|
||||
// });
|
||||
});
|
||||
} else {
|
||||
initLocale(locale, () {
|
||||
showNext();
|
||||
@@ -62,6 +69,21 @@ class _SplashScreenState extends BaseState<SplashScreen> {
|
||||
});
|
||||
}
|
||||
|
||||
Future<Map> getTranslates(String locale) async {
|
||||
String strings = await loadAsset(locale);
|
||||
var document = xml.parse(strings);
|
||||
Map results = new Map<String, String>();
|
||||
document.findAllElements('string').forEach((node) {
|
||||
print(node.name.toString() + node.text.toString());
|
||||
results[node.name.toString()] = node.text.toString();
|
||||
});
|
||||
return results;
|
||||
}
|
||||
|
||||
Future<String> loadAsset(String locale) async {
|
||||
return await rootBundle.loadString('assets/values-$locale/strings.xml');
|
||||
}
|
||||
|
||||
void initWithSavedValue(String locale) {
|
||||
initLocale(locale, () {
|
||||
showNext();
|
||||
|
||||
309
pubspec.lock
Normal file
309
pubspec.lock
Normal file
@@ -0,0 +1,309 @@
|
||||
# Generated by pub
|
||||
# See http://pub.dartlang.org/doc/glossary.html#lockfile
|
||||
packages:
|
||||
analyzer:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: analyzer
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.30.0+4"
|
||||
args:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: args
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.13.7"
|
||||
async:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.3"
|
||||
barback:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: barback
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.15.2+14"
|
||||
charcode:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: charcode
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
cli_util:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: cli_util
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.2+1"
|
||||
collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: collection
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.14.5"
|
||||
convert:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: convert
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
crypto:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: crypto
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.2+1"
|
||||
csslib:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: csslib
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.14.1"
|
||||
dart_style:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: dart_style
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.9+1"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
front_end:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: front_end
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.0-alpha.4.1"
|
||||
glob:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: glob
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.5"
|
||||
html:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: html
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.13.2+2"
|
||||
http:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: http
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.11.3+16"
|
||||
http_parser:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: http_parser
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.1.1"
|
||||
image_picker:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: image_picker
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.5"
|
||||
intl:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: intl
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.15.2"
|
||||
intl_translation:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: intl_translation
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.15.0"
|
||||
isolate:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: isolate
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
kernel:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: kernel
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.3.0-alpha.1.1"
|
||||
logging:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: logging
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.11.3+1"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: matcher
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.12.1+4"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: meta
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
package_config:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: package_config
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.3"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.5.1"
|
||||
path_provider:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: path_provider
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.2"
|
||||
petitparser:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: petitparser
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.7.0"
|
||||
plugin:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: plugin
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.0+2"
|
||||
pool:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pool
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.4"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.99"
|
||||
source_span:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: source_span
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.4.0"
|
||||
sprintf:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: sprintf
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.2"
|
||||
sqflite:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: sqflite
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.6.2+1"
|
||||
stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stack_trace
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.9.1"
|
||||
string_scanner:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: string_scanner
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
synchronized:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: synchronized
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: typed_data
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.4"
|
||||
utf:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: utf
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.9.0+3"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vector_math
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.5"
|
||||
watcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: watcher
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.9.7+6"
|
||||
xml:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: xml
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.6.0"
|
||||
yaml:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: yaml
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.13"
|
||||
sdks:
|
||||
dart: ">=2.0.0-dev.15.0 <=2.0.0-dev.19.0"
|
||||
@@ -9,6 +9,7 @@ dependencies:
|
||||
path_provider: "^0.2.1+1"
|
||||
sqflite: any
|
||||
image_picker: '^0.1.3' # use for ask permissions @ iOS
|
||||
xml: "^2.6.0"
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
@@ -46,6 +47,8 @@ flutter:
|
||||
- assets/powered_by_dinect_splash.png
|
||||
- assets/powered_by_dinect.png
|
||||
- assets/splash_text.png
|
||||
- assets/values-ru/strings.xml
|
||||
- assets/values-ua/strings.xml
|
||||
|
||||
# To add assets from package dependencies, first ensure the asset
|
||||
# is in the lib/ directory of the dependency. Then,
|
||||
|
||||
Reference in New Issue
Block a user