Skip to content

Commit

Permalink
🐛 set default locale in config value
Browse files Browse the repository at this point in the history
  • Loading branch information
LeGoffMael committed Jul 10, 2024
1 parent f570631 commit 72247c0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 28 deletions.
1 change: 1 addition & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class MyApp extends StatelessWidget {
GlobalMaterialLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: const [Locale('en')],
);
}
}
Expand Down
29 changes: 2 additions & 27 deletions lib/src/assets_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class InstaAssetPickerConfig {
this.limitedPermissionOverlayPredicate,
this.themeColor,
this.textDelegate,
this.locale,
this.gridThumbnailSize = defaultAssetGridPreviewSize,

/// [InstaAssetPickerBuilder] config
Expand All @@ -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.
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -276,6 +249,7 @@ class InstaAssetPicker {
cropDelegate: cropDelegate,
onCompleted: onCompleted,
config: pickerConfig,
locale: Localizations.maybeLocaleOf(context),
);

return AssetPicker.pickAssetsWithDelegate(
Expand Down Expand Up @@ -391,6 +365,7 @@ class InstaAssetPicker {
cropDelegate: cropDelegate,
onCompleted: onCompleted,
config: pickerConfig,
locale: Localizations.maybeLocaleOf(context),
);

return AssetPicker.pickAssetsWithDelegate(
Expand Down
2 changes: 1 addition & 1 deletion lib/src/widget/insta_asset_picker_delegate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -57,7 +58,6 @@ class InstaAssetPickerBuilder extends DefaultAssetPickerBuilderDelegate {
config.limitedPermissionOverlayPredicate,
themeColor: config.themeColor,
textDelegate: config.textDelegate,
locale: config.locale,
gridThumbnailSize: config.gridThumbnailSize,
shouldRevertGrid: false,
);
Expand Down

0 comments on commit 72247c0

Please sign in to comment.