From 862ac04f74d2b3990d457a1e0ffac543339d7a04 Mon Sep 17 00:00:00 2001 From: Alex Li Date: Thu, 26 Sep 2024 11:46:46 +0800 Subject: [PATCH 01/15] =?UTF-8?q?=F0=9F=90=9B=20Fix=20UI=20layouts=20(#634?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 9 +++- example/ios/Runner.xcodeproj/project.pbxproj | 1 - example/ios/Runner/Info.plist | 8 ++-- example/lib/constants/picker_method.dart | 23 ++++++++++ example/lib/l10n/app_en.arb | 2 + example/lib/l10n/app_zh.arb | 4 +- example/lib/l10n/gen/app_localizations.dart | 12 +++++ .../lib/l10n/gen/app_localizations_en.dart | 7 +++ .../lib/l10n/gen/app_localizations_zh.dart | 8 +++- example/lib/pages/multi_assets_page.dart | 4 ++ example/lib/pages/single_assets_page.dart | 4 ++ example/pubspec.yaml | 2 +- .../asset_picker_builder_delegate.dart | 45 +++++++++---------- .../widget/builder/image_page_builder.dart | 8 ++-- lib/wechat_assets_picker.dart | 1 + 15 files changed, 99 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3a822dc..29aa6af2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,14 @@ that can be found in the LICENSE file. --> ## Unreleased -*None.* +### Improvements + +- Do not mute the Live Photo during the preview. + +### Fixes + +- Fix the GIF indicator's layout. +- Fix the directionality with the reverted grid item. ## 9.3.0 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index ad4bde33..90b0beea 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -76,7 +76,6 @@ FF5A0AA64F3B1C88D3552E39 /* Pods-Runner.release.xcconfig */, 6B0C8420452B45A5D1F1C0C7 /* Pods-Runner.profile.xcconfig */, ); - name = Pods; path = Pods; sourceTree = ""; }; diff --git a/example/ios/Runner/Info.plist b/example/ios/Runner/Info.plist index c3e2441c..8532a84b 100644 --- a/example/ios/Runner/Info.plist +++ b/example/ios/Runner/Info.plist @@ -2,6 +2,8 @@ + CADisableMinimumFrameDurationOnPhone + CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleDisplayName @@ -30,6 +32,8 @@ Take a video for display NSPhotoLibraryUsageDescription Read your photos for display + UIApplicationSupportsIndirectInputEvents + UILaunchStoryboardName LaunchScreen UIMainStoryboardFile @@ -47,9 +51,5 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight - CADisableMinimumFrameDurationOnPhone - - UIApplicationSupportsIndirectInputEvents - diff --git a/example/lib/constants/picker_method.dart b/example/lib/constants/picker_method.dart index 34286dee..00857410 100644 --- a/example/lib/constants/picker_method.dart +++ b/example/lib/constants/picker_method.dart @@ -96,6 +96,29 @@ class PickMethod { ); } + factory PickMethod.livePhoto(BuildContext context, int maxAssetsCount) { + return PickMethod( + icon: '🎬', + name: context.l10n.pickMethodLivePhotoName, + description: context.l10n.pickMethodLivePhotoDescription, + method: (BuildContext context, List assets) { + return AssetPicker.pickAssets( + context, + pickerConfig: AssetPickerConfig( + maxAssets: maxAssetsCount, + selectedAssets: assets, + requestType: RequestType.image, + filterOptions: CustomFilter.sql( + where: '${CustomColumns.base.mediaType} = 1' + ' AND ' + '${CustomColumns.darwin.mediaSubtypes} & (1 << 3) = (1 << 3)', + ), + ), + ); + }, + ); + } + factory PickMethod.camera({ required BuildContext context, required int maxAssetsCount, diff --git a/example/lib/l10n/app_en.arb b/example/lib/l10n/app_en.arb index 63015a91..d40489ed 100644 --- a/example/lib/l10n/app_en.arb +++ b/example/lib/l10n/app_en.arb @@ -14,6 +14,8 @@ "pickMethodVideoDescription": "Only pick video from device. (Includes Live Photos on iOS and macOS.)", "pickMethodAudioName": "Audio picker", "pickMethodAudioDescription": "Only pick audio from device.", + "pickMethodLivePhotoName": "Live Photo picker", + "pickMethodLivePhotoDescription": "Only pick Live Photos from device.", "pickMethodCameraName": "Pick from camera", "pickMethodCameraDescription": "Allow to pick an asset through camera.", "pickMethodCameraAndStayName": "Pick from camera and stay", diff --git a/example/lib/l10n/app_zh.arb b/example/lib/l10n/app_zh.arb index fc9ce0fa..79df1bd6 100644 --- a/example/lib/l10n/app_zh.arb +++ b/example/lib/l10n/app_zh.arb @@ -13,9 +13,11 @@ "pickMethodImageName": "图片选择", "pickMethodImageDescription": "仅选择图片。", "pickMethodVideoName": "视频选择", - "pickMethodVideoDescription": "仅选择视频。(在 iOS 和 macOS 上将包括实况图片。)", + "pickMethodVideoDescription": "仅选择视频。", "pickMethodAudioName": "音频选择", "pickMethodAudioDescription": "仅选择音频。", + "pickMethodLivePhotoName": "实况图片选择", + "pickMethodLivePhotoDescription": "仅选择实况图片。", "pickMethodCameraName": "从相机生成选择", "pickMethodCameraDescription": "通过相机拍照生成并选择资源", "pickMethodCameraAndStayName": "从相机生成选择并停留", diff --git a/example/lib/l10n/gen/app_localizations.dart b/example/lib/l10n/gen/app_localizations.dart index d17f8ac8..dd848222 100644 --- a/example/lib/l10n/gen/app_localizations.dart +++ b/example/lib/l10n/gen/app_localizations.dart @@ -180,6 +180,18 @@ abstract class AppLocalizations { /// **'Only pick audio from device.'** String get pickMethodAudioDescription; + /// No description provided for @pickMethodLivePhotoName. + /// + /// In en, this message translates to: + /// **'Live Photo picker'** + String get pickMethodLivePhotoName; + + /// No description provided for @pickMethodLivePhotoDescription. + /// + /// In en, this message translates to: + /// **'Only pick Live Photos from device.'** + String get pickMethodLivePhotoDescription; + /// No description provided for @pickMethodCameraName. /// /// In en, this message translates to: diff --git a/example/lib/l10n/gen/app_localizations_en.dart b/example/lib/l10n/gen/app_localizations_en.dart index a50051ea..b8238fef 100644 --- a/example/lib/l10n/gen/app_localizations_en.dart +++ b/example/lib/l10n/gen/app_localizations_en.dart @@ -51,6 +51,13 @@ class AppLocalizationsEn extends AppLocalizations { @override String get pickMethodAudioDescription => 'Only pick audio from device.'; + @override + String get pickMethodLivePhotoName => 'Live Photo picker'; + + @override + String get pickMethodLivePhotoDescription => + 'Only pick Live Photos from device.'; + @override String get pickMethodCameraName => 'Pick from camera'; diff --git a/example/lib/l10n/gen/app_localizations_zh.dart b/example/lib/l10n/gen/app_localizations_zh.dart index b4ebffad..0d4f2e66 100644 --- a/example/lib/l10n/gen/app_localizations_zh.dart +++ b/example/lib/l10n/gen/app_localizations_zh.dart @@ -42,7 +42,7 @@ class AppLocalizationsZh extends AppLocalizations { String get pickMethodVideoName => '视频选择'; @override - String get pickMethodVideoDescription => '仅选择视频。(在 iOS 和 macOS 上将包括实况图片。)'; + String get pickMethodVideoDescription => '仅选择视频。'; @override String get pickMethodAudioName => '音频选择'; @@ -50,6 +50,12 @@ class AppLocalizationsZh extends AppLocalizations { @override String get pickMethodAudioDescription => '仅选择音频。'; + @override + String get pickMethodLivePhotoName => '实况图片选择'; + + @override + String get pickMethodLivePhotoDescription => '仅选择实况图片。'; + @override String get pickMethodCameraName => '从相机生成选择'; diff --git a/example/lib/pages/multi_assets_page.dart b/example/lib/pages/multi_assets_page.dart index ee6c4314..016486da 100644 --- a/example/lib/pages/multi_assets_page.dart +++ b/example/lib/pages/multi_assets_page.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by an Apache license that can be found // in the LICENSE file. +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:wechat_assets_picker/wechat_assets_picker.dart'; @@ -32,6 +34,8 @@ class _MultiAssetsPageState extends State PickMethod.image(context, maxAssetsCount), PickMethod.video(context, maxAssetsCount), PickMethod.audio(context, maxAssetsCount), + if (Platform.isIOS || Platform.isMacOS) + PickMethod.livePhoto(context, maxAssetsCount), PickMethod.camera( context: context, maxAssetsCount: maxAssetsCount, diff --git a/example/lib/pages/single_assets_page.dart b/example/lib/pages/single_assets_page.dart index aefa43ff..612277dd 100644 --- a/example/lib/pages/single_assets_page.dart +++ b/example/lib/pages/single_assets_page.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by an Apache license that can be found // in the LICENSE file. +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:wechat_assets_picker/wechat_assets_picker.dart' show AssetEntity; @@ -32,6 +34,8 @@ class _SingleAssetPageState extends State PickMethod.image(context, maxAssetsCount), PickMethod.video(context, maxAssetsCount), PickMethod.audio(context, maxAssetsCount), + if (Platform.isIOS || Platform.isMacOS) + PickMethod.livePhoto(context, maxAssetsCount), PickMethod.camera( context: context, maxAssetsCount: maxAssetsCount, diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 00abb433..edf7c1db 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,6 +1,6 @@ name: wechat_assets_picker_demo description: The demo project for the wechat_assets_picker package. -version: 9.2.1+57 +version: 9.3.0+58 publish_to: none environment: diff --git a/lib/src/delegates/asset_picker_builder_delegate.dart b/lib/src/delegates/asset_picker_builder_delegate.dart index ef256f6a..48d91769 100644 --- a/lib/src/delegates/asset_picker_builder_delegate.dart +++ b/lib/src/delegates/asset_picker_builder_delegate.dart @@ -408,7 +408,7 @@ abstract class AssetPickerBuilderDelegate { return Align( alignment: Alignment.bottomCenter, child: Container( - alignment: AlignmentDirectional.centerEnd, + width: double.infinity, padding: const EdgeInsets.all(6), decoration: BoxDecoration( gradient: LinearGradient( @@ -1227,11 +1227,7 @@ class DefaultAssetPickerBuilderDelegate final bool gridRevert = effectiveShouldRevertGrid(context); return Selector?>( selector: (_, DefaultAssetPickerProvider p) => p.currentPath, - builder: ( - BuildContext context, - PathWrapper? wrapper, - _, - ) { + builder: (context, wrapper, _) { // First, we need the count of the assets. int totalCount = wrapper?.assetCount ?? 0; final Widget? specialItem; @@ -1270,30 +1266,29 @@ class DefaultAssetPickerBuilderDelegate final double topPadding = context.topPadding + appBarPreferredSize!.height; + final textDirection = Directionality.of(context); Widget sliverGrid(BuildContext context, List assets) { return SliverGrid( delegate: SliverChildBuilderDelegate( - (_, int index) => Builder( - builder: (BuildContext context) { - if (gridRevert) { - if (index < placeholderCount) { - return const SizedBox.shrink(); - } - index -= placeholderCount; + (context, int index) { + if (gridRevert) { + if (index < placeholderCount) { + return const SizedBox.shrink(); } - return MergeSemantics( - child: Directionality( - textDirection: Directionality.of(context), - child: assetGridItemBuilder( - context, - index, - assets, - specialItem: specialItem, - ), + index -= placeholderCount; + } + return MergeSemantics( + child: Directionality( + textDirection: textDirection, + child: assetGridItemBuilder( + context, + index, + assets, + specialItem: specialItem, ), - ); - }, - ), + ), + ); + }, childCount: assetsGridItemCount( context: context, assets: assets, diff --git a/lib/src/widget/builder/image_page_builder.dart b/lib/src/widget/builder/image_page_builder.dart index 319043ec..8636cbd1 100644 --- a/lib/src/widget/builder/image_page_builder.dart +++ b/lib/src/widget/builder/image_page_builder.dart @@ -87,11 +87,9 @@ class _ImagePageBuilderState extends State { safeSetState(() { _livePhotoVideoController = c; }); - c - ..setVolume(0) - ..addListener(() { - safeSetState(() {}); - }); + c.addListener(() { + safeSetState(() {}); + }); } Widget _imageBuilder(BuildContext context, AssetEntity asset) { diff --git a/lib/wechat_assets_picker.dart b/lib/wechat_assets_picker.dart index fa89e92a..ca03acff 100644 --- a/lib/wechat_assets_picker.dart +++ b/lib/wechat_assets_picker.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by an Apache license that can be found // in the LICENSE file. +// ignore: unnecessary_library_name library wechat_assets_picker; export 'package:photo_manager/photo_manager.dart'; From 62283799bef1f6174cb1e67da64b175cc244825d Mon Sep 17 00:00:00 2001 From: Alex Li Date: Thu, 26 Sep 2024 11:50:55 +0800 Subject: [PATCH 02/15] =?UTF-8?q?=F0=9F=94=96=209.3.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 ++++ example/pubspec.yaml | 2 +- pubspec.yaml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 29aa6af2..8d81adc5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ that can be found in the LICENSE file. --> ## Unreleased +*None.* + +## 9.3.1 + ### Improvements - Do not mute the Live Photo during the preview. diff --git a/example/pubspec.yaml b/example/pubspec.yaml index edf7c1db..21f27fd3 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,6 +1,6 @@ name: wechat_assets_picker_demo description: The demo project for the wechat_assets_picker package. -version: 9.3.0+58 +version: 9.3.1+59 publish_to: none environment: diff --git a/pubspec.yaml b/pubspec.yaml index 29acce04..142e3af3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: wechat_assets_picker -version: 9.3.0 +version: 9.3.1 description: | An image picker (also with videos and audio) for Flutter projects based on WeChat's UI, From b800fca6a572fb3fea2e378c671d3dd1b71fbe5f Mon Sep 17 00:00:00 2001 From: Alex Li Date: Tue, 8 Oct 2024 15:59:38 +0800 Subject: [PATCH 03/15] =?UTF-8?q?=F0=9F=9A=80=20Adapt=20the=20image=20prov?= =?UTF-8?q?ider=20file=20type=20getter=20(#638)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 +++- .../asset_picker_builder_delegate.dart | 32 +++++++++++-------- .../asset_picker_viewer_builder_delegate.dart | 6 ++-- pubspec.yaml | 4 +-- 4 files changed, 28 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d81adc5..f0e9d17d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,11 @@ that can be found in the LICENSE file. --> ## Unreleased -*None.* +### Improvements + +- Adapt the file type getter from the image provider to get a precise file type in grid. +- Adds the identifier for grid item's semantics. +- Improves preview page back button. ## 9.3.1 diff --git a/lib/src/delegates/asset_picker_builder_delegate.dart b/lib/src/delegates/asset_picker_builder_delegate.dart index 48d91769..96c402c1 100644 --- a/lib/src/delegates/asset_picker_builder_delegate.dart +++ b/lib/src/delegates/asset_picker_builder_delegate.dart @@ -414,7 +414,10 @@ abstract class AssetPickerBuilderDelegate { gradient: LinearGradient( begin: AlignmentDirectional.bottomCenter, end: AlignmentDirectional.topCenter, - colors: [theme.dividerColor, Colors.transparent], + colors: [ + theme.canvasColor.withAlpha(128), + Colors.transparent, + ], ), ), child: Container( @@ -428,11 +431,9 @@ abstract class AssetPickerBuilderDelegate { child: ScaleText( textDelegate.gifIndicator, style: TextStyle( - color: isAppleOS(context) - ? theme.textTheme.bodyMedium?.color - : theme.primaryColor, - fontSize: 13, - fontWeight: FontWeight.w500, + color: theme.textTheme.bodyMedium?.color, + fontSize: 12, + fontWeight: FontWeight.bold, ), semanticsLabel: semanticsTextDelegate.gifIndicator, strutStyle: const StrutStyle(forceStrutHeight: true, height: 1), @@ -1503,6 +1504,7 @@ class DefaultAssetPickerBuilderDelegate enabled: !isBanned, excludeSemantics: true, focusable: !isSwitchingPath, + identifier: asset.id, label: '${semanticsTextDelegate.semanticTypeLabel(asset.type)}' '${semanticIndex(index)}, ' '${asset.createDateTime.toString().replaceAll('.000', '')}', @@ -1718,12 +1720,6 @@ class DefaultAssetPickerBuilderDelegate isOriginal: false, thumbnailSize: gridThumbnailSize, ); - SpecialImageType? type; - if (imageProvider.imageFileType == ImageFileType.gif) { - type = SpecialImageType.gif; - } else if (imageProvider.imageFileType == ImageFileType.heic) { - type = SpecialImageType.heic; - } return Stack( fit: StackFit.expand, children: [ @@ -1733,8 +1729,16 @@ class DefaultAssetPickerBuilderDelegate failedItemBuilder: failedItemBuilder, ), ), - if (type == SpecialImageType.gif) // 如果为GIF则显示标识 - gifIndicator(context, asset), + FutureBuilder( + future: imageProvider.imageFileType, + builder: (context, snapshot) { + if (snapshot.data case final type? + when type == ImageFileType.gif) { + return gifIndicator(context, asset); + } + return const SizedBox.shrink(); + }, + ), if (asset.type == AssetType.video) // 如果为视频则显示标识 videoIndicator(context, asset), if (asset.isLivePhoto) buildLivePhotoIndicator(context, asset), diff --git a/lib/src/delegates/asset_picker_viewer_builder_delegate.dart b/lib/src/delegates/asset_picker_viewer_builder_delegate.dart index e4c83491..8f386724 100644 --- a/lib/src/delegates/asset_picker_viewer_builder_delegate.dart +++ b/lib/src/delegates/asset_picker_viewer_builder_delegate.dart @@ -734,10 +734,10 @@ class DefaultAssetPickerViewerBuilderDelegate onPressed: () { Navigator.maybeOf(context)?.maybePop(); }, - tooltip: MaterialLocalizations.of(context).closeButtonTooltip, + tooltip: MaterialLocalizations.of(context).backButtonTooltip, icon: Icon( - Icons.close, - semanticLabel: MaterialLocalizations.of(context).closeButtonTooltip, + Icons.arrow_back_ios_new, + semanticLabel: MaterialLocalizations.of(context).backButtonTooltip, ), ), ), diff --git a/pubspec.yaml b/pubspec.yaml index 142e3af3..1a050aab 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -25,8 +25,8 @@ dependencies: wechat_picker_library: ^1.0.5 extended_image: ^8.3.0 - photo_manager: ^3.4.0 - photo_manager_image_provider: ^2.1.2 + photo_manager: ^3.5.0 + photo_manager_image_provider: ^2.2.0 provider: ^6.0.5 video_player: ^2.7.0 visibility_detector: ^0.4.0 From de46826607f347a6b316a9a93503bba26f4fdbe6 Mon Sep 17 00:00:00 2001 From: Alex Li Date: Tue, 8 Oct 2024 16:00:37 +0800 Subject: [PATCH 04/15] =?UTF-8?q?=F0=9F=94=96=209.3.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 ++++ example/pubspec.yaml | 2 +- pubspec.yaml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0e9d17d..9d0dced6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ that can be found in the LICENSE file. --> ## Unreleased +*None.* + +## 9.3.2 + ### Improvements - Adapt the file type getter from the image provider to get a precise file type in grid. diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 21f27fd3..8c3ac8d2 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,6 +1,6 @@ name: wechat_assets_picker_demo description: The demo project for the wechat_assets_picker package. -version: 9.3.1+59 +version: 9.3.2+60 publish_to: none environment: diff --git a/pubspec.yaml b/pubspec.yaml index 1a050aab..bca3d36d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: wechat_assets_picker -version: 9.3.1 +version: 9.3.2 description: | An image picker (also with videos and audio) for Flutter projects based on WeChat's UI, From 4d2de12dd601617c4db67c7ef11f538bec6346af Mon Sep 17 00:00:00 2001 From: Alex Li Date: Thu, 17 Oct 2024 19:32:10 +0800 Subject: [PATCH 05/15] =?UTF-8?q?=F0=9F=91=B7=20Try=20to=20run=20on=20mini?= =?UTF-8?q?mum=20SDK=20requirement=20(#643)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/runnable.yml | 19 ++++++++++++++++--- CHANGELOG.md | 6 ++++++ example/pubspec.yaml | 2 +- .../asset_picker_builder_delegate.dart | 2 +- pubspec.yaml | 2 +- 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/.github/workflows/runnable.yml b/.github/workflows/runnable.yml index 9eb5bd52..d5bf1750 100644 --- a/.github/workflows/runnable.yml +++ b/.github/workflows/runnable.yml @@ -12,13 +12,17 @@ on: paths-ignore: - "**.md" +env: + MINIMUM_FLUTTER_VERSION: '3.16.0' + jobs: analyze: - name: Analyze on ${{ matrix.os }} + name: Analyze on ${{ matrix.os }} with ${{ matrix.flutter-version }} Flutter runs-on: ${{ matrix.os }} strategy: matrix: os: [ ubuntu-latest ] + flutter-version: [ min, latest ] steps: - uses: actions/checkout@v4 - uses: actions/setup-java@v4 @@ -28,6 +32,7 @@ jobs: - uses: subosito/flutter-action@v2 with: channel: 'stable' + flutter-version: ${{ matrix.flutter-version == 'min' && env.MINIMUM_FLUTTER_VERSION || '' }} - name: Log Dart/Flutter versions run: | dart --version @@ -47,8 +52,11 @@ jobs: test_iOS: needs: analyze - name: Test iOS + name: Test iOS with ${{ matrix.flutter-version }} Flutter runs-on: macos-latest + strategy: + matrix: + flutter-version: [ min, latest ] steps: - uses: actions/checkout@v4 - uses: actions/setup-java@v4 @@ -58,6 +66,7 @@ jobs: - uses: subosito/flutter-action@v2.8.0 with: channel: stable + flutter-version: ${{ matrix.flutter-version == 'min' && env.MINIMUM_FLUTTER_VERSION || '' }} - run: dart --version - run: flutter --version - run: flutter pub get @@ -65,8 +74,11 @@ jobs: test_android: needs: analyze - name: Test Android + name: Test Android with ${{ matrix.flutter-version }} Flutter runs-on: ubuntu-latest + strategy: + matrix: + flutter-version: [ min, latest ] steps: - uses: actions/checkout@v4 - uses: actions/setup-java@v4 @@ -76,6 +88,7 @@ jobs: - uses: subosito/flutter-action@v2.8.0 with: channel: stable + flutter-version: ${{ matrix.flutter-version == 'min' && env.MINIMUM_FLUTTER_VERSION || '' }} - run: dart --version - run: flutter --version - run: flutter pub get diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d0dced6..e69eff09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,12 @@ that can be found in the LICENSE file. --> *None.* +## 9.3.3 + +### Fixes + +- Recovers the compatibility with Flutter 3.16. + ## 9.3.2 ### Improvements diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 8c3ac8d2..c91ecf88 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,6 +1,6 @@ name: wechat_assets_picker_demo description: The demo project for the wechat_assets_picker package. -version: 9.3.2+60 +version: 9.3.3+61 publish_to: none environment: diff --git a/lib/src/delegates/asset_picker_builder_delegate.dart b/lib/src/delegates/asset_picker_builder_delegate.dart index 96c402c1..cff1802c 100644 --- a/lib/src/delegates/asset_picker_builder_delegate.dart +++ b/lib/src/delegates/asset_picker_builder_delegate.dart @@ -1500,11 +1500,11 @@ class DefaultAssetPickerBuilderDelegate hint += ', ${asset.title}'; } return Semantics( + key: ValueKey('${asset.id}-semantics'), button: false, enabled: !isBanned, excludeSemantics: true, focusable: !isSwitchingPath, - identifier: asset.id, label: '${semanticsTextDelegate.semanticTypeLabel(asset.type)}' '${semanticIndex(index)}, ' '${asset.createDateTime.toString().replaceAll('.000', '')}', diff --git a/pubspec.yaml b/pubspec.yaml index bca3d36d..4a02d12c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: wechat_assets_picker -version: 9.3.2 +version: 9.3.3 description: | An image picker (also with videos and audio) for Flutter projects based on WeChat's UI, From c6720cdaa10c949c4dc6be3420b064ca7b1c81ac Mon Sep 17 00:00:00 2001 From: Alex Li Date: Fri, 8 Nov 2024 13:22:14 +0800 Subject: [PATCH 06/15] =?UTF-8?q?=F0=9F=90=9B=20Allows=20assets=20changing?= =?UTF-8?q?=20when=20no=20path=20previously=20(#656)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves https://github.com/fluttercandies/flutter_photo_manager/issues/1215 --- CHANGELOG.md | 4 +++- lib/src/delegates/asset_picker_builder_delegate.dart | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e69eff09..8af74669 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,9 @@ that can be found in the LICENSE file. --> ## Unreleased -*None.* +### Fixes + +- Allows assets changing when no path previously. ## 9.3.3 diff --git a/lib/src/delegates/asset_picker_builder_delegate.dart b/lib/src/delegates/asset_picker_builder_delegate.dart index cff1802c..aa85ec03 100644 --- a/lib/src/delegates/asset_picker_builder_delegate.dart +++ b/lib/src/delegates/asset_picker_builder_delegate.dart @@ -901,7 +901,7 @@ class DefaultAssetPickerBuilderDelegate if (assetsChangeRefreshPredicate != null) { return assetsChangeRefreshPredicate!(permission, call, path); } - return path?.isAll == true; + return path?.isAll ?? true; } if (!predicate()) { From 2d51c424d0683de106244f612bdae20faada1503 Mon Sep 17 00:00:00 2001 From: Alex Li Date: Fri, 8 Nov 2024 13:48:26 +0800 Subject: [PATCH 07/15] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Allows=20`extended?= =?UTF-8?q?=5Fimage:=20^9.0.0`=20(#659)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves #652 --- CHANGELOG.md | 8 ++++++++ example/lib/l10n/gen/app_localizations.dart | 2 ++ example/lib/l10n/gen/app_localizations_en.dart | 2 ++ example/lib/l10n/gen/app_localizations_zh.dart | 2 ++ example/pubspec.yaml | 6 +++--- pubspec.yaml | 4 ++-- 6 files changed, 19 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8af74669..9f84c0cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,14 @@ that can be found in the LICENSE file. --> ## Unreleased +**None.** + +## 9.4.0 + +### Improvements + +- Allows `extended_image: ^9.0.0`. + ### Fixes - Allows assets changing when no path previously. diff --git a/example/lib/l10n/gen/app_localizations.dart b/example/lib/l10n/gen/app_localizations.dart index dd848222..9cf300a3 100644 --- a/example/lib/l10n/gen/app_localizations.dart +++ b/example/lib/l10n/gen/app_localizations.dart @@ -8,6 +8,8 @@ import 'package:intl/intl.dart' as intl; import 'app_localizations_en.dart'; import 'app_localizations_zh.dart'; +// ignore_for_file: type=lint + /// Callers can lookup localized strings with an instance of AppLocalizations /// returned by `AppLocalizations.of(context)`. /// diff --git a/example/lib/l10n/gen/app_localizations_en.dart b/example/lib/l10n/gen/app_localizations_en.dart index b8238fef..6419ff94 100644 --- a/example/lib/l10n/gen/app_localizations_en.dart +++ b/example/lib/l10n/gen/app_localizations_en.dart @@ -1,5 +1,7 @@ import 'app_localizations.dart'; +// ignore_for_file: type=lint + /// The translations for English (`en`). class AppLocalizationsEn extends AppLocalizations { AppLocalizationsEn([String locale = 'en']) : super(locale); diff --git a/example/lib/l10n/gen/app_localizations_zh.dart b/example/lib/l10n/gen/app_localizations_zh.dart index 0d4f2e66..3306b449 100644 --- a/example/lib/l10n/gen/app_localizations_zh.dart +++ b/example/lib/l10n/gen/app_localizations_zh.dart @@ -1,5 +1,7 @@ import 'app_localizations.dart'; +// ignore_for_file: type=lint + /// The translations for Chinese (`zh`). class AppLocalizationsZh extends AppLocalizations { AppLocalizationsZh([String locale = 'zh']) : super(locale); diff --git a/example/pubspec.yaml b/example/pubspec.yaml index c91ecf88..91ee8f83 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,6 +1,6 @@ name: wechat_assets_picker_demo description: The demo project for the wechat_assets_picker package. -version: 9.3.3+61 +version: 9.4.0+62 publish_to: none environment: @@ -17,11 +17,11 @@ dependencies: path: ../ wechat_camera_picker: ^4.2.0 - extended_image: ^8.3.0 + extended_image: any package_info_plus: '>=5.0.0 <9.0.0' path: ^1.8.0 path_provider: ^2.0.15 - provider: ^6.0.2 + provider: any dev_dependencies: flutter_lints: any diff --git a/pubspec.yaml b/pubspec.yaml index 4a02d12c..7bc04ea8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: wechat_assets_picker -version: 9.3.3 +version: 9.4.0 description: | An image picker (also with videos and audio) for Flutter projects based on WeChat's UI, @@ -24,7 +24,7 @@ dependencies: wechat_picker_library: ^1.0.5 - extended_image: ^8.3.0 + extended_image: '>=8.3.0 <10.0.0' photo_manager: ^3.5.0 photo_manager_image_provider: ^2.2.0 provider: ^6.0.5 From 29c2b8aca26cc70cc8180c23ff4f84b6c0846ea3 Mon Sep 17 00:00:00 2001 From: Alex Li Date: Thu, 21 Nov 2024 22:36:23 +0800 Subject: [PATCH 08/15] =?UTF-8?q?=F0=9F=9A=B8=20Improves=20the=20default?= =?UTF-8?q?=20sort=20conditions=20(#662)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 +++- lib/src/provider/asset_picker_provider.dart | 17 ++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f84c0cc..c893664d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,9 @@ that can be found in the LICENSE file. --> ## Unreleased -**None.** +### Improvements + +- Improves the default sort conditions. ## 9.4.0 diff --git a/lib/src/provider/asset_picker_provider.dart b/lib/src/provider/asset_picker_provider.dart index 4938fe15..16ec896e 100644 --- a/lib/src/provider/asset_picker_provider.dart +++ b/lib/src/provider/asset_picker_provider.dart @@ -3,6 +3,7 @@ // in the LICENSE file. import 'dart:async'; +import 'dart:io'; import 'dart:math' as math; import 'dart:typed_data'; @@ -333,14 +334,10 @@ class DefaultAssetPickerProvider bool onlyAll = false, bool keepPreviousCount = false, }) async { - final PMFilter options; + final PMFilter? options; final fog = filterOptions; - if (fog == null) { - options = AdvancedCustomFilter( - orderBy: [OrderByItem.desc(CustomColumns.base.createDate)], - ); - } else if (fog is FilterOptionGroup) { - final newOptions = FilterOptionGroup( + if (fog is FilterOptionGroup) { + options = FilterOptionGroup( imageOption: const FilterOption( sizeConstraint: SizeConstraint(ignoreSize: true), ), @@ -352,9 +349,11 @@ class DefaultAssetPickerProvider containsPathModified: sortPathsByModifiedDate, createTimeCond: DateTimeCond.def().copyWith(ignore: true), updateTimeCond: DateTimeCond.def().copyWith(ignore: true), + )..merge(fog); + } else if (fog == null && Platform.isAndroid) { + options = AdvancedCustomFilter( + orderBy: [OrderByItem.desc(CustomColumns.android.dateTaken)], ); - newOptions.merge(fog); - options = newOptions; } else { options = fog; } From dc5911e89705854cc7ffbacf0c8be372fca4adfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=93=E5=A4=A7=E5=AE=9D?= Date: Thu, 21 Nov 2024 23:10:23 +0800 Subject: [PATCH 09/15] Fix selecting when reached the max asset limit in the preview (#648) Fixes #607 --------- Co-authored-by: Alex Li --- lib/src/delegates/asset_picker_viewer_builder_delegate.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/delegates/asset_picker_viewer_builder_delegate.dart b/lib/src/delegates/asset_picker_viewer_builder_delegate.dart index 8f386724..e2c5f1fc 100644 --- a/lib/src/delegates/asset_picker_viewer_builder_delegate.dart +++ b/lib/src/delegates/asset_picker_viewer_builder_delegate.dart @@ -272,7 +272,7 @@ abstract class AssetPickerViewerBuilderDelegate { } void selectAsset(Asset entity) { - if (maxAssets != null && selectedCount >= maxAssets!) { + if (maxAssets != null && selectedCount > maxAssets!) { return; } provider?.selectAsset(entity); From c8c3ea0fbea198651cd93bbc86d430a5d5ac33d5 Mon Sep 17 00:00:00 2001 From: Alex Li Date: Thu, 21 Nov 2024 23:14:22 +0800 Subject: [PATCH 10/15] =?UTF-8?q?=F0=9F=94=96=209.4.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 8 ++++++++ pubspec.yaml | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c893664d..eaad6663 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,10 +9,18 @@ that can be found in the LICENSE file. --> ## Unreleased +*None.* + +## 9.4.1 + ### Improvements - Improves the default sort conditions. +### Fixes + +- Fixes selecting when reached the max asset limit in the preview. + ## 9.4.0 ### Improvements diff --git a/pubspec.yaml b/pubspec.yaml index 7bc04ea8..b227f2db 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: wechat_assets_picker -version: 9.4.0 +version: 9.4.1 description: | An image picker (also with videos and audio) for Flutter projects based on WeChat's UI, From f393d3065c7633d03af867085ff98769440a86ea Mon Sep 17 00:00:00 2001 From: Alex Li Date: Thu, 21 Nov 2024 23:21:29 +0800 Subject: [PATCH 11/15] =?UTF-8?q?=F0=9F=94=96=209.4.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/ios/Runner/AppDelegate.swift | 2 +- example/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/example/ios/Runner/AppDelegate.swift b/example/ios/Runner/AppDelegate.swift index 70693e4a..b6363034 100644 --- a/example/ios/Runner/AppDelegate.swift +++ b/example/ios/Runner/AppDelegate.swift @@ -1,7 +1,7 @@ import UIKit import Flutter -@UIApplicationMain +@main @objc class AppDelegate: FlutterAppDelegate { override func application( _ application: UIApplication, diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 91ee8f83..8f45c489 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,6 +1,6 @@ name: wechat_assets_picker_demo description: The demo project for the wechat_assets_picker package. -version: 9.4.0+62 +version: 9.4.1+63 publish_to: none environment: From ba47c9edc093236c535170b32a71514d44a74573 Mon Sep 17 00:00:00 2001 From: Alex Li Date: Wed, 11 Dec 2024 13:12:58 +0800 Subject: [PATCH 12/15] =?UTF-8?q?=F0=9F=92=A1=20Refreshes=20tests=20copyri?= =?UTF-8?q?ght?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/config_test.dart | 7 +++---- test/delegates_test.dart | 7 +++---- test/test_utils.dart | 7 +++---- test/widget_test.dart | 7 +++---- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/test/config_test.dart b/test/config_test.dart index 5081d3ac..e3fd590e 100644 --- a/test/config_test.dart +++ b/test/config_test.dart @@ -1,7 +1,6 @@ -// -// [Author] Alex (https://github.com/AlexV525) -// [Date] 2022/09/20 17:06 -// +// Copyright 2019 The FlutterCandies author. All rights reserved. +// Use of this source code is governed by an Apache license that can be found +// in the LICENSE file. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; diff --git a/test/delegates_test.dart b/test/delegates_test.dart index 74b16c47..2698964b 100644 --- a/test/delegates_test.dart +++ b/test/delegates_test.dart @@ -1,7 +1,6 @@ -// -// [Author] Alex (https://github.com/AlexV525) -// [Date] 2022/9/19 11:52 -// +// Copyright 2019 The FlutterCandies author. All rights reserved. +// Use of this source code is governed by an Apache license that can be found +// in the LICENSE file. import 'package:flutter_test/flutter_test.dart'; import 'package:wechat_assets_picker/wechat_assets_picker.dart'; diff --git a/test/test_utils.dart b/test/test_utils.dart index c5d0a670..9fe5cac0 100644 --- a/test/test_utils.dart +++ b/test/test_utils.dart @@ -1,7 +1,6 @@ -// -// [Author] Alex (https://github.com/AlexV525) -// [Date] 2022/09/20 16:35 -// +// Copyright 2019 The FlutterCandies author. All rights reserved. +// Use of this source code is governed by an Apache license that can be found +// in the LICENSE file. import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; diff --git a/test/widget_test.dart b/test/widget_test.dart index 76d5e9d0..c35802e1 100644 --- a/test/widget_test.dart +++ b/test/widget_test.dart @@ -1,7 +1,6 @@ -// -// [Author] Alex (https://github.com/AlexV525) -// [Date] 2022/09/20 17:09 -// +// Copyright 2019 The FlutterCandies author. All rights reserved. +// Use of this source code is governed by an Apache license that can be found +// in the LICENSE file. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; From 7835de8788eeeac3efec66668791700576a68789 Mon Sep 17 00:00:00 2001 From: Alex Li Date: Wed, 11 Dec 2024 14:19:44 +0800 Subject: [PATCH 13/15] =?UTF-8?q?=F0=9F=9A=80=20Support=20matching=20scrip?= =?UTF-8?q?t=20and=20country=20code=20of=20locales=20with=20the=20text=20d?= =?UTF-8?q?elegate=20(#668)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prepare for #667 --- .../delegates/asset_picker_text_delegate.dart | 42 +++++++++++++++---- test/delegates_test.dart | 30 +++++++++++++ 2 files changed, 65 insertions(+), 7 deletions(-) diff --git a/lib/src/delegates/asset_picker_text_delegate.dart b/lib/src/delegates/asset_picker_text_delegate.dart index b79a8c3c..2a85464b 100644 --- a/lib/src/delegates/asset_picker_text_delegate.dart +++ b/lib/src/delegates/asset_picker_text_delegate.dart @@ -4,12 +4,12 @@ import 'dart:io' show Platform; +import 'package:flutter/foundation.dart'; import 'package:flutter/rendering.dart'; import 'package:photo_manager/photo_manager.dart' show AssetType; /// All text delegates. -const List assetPickerTextDelegates = - [ +const assetPickerTextDelegates = [ AssetPickerTextDelegate(), EnglishAssetPickerTextDelegate(), HebrewAssetPickerTextDelegate(), @@ -28,13 +28,30 @@ AssetPickerTextDelegate assetPickerTextDelegateFromLocale(Locale? locale) { if (locale == null) { return const AssetPickerTextDelegate(); } + final String languageCode = locale.languageCode.toLowerCase(); - for (final AssetPickerTextDelegate delegate in assetPickerTextDelegates) { - if (delegate.languageCode == languageCode) { - return delegate; - } + final String? scriptCode = locale.scriptCode?.toLowerCase(); + final String? countryCode = locale.countryCode?.toLowerCase(); + + final matchedByLanguage = assetPickerTextDelegates.where( + (e) => e.languageCode == languageCode, + ); + if (matchedByLanguage.isEmpty) { + return const AssetPickerTextDelegate(); + } + + final matchedByScript = scriptCode != null + ? matchedByLanguage.where((e) => e.scriptCode == scriptCode) + : null; + if (matchedByScript == null || matchedByScript.isEmpty) { + return matchedByLanguage.first; } - return const AssetPickerTextDelegate(); + + final matchedByCountry = countryCode != null + ? matchedByScript.where((e) => e.countryCode == countryCode) + : null; + + return matchedByCountry?.firstOrNull ?? matchedByScript.first; } /// Text delegate that controls text in widgets. @@ -44,6 +61,17 @@ class AssetPickerTextDelegate { String get languageCode => 'zh'; + String? get scriptCode => 'Hans'; + + String? get countryCode => null; + + @nonVirtual + Locale get locale => Locale.fromSubtags( + languageCode: languageCode, + scriptCode: scriptCode, + countryCode: countryCode, + ); + /// Confirm string for the confirm button. /// 确认按钮的字段 String get confirm => '确认'; diff --git a/test/delegates_test.dart b/test/delegates_test.dart index 2698964b..6ae1386a 100644 --- a/test/delegates_test.dart +++ b/test/delegates_test.dart @@ -2,10 +2,40 @@ // Use of this source code is governed by an Apache license that can be found // in the LICENSE file. +import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:wechat_assets_picker/wechat_assets_picker.dart'; void main() { + group(AssetPickerTextDelegate, () { + test('returns the default when available', () { + expect( + assetPickerTextDelegateFromLocale(null), + equals(const AssetPickerTextDelegate()), + ); + expect( + assetPickerTextDelegateFromLocale(const Locale('zh')), + equals(const AssetPickerTextDelegate()), + ); + expect( + assetPickerTextDelegateFromLocale(const Locale('zxx')), + equals(const AssetPickerTextDelegate()), + ); + }); + + test('each delegate can be obtained by its locale definition', () { + for (final delegate in assetPickerTextDelegates) { + final locale = Locale.fromSubtags( + languageCode: delegate.languageCode, + scriptCode: delegate.scriptCode, + countryCode: delegate.countryCode, + ); + final matchedDelegate = assetPickerTextDelegateFromLocale(locale); + expect(matchedDelegate, equals(delegate)); + } + }); + }); + test('Sort paths correctly', () { final List> paths = >[ From 1f3156849ee8bc3ce95bb8ff28862f6e6c490b20 Mon Sep 17 00:00:00 2001 From: Gasol Wu Date: Thu, 12 Dec 2024 23:03:26 +0800 Subject: [PATCH 14/15] Add Traditional Chinese localization (#667) This change adds Traditional Chinese localization and return it when the locale is zh-Hant. We have to use the languageCode and scriptCode to differentiate between Simplified and Traditional Chinese. Summary of changes: - Implement TraditionalChineseAssetPickerTextDelegate - Add TraditionalChineseAssetPickerTextDelegate to the list of delegates. - Sort the list of delegates alphabetically. - Remove all toLowerCase() calls to make sure we can return the correct delegate. --- .../delegates/asset_picker_text_delegate.dart | 113 ++++++++++++++++-- 1 file changed, 104 insertions(+), 9 deletions(-) diff --git a/lib/src/delegates/asset_picker_text_delegate.dart b/lib/src/delegates/asset_picker_text_delegate.dart index 2a85464b..abe6b091 100644 --- a/lib/src/delegates/asset_picker_text_delegate.dart +++ b/lib/src/delegates/asset_picker_text_delegate.dart @@ -11,16 +11,17 @@ import 'package:photo_manager/photo_manager.dart' show AssetType; /// All text delegates. const assetPickerTextDelegates = [ AssetPickerTextDelegate(), + ArabicAssetPickerTextDelegate(), EnglishAssetPickerTextDelegate(), - HebrewAssetPickerTextDelegate(), + FrenchAssetPickerTextDelegate(), GermanAssetPickerTextDelegate(), - RussianAssetPickerTextDelegate(), + HebrewAssetPickerTextDelegate(), JapaneseAssetPickerTextDelegate(), - ArabicAssetPickerTextDelegate(), - FrenchAssetPickerTextDelegate(), - VietnameseAssetPickerTextDelegate(), - TurkishAssetPickerTextDelegate(), KoreanAssetPickerTextDelegate(), + RussianAssetPickerTextDelegate(), + TraditionalChineseAssetPickerTextDelegate(), + TurkishAssetPickerTextDelegate(), + VietnameseAssetPickerTextDelegate(), ]; /// Obtain the text delegate from the given locale. @@ -29,9 +30,9 @@ AssetPickerTextDelegate assetPickerTextDelegateFromLocale(Locale? locale) { return const AssetPickerTextDelegate(); } - final String languageCode = locale.languageCode.toLowerCase(); - final String? scriptCode = locale.scriptCode?.toLowerCase(); - final String? countryCode = locale.countryCode?.toLowerCase(); + final String languageCode = locale.languageCode; + final String? scriptCode = locale.scriptCode; + final String? countryCode = locale.countryCode; final matchedByLanguage = assetPickerTextDelegates.where( (e) => e.languageCode == languageCode, @@ -1162,3 +1163,97 @@ class KoreanAssetPickerTextDelegate extends AssetPickerTextDelegate { @override String get sUnitAssetCountLabel => '개'; } + +/// [AssetPickerTextDelegate] implements with Traditional Chinese. +/// 繁體中文文字實現 +class TraditionalChineseAssetPickerTextDelegate + extends AssetPickerTextDelegate { + const TraditionalChineseAssetPickerTextDelegate(); + + @override + String get scriptCode => 'Hant'; + + @override + String get confirm => '確認'; + + @override + String get cancel => '取消'; + + @override + String get edit => '編輯'; + + @override + String get gifIndicator => 'GIF'; + + @override + String get loadFailed => '載入失敗'; + + @override + String get original => '原圖'; + + @override + String get preview => '預覽'; + + @override + String get select => '選擇'; + + @override + String get emptyList => '列表為空'; + + @override + String get unSupportedAssetType => '不支援的媒體類型'; + + @override + String get unableToAccessAll => '無法存取相簿中的照片'; + + @override + String get viewingLimitedAssetsTip => '僅顯示可存取的相簿和照片'; + + @override + String get changeAccessibleLimitedAssets => '前往設定可被存取的照片'; + + @override + String get accessAllTip => '應用程式只能存取相簿部分相片,建議允許存取「所有照片」。'; + + @override + String get goToSystemSettings => '前往系統設定'; + + @override + String get accessLimitedAssets => '繼續存取部分資源'; + + @override + String get accessiblePathName => '可存取的資源'; + + @override + String get sTypeAudioLabel => '音訊'; + + @override + String get sTypeImageLabel => '照片'; + + @override + String get sTypeVideoLabel => '影片'; + + @override + String get sTypeOtherLabel => '其他媒體'; + + @override + String get sActionPlayHint => '播放'; + + @override + String get sActionPreviewHint => '預覽'; + + @override + String get sActionSelectHint => '選擇'; + + @override + String get sActionSwitchPathLabel => '切換路徑'; + + @override + String get sActionUseCameraHint => '使用相機'; + + @override + String get sNameDurationLabel => '時長'; + + @override + String get sUnitAssetCountLabel => '數量'; +} From 2b8256eb56f42818fa8acce43d85b19f31c5a75e Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 12 Dec 2024 23:09:58 +0800 Subject: [PATCH 15/15] docs: add Gasol as a contributor for translation (#669) Adds @Gasol as a contributor for translation. This was requested by AlexV525 [in this comment](https://github.com/fluttercandies/flutter_wechat_assets_picker/pull/667#issuecomment-2539223310) [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index a2b58602..0b8553a7 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -268,6 +268,15 @@ "contributions": [ "code" ] + }, + { + "login": "Gasol", + "name": "Gasol Wu", + "avatar_url": "https://avatars.githubusercontent.com/u/108053?v=4", + "profile": "http://about.me/gasol", + "contributions": [ + "translation" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 10a4bb1e..e9e820ec 100644 --- a/README.md +++ b/README.md @@ -585,6 +585,7 @@ Many thanks to these wonderful people ([emoji key](https://allcontributors.org/d mirimhee
mirimhee

🌍 Amos
Amos

🐛 Dimil Kalathiya
Dimil Kalathiya

💻 + Gasol Wu
Gasol Wu

🌍