gpt4 book ai didi

flutter - 如何在 Flutter 中将系统剪贴板文本(复制、粘贴等)的语言更改为中文?

转载 作者:IT王子 更新时间:2023-10-29 07:06:05 49 4
gpt4 key购买 nike

我试过了,但似乎不起作用:

new MaterialApp(
title: 'Mian',
localizationsDelegates: [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales: [
const Locale('zh','HK')
],

我想把粘贴改成粘贴,全选改成选全部

enter image description here

最佳答案

  1. flutter_localizations添加到pubspec.yaml
dependencies:
flutter:
sdk: flutter

flutter_localizations:
sdk: flutter
  1. 导入 flutter_localizationsmain.dart
import 'package:flutter_localizations/flutter_localizations.dart';
  1. 使用supportedLocales
class App extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Flutter',
home: new HomePage(title: ''),
localizationsDelegates: [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
DefaultCupertinoLocalizations.delegate
],
supportedLocales: [
const Locale('zh','CH'),
],
);
}
}

关于flutter - 如何在 Flutter 中将系统剪贴板文本(复制、粘贴等)的语言更改为中文?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52536523/

49 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com