flutter 时间控件显示中文

1、添加国际化:

flutter_localizations:

2、导包:在app入口

import 'package:flutter_localizations/flutter_localizations.dart'; 

3、设置

void main() {
  runApp(
    new MaterialApp(
      title: 'app',
      theme: new ThemeData(
        primaryColor: Colors.white,
      ),
      home: new MyLoginWidget(),
      localizationsDelegates: [
        //此处
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
      ],
      supportedLocales: [
        //此处
        const Locale('zh', 'CH'),
        const Locale('en', 'US'),
      ],
    ),
  );
}

要显示中文的控件设置:

 

locale: Locale('zh'),

你可能感兴趣的:(flutter,flutter爬坑之路)