繁体   English   中英

如何在 flutter 和 getxcontroller 中本地化 CupertinoDatePicker

[英]How to localise CupertinoDatePicker in flutter and getxcontroller

在我的搜索过程中,我发现了一些没有包含 GetXcontroller 的常规解决方案,例如https://stackoverflow.com/a/53752290/19815795

以上述为灵感,我为我的 GetMaterialApp 创建了一些代码:

GetMaterialApp(
        theme: AppTheme(),
        translations: Language(),
        locale: getCurrentLocale(),
        fallbackLocale: Locale('en', 'US'),
        supportedLocales: [ // Here I got error, maybe because I am using GetXController
        const Locale('en', 'US'),
        const Locale('de', 'DE'),
        const Locale('fr', 'FR'),
        const Locale('zh', 'CN'),
        const Locale('ar', 'QA'),
        const Locale('es', 'ES'),
          ],
        debugShowCheckedModeBanner: false,
        localizationsDelegates: [
          DefaultCupertinoLocalizationsLocal.delegate, // code from above link
        ],

        home: SettingScreen(),
        );

但是结果,CupertinoPicker 没有识别我的本地语言,仍然使用默认的英语,有谁知道如何在 flutter 和 getxcontroller 中本地化 CupertinoDatePicker,谢谢!

尝试将它们添加到localizationsDelegates

  GlobalMaterialLocalizations.delegate,
  GlobalWidgetsLocalizations.delegate,
  DefaultCupertinoLocalizations.delegate,

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM