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';