adaptive_app_icon 0.1.0
adaptive_app_icon: ^0.1.0 copied to clipboard
Switch your app's home-screen icon at runtime between pre-bundled variants, with a config-driven codegen system and a drop-in icon gallery widget.
0.1.0 #
Declare one source image per icon; the codegen produces every platform asset and bundles it. No hand-cut densities, and no Xcode Copy Bundle Resources step.
Breaking
- The
ios_asset:key is gone — iOS app-icon sets are now named after the icon itself, so the name is derived. Codegen errors with a migration hint if the key is still present.android_asset:is now optional too, defaulting toic_launcherfor the primary icon andic_launcher_<name>for alternates. - Icon
namemust belower_snake_case: it becomes an iOS app-icon set name and an Android component name. - iOS alternate icons move from loose PNGs in
ios/Runner/to app-icon sets inAssets.xcassets. Delete the oldAppIcon-*@2x.png/@3x.pngfiles in Xcode (codegen warns while any remain); theCFBundleIconsblock that referenced them is stripped fromios/Runner/Info.plistautomatically. See the migration steps in the README.
Added
image:renders the Android density PNGs (mdpi→xxxhdpi, alpha preserved) and the iOS app-icon sets (flattened, since iOS renders an alpha channel as a black square) from a single square master.- Config can live in
pubspec.yamlunderadaptive_app_icon:; a standaloneadaptive_app_icon.yamlstill works as a fallback. - Xcode asset-catalog build settings are set on every build configuration, so alternates are bundled without editing Copy Bundle Resources — the silent blank-icon failure that layout allowed is gone.
background:(per icon or top level) sets what iOS icons are flattened onto.preview:defaults toimage:, so the gallery needs no extra file.--no-imageswires up existing assets without re-rendering.- Codegen warns when a preview isn't declared under
flutter: assets:, which otherwise shows a placeholder at runtime with no error.
Fixed
- The manifest emitted
android:icon="@mipmap/…"even when validation had accepted adrawable-*/resource, producing a reference that failed to resolve. The container is now detected and the matching prefix emitted.
0.0.1 #
Initial release.
- Runtime app-icon switching on iOS (
setAlternateIconName) and Android (activity-aliastoggling). On Android every icon is its own alias and the main activity is never toggled, so switching never disables the running component.androidApplyModechooses when the change lands:whenBackgrounded(default, no visible close) orimmediately(app closes; the user reopens).IconGallery.confirmChangelets you gate a switch behind a dialog. - Config-driven codegen (
dart run adaptive_app_icon:generate_icon_config) that readsadaptive_app_icon.yamland updatesInfo.plist,AndroidManifest.xml, and a typedapp_icons.g.dart, with asset validation and an icon-count warning. - Type-safe native bridge generated with Pigeon.
DynamicAppIconAPI withshared_preferences-backed selection caching.- Drop-in
IconGallerywidget with optimistic selection and rollback.