Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

related to [issue #96], Suggestion for an easier way to apply foreground inset #563

Merged
merged 3 commits into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ Shown below is the full list of attributes which you can specify within your Flu
be used to fill out the background of the adaptive icon.
- `adaptive_icon_foreground`: The image asset which will be used for the icon foreground of the adaptive icon
*Note: Adaptive Icons will only be generated when both adaptive_icon_background and adaptive_icon_foreground are specified. (the image_path is not automatically taken as foreground)*
- `adaptive_icon_foreground_inset`: This is used to add padding to the icon when applying an adaptive icon. The default value is `16`.
- `adaptive_icon_monochrome`: The image asset which will be used for the icon
foreground of the Android 13+ themed icon. For more information see [Android Adaptive Icons](https://developer.android.com/develop/ui/views/launch/icon_design_adaptive#user-theming)

Expand Down
1 change: 1 addition & 0 deletions example/default_example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ flutter_launcher_icons:
ios: true # can specify file name here e.g. "My-Launcher-Icon"
adaptive_icon_background: "assets/images/christmas-background.png" # only available for Android 8.0 devices and above
adaptive_icon_foreground: "assets/images/icon-foreground-432x432.png" # only available for Android 8.0 devices and above
adaptive_icon_foreground_inset: 16 # only available for Android 8.0 devices and above
adaptive_icon_monochrome: "assets/images/icon-monochrome-432x432.png" # only available for Android 13 devices and above
min_sdk_android: 21 # android min sdk min:16, default 21
remove_alpha_ios: true
Expand Down
2 changes: 1 addition & 1 deletion lib/android.dart
MarkOSullivan94 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ void createMipmapXmlFile(
}

xmlContent +=
' <foreground android:drawable="@drawable/ic_launcher_foreground"/>\n';
' <foreground>\n <inset\n android:drawable="@drawable/ic_launcher_foreground"\n android:inset="${config.adaptiveIconForegroundInset}%" />\n </foreground>\n';
MarkOSullivan94 marked this conversation as resolved.
Show resolved Hide resolved
}

if (config.hasAndroidAdaptiveMonochromeConfig) {
Expand Down
5 changes: 5 additions & 0 deletions lib/config/config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Config {
this.imagePathAndroid,
this.imagePathIOS,
this.adaptiveIconForeground,
this.adaptiveIconForegroundInset = 16,
this.adaptiveIconBackground,
this.adaptiveIconMonochrome,
this.minSdkAndroid = constants.androidDefaultAndroidMinSDK,
Expand Down Expand Up @@ -121,6 +122,10 @@ class Config {
@JsonKey(name: 'adaptive_icon_foreground')
final String? adaptiveIconForeground;

/// android adaptive_icon_foreground inset
@JsonKey(name: 'adaptive_icon_foreground_inset')
final int adaptiveIconForegroundInset;

/// android adaptive_icon_background image
@JsonKey(name: 'adaptive_icon_background')
final String? adaptiveIconBackground;
Expand Down
4 changes: 4 additions & 0 deletions lib/config/config.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.