Локаль можно задать на этапе сборки
This commit is contained in:
@@ -2,8 +2,23 @@ import 'package:flutter/material.dart';
|
||||
import 'splash.dart';
|
||||
import 'consts.dart';
|
||||
import 'strings.dart';
|
||||
import 'common.dart';
|
||||
import 'dart:async';
|
||||
|
||||
class StringsLocalizationDelegate extends LocalizationsDelegate<StringsLocalization> {
|
||||
|
||||
@override
|
||||
Future<StringsLocalization> load(Locale locale) async {
|
||||
return StringsLocalization.load(await platform.invokeMethod("getLocale"));
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldReload(LocalizationsDelegate<StringsLocalization> old) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// Точка входа в приложение.
|
||||
void main() {
|
||||
runApp(new Checker());
|
||||
@@ -18,7 +33,12 @@ class CheckerState extends State<Checker> {
|
||||
@override Widget build(BuildContext context) {
|
||||
return new MaterialApp(
|
||||
title: appName,
|
||||
home: new SplashScreen()
|
||||
home: new SplashScreen(),
|
||||
localizationsDelegates: getLocalizationsDelegate()
|
||||
);
|
||||
}
|
||||
|
||||
getLocalizationsDelegate() {
|
||||
return <StringsLocalizationDelegate>[new StringsLocalizationDelegate()];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user