mirror of
https://github.com/asjqkkkk/flutter-todos.git
synced 2025-08-26 14:06:29 +08:00
准备开始添加国际化
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:todo_list/pages/main_page.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
|
||||
void main(){
|
||||
SystemChrome.setPreferredOrientations([
|
||||
@ -16,6 +17,22 @@ class MyApp extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'ToDo List',
|
||||
localizationsDelegates: [
|
||||
// ... app-specific localization delegate[s] here
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: [
|
||||
const Locale('en', 'US'), // 美国英语
|
||||
const Locale('zh', 'CN'), // 中文简体
|
||||
],
|
||||
localeResolutionCallback: (Locale locale, Iterable<Locale> supportedLocales){
|
||||
},
|
||||
localeListResolutionCallback: (List<Locale> locales, Iterable<Locale> supportedLocales){
|
||||
debugPrint("locales:${locales} supportedLocales${supportedLocales} ");
|
||||
|
||||
},
|
||||
locale: Locale('en', 'US'),
|
||||
theme: ThemeData(
|
||||
primaryColor: Color.fromRGBO(246,200,200,1),
|
||||
primaryColorDark: Color.fromRGBO(255,180,180,1),
|
||||
|
Reference in New Issue
Block a user