Flutter:如何将文本字段上的“粘贴”工具提示名称更改为设备的语言

时间:2018-08-30 15:13:56

标签: dart tooltip flutter

当我在文本字段上复制或粘贴时,工具提示始终为英语,而我的设备位于Pt-Br上。我该如何更改或修复该问题?

1 个答案:

答案 0 :(得分:2)

将flutter_localizations添加到您的pubspec.yaml:

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter

在您的MaterialApp中:

return MaterialApp(
  ...
  locale: const Locale('de'), // change to locale you want. not all locales are supported
  localizationsDelegates: [
    GlobalMaterialLocalizations.delegate,
    GlobalWidgetsLocalizations.delegate,
  ],
);