Продолжаю разбираться с локализацией
This commit is contained in:
@@ -3,29 +3,22 @@ import 'splash.dart';
|
||||
import 'consts.dart';
|
||||
import 'strings.dart';
|
||||
import 'dart:async';
|
||||
import 'i18n/messages_all.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
Future<LocaleQueryData> _onLocaleChanged(Locale locale) async {
|
||||
final String localeString = locale.toString();
|
||||
await initializeMessages(localeString);
|
||||
Intl.defaultLocale = localeString;
|
||||
return Strings.instance;
|
||||
}
|
||||
|
||||
/// Точка входа в приложение.
|
||||
void main() {
|
||||
runApp(new Checker());
|
||||
}
|
||||
|
||||
class Checker extends StatelessWidget {
|
||||
class Checker extends StatefulWidget {
|
||||
@override CheckerState createState() => new CheckerState();
|
||||
}
|
||||
|
||||
class CheckerState extends State<Checker> {
|
||||
|
||||
@override Widget build(BuildContext context) {
|
||||
return new MaterialApp(title: appName,
|
||||
home: new SplashScreen(),
|
||||
onLocaleChanged: _onLocaleChanged,
|
||||
theme: new ThemeData(
|
||||
primaryColor: primaryColor,
|
||||
accentColor: primaryColor
|
||||
));
|
||||
return new MaterialApp(
|
||||
title: appName,
|
||||
home: new SplashScreen()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user