diff --git a/example/lib/main.dart b/example/lib/main.dart index 1a3082c..32ef87e 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -53,6 +53,7 @@ class MyApp extends StatelessWidget { GlobalMaterialLocalizations.delegate, GlobalCupertinoLocalizations.delegate, ], + supportedLocales: const [Locale('en')], ); } } diff --git a/lib/src/assets_picker.dart b/lib/src/assets_picker.dart index bca18c3..663c040 100644 --- a/lib/src/assets_picker.dart +++ b/lib/src/assets_picker.dart @@ -47,7 +47,6 @@ class InstaAssetPickerConfig { this.limitedPermissionOverlayPredicate, this.themeColor, this.textDelegate, - this.locale, this.gridThumbnailSize = defaultAssetGridPreviewSize, /// [InstaAssetPickerBuilder] config @@ -57,29 +56,6 @@ class InstaAssetPickerConfig { this.actionsBuilder, }); - InstaAssetPickerConfig.withContext( - BuildContext context, { - /// [DefaultAssetPickerBuilderDelegate] config - - this.gridCount = _kGridCount, - this.specialItemPosition, - this.specialItemBuilder, - this.loadingIndicatorBuilder, - this.selectPredicate, - this.limitedPermissionOverlayPredicate, - this.themeColor, - this.gridThumbnailSize = defaultAssetGridPreviewSize, - - /// [InstaAssetPickerBuilder] config - - this.title, - this.closeOnComplete = false, - this.actionsBuilder, - }) : pickerTheme = - InstaAssetPicker.themeData(Theme.of(context).primaryColor), - textDelegate = InstaAssetPicker.defaultTextDelegate(context), - locale = Localizations.maybeLocaleOf(context); - /* [DefaultAssetPickerBuilderDelegate] config */ /// Specifies the number of assets in the cross axis. @@ -114,9 +90,6 @@ class InstaAssetPickerConfig { /// Default is the locale language from the context. final AssetPickerTextDelegate? textDelegate; - /// Identifier used to select picker language - final Locale? locale; - /// Thumbnail size in the grid. final ThumbnailSize gridThumbnailSize; @@ -276,6 +249,7 @@ class InstaAssetPicker { cropDelegate: cropDelegate, onCompleted: onCompleted, config: pickerConfig, + locale: Localizations.maybeLocaleOf(context), ); return AssetPicker.pickAssetsWithDelegate( @@ -391,6 +365,7 @@ class InstaAssetPicker { cropDelegate: cropDelegate, onCompleted: onCompleted, config: pickerConfig, + locale: Localizations.maybeLocaleOf(context), ); return AssetPicker.pickAssetsWithDelegate( diff --git a/lib/src/widget/insta_asset_picker_delegate.dart b/lib/src/widget/insta_asset_picker_delegate.dart index 0c2e2ad..288f199 100644 --- a/lib/src/widget/insta_asset_picker_delegate.dart +++ b/lib/src/widget/insta_asset_picker_delegate.dart @@ -40,6 +40,7 @@ class InstaAssetPickerBuilder extends DefaultAssetPickerBuilderDelegate { required InstaAssetPickerConfig config, InstaAssetCropDelegate cropDelegate = const InstaAssetCropDelegate(), super.keepScrollOffset, + super.locale, }) : _cropController = InstaAssetsCropController(keepScrollOffset, cropDelegate), title = config.title, @@ -57,7 +58,6 @@ class InstaAssetPickerBuilder extends DefaultAssetPickerBuilderDelegate { config.limitedPermissionOverlayPredicate, themeColor: config.themeColor, textDelegate: config.textDelegate, - locale: config.locale, gridThumbnailSize: config.gridThumbnailSize, shouldRevertGrid: false, );