6038901099
用户 Linux 桌面实测反馈「日期选择器全英文」。根因是 MaterialApp 从一迭代
建起就没配 localizationsDelegates/supportedLocales/locale,pubspec 也没有
flutter_localizations;Flutter 在缺 delegate 时静默回退内置的
DefaultMaterialLocalizations(只有英文),于是业务自绘文案全中文、Material
内置组件全英文,同一弹窗里中英混排:
Select date → 选择日期
OK / Cancel → 确定 / 取消
Enter Date → 输入日期
Switch to input → 切换到输入模式
Invalid format. / Out of range. → 格式无效。/ 超出范围。
mm/dd/yyyy → yyyy/mm/dd(zh 顺序年在前)
September 2026 → 2026年9月
处置:
- pubspec 加 flutter_localizations(sdk)与 intl(日期符号底座,显式直接
依赖以锁定与 SDK 一致的版本)。
- 新增 lib/app/app_localization.dart 把 Global{Material,Cupertino,Widgets}
三件套 delegate、supportedLocales、locale 收在一处常量:widget 测试若只
pumpWidget(MaterialApp(home: ...)) 而不挂 delegate,测到的「中文」是假的,
测试直接引用同一份常量,生产与测试不会各配一套而漂移。
- 单语言 zh-CN,不列 en:避免设备语言为英文时回退英文,再造混排。
- pets 域三份 widget 测试的 MaterialApp 同步挂上 delegate,
tap(find.text('OK')) 相应改 '确定'——让测试与生产一致,而不是在英文兜底下测。
新增 test/app/app_localization_test.dart 守住这一行不被回删:断言根
MaterialApp 实际挂上三件套 + locale zh-CN,并从运行期 MaterialLocalizations
取回中文文案。
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
111 lines
4.8 KiB
YAML
111 lines
4.8 KiB
YAML
name: patbond_flutter
|
|
description: "Patbond pet community and health companion."
|
|
# The following line prevents the package from being accidentally published to
|
|
# pub.dev using `flutter pub publish`. This is preferred for private packages.
|
|
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|
|
|
# The following defines the version and build number for your application.
|
|
# A version number is three numbers separated by dots, like 1.2.43
|
|
# followed by an optional build number separated by a +.
|
|
# Both the version and the builder number may be overridden in flutter
|
|
# build by specifying --build-name and --build-number, respectively.
|
|
# In Android, build-name is used as versionName while build-number used as versionCode.
|
|
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
|
|
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
|
|
# Read more about iOS versioning at
|
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
|
# In Windows, build-name is used as the major, minor, and patch parts
|
|
# of the product and file versions while build-number is used as the build suffix.
|
|
version: 1.0.0+1
|
|
|
|
environment:
|
|
sdk: ^3.12.2
|
|
|
|
# Dependencies specify other packages that your package needs in order to work.
|
|
# To automatically upgrade your package dependencies to the latest versions
|
|
# consider running `flutter pub upgrade --major-versions`. Alternatively,
|
|
# dependencies can be manually updated by changing the version numbers below to
|
|
# the latest version available on pub.dev. To see which dependencies have newer
|
|
# versions available, run `flutter pub outdated`.
|
|
dependencies:
|
|
flutter:
|
|
sdk: flutter
|
|
|
|
# The following adds the Cupertino Icons font to your application.
|
|
# Use with the CupertinoIcons class for iOS style icons.
|
|
cupertino_icons: ^1.0.8
|
|
shared_preferences: ^2.5.4
|
|
dio: ^5.11.1
|
|
flutter_secure_storage: ^11.0.0
|
|
uuid: ^4.6.0
|
|
package_info_plus: ^10.2.1
|
|
# T3-13 媒体上传:系统选择器多选(03 号评估 §4.1 选型)。
|
|
image_picker: ^1.2.0
|
|
# T3-13 媒体上传:原生编解码压缩(长边重采样 + JPEG 质量 + EXIF 方向矫正)。
|
|
flutter_image_compress: ^2.4.0
|
|
# M3.5-01 中文本地化:Material/Cupertino/Widgets 内置组件文案(日期选择器
|
|
# 标题、确定/取消、输入模式提示与格式错误)由 Global*Localizations 提供。
|
|
flutter_localizations:
|
|
sdk: flutter
|
|
# flutter_localizations 的日期符号/数字格式底座;显式直接依赖以锁定与 SDK
|
|
# 一致的版本(避免间接依赖升级悄悄改变格式化行为)。
|
|
intl: ^0.20.2
|
|
|
|
dev_dependencies:
|
|
flutter_test:
|
|
sdk: flutter
|
|
# T3-14 compose 真链路桌面实测入口(integration_test/,环境变量门控)。
|
|
integration_test:
|
|
sdk: flutter
|
|
# 定时冲刷/退避测试的假时钟驱动(flutter_test 传递依赖显式声明)。
|
|
fake_async: ^1.3.3
|
|
|
|
# The "flutter_lints" package below contains a set of recommended lints to
|
|
# encourage good coding practices. The lint set provided by the package is
|
|
# activated in the `analysis_options.yaml` file located at the root of your
|
|
# package. See that file for information about deactivating specific lint
|
|
# rules and activating additional ones.
|
|
flutter_lints: ^6.0.0
|
|
|
|
# For information on the generic Dart part of this file, see the
|
|
# following page: https://dart.dev/tools/pub/pubspec
|
|
|
|
# The following section is specific to Flutter packages.
|
|
flutter:
|
|
|
|
# The following line ensures that the Material Icons font is
|
|
# included with your application, so that you can use the icons in
|
|
# the material Icons class.
|
|
uses-material-design: true
|
|
|
|
# To add assets to your application, add an assets section, like this:
|
|
# assets:
|
|
# - images/a_dot_burr.jpeg
|
|
# - images/a_dot_ham.jpeg
|
|
|
|
# An image asset can refer to one or more resolution-specific "variants", see
|
|
# https://flutter.dev/to/resolution-aware-images
|
|
|
|
# For details regarding adding assets from package dependencies, see
|
|
# https://flutter.dev/to/asset-from-package
|
|
|
|
# To add custom fonts to your application, add a fonts section here,
|
|
# in this "flutter" section. Each entry in this list should have a
|
|
# "family" key with the font family name, and a "fonts" key with a
|
|
# list giving the asset and other descriptors for the font. For
|
|
# example:
|
|
# fonts:
|
|
# - family: Schyler
|
|
# fonts:
|
|
# - asset: fonts/Schyler-Regular.ttf
|
|
# - asset: fonts/Schyler-Italic.ttf
|
|
# style: italic
|
|
# - family: Trajan Pro
|
|
# fonts:
|
|
# - asset: fonts/TrajanPro.ttf
|
|
# - asset: fonts/TrajanPro_Bold.ttf
|
|
# weight: 700
|
|
#
|
|
# For details regarding fonts from package dependencies,
|
|
# see https://flutter.dev/to/font-from-package
|