如何在 Flutter 中将系统剪贴板文本(复制、粘贴等)的语言更改为中文?
How to change language of system clipboard text (Copy, Paste etc.,) to Chinese in Flutter?
我试过了,但似乎不起作用:
new MaterialApp(
title: 'Mian',
localizationsDelegates: [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales: [
const Locale('zh','HK')
],
我想把粘贴改成粘贴,Select全部改成选择全部
- 将
flutter_localizations
添加到pubspec.yaml
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
- 将
flutter_localizations
导入 main.dart
import 'package:flutter_localizations/flutter_localizations.dart';
- 使用
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'),
],
);
}
}
我试过了,但似乎不起作用:
new MaterialApp(
title: 'Mian',
localizationsDelegates: [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales: [
const Locale('zh','HK')
],
我想把粘贴改成粘贴,Select全部改成选择全部
- 将
flutter_localizations
添加到pubspec.yaml
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
- 将
flutter_localizations
导入main.dart
import 'package:flutter_localizations/flutter_localizations.dart';
- 使用
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'),
],
);
}
}