A plugin to implement Android native App shortcut and IOS quick actions
Android | IOS |
---|---|
Go to the plugin official pub.dev page to install
Review this file to get full example usages
Add a new shortcut
FlutterAppShortcut().push(
ShortcutArg(
id: 'id_1',
title: 'Home page',
iconResourceName: 'ic_android_black',
flutterIconPath: 'asset/ic_heart.png',
androidArg: AndroidArg(
longLabel: 'Go to Home page',
uri: 'https://www.google.com',
)
);
)
Add a new icon with asset in native side
- Add icon resource to
android/app/src/main/res
- Set
iconResourceName
to the same name as the added icon in previous step
Add a new icon with asset in flutter side
- Add icon resource to assets folder
- Add icon path to pubspec.yaml
- set
flutterIconPath
to your path in flutter asset folder. Exassets/ic_heart.png
FlutterAppShortcut().push(
ShortcutArg(
id: 'id_1',
title: 'Home page',
iconResourceName: 'register',
iosArg: IosArg(subtitle: 'My subtitle'),
);
)
Add a new icon
- Add image set using Xcode
- Set
iconResourceName
to the same name as the added icon in previous step
'x' means the operation is supported on platform
Name | IOS | Android | Note |
---|---|---|---|
getAll | x | x | |
set | x | x | |
push | x | x | |
removeById | x | x | |
removeAll | x | x | |
enableShortcuts | x | ||
disableShortcuts | x | API < 24 -> disable == remove |
Arguments with platform prefix is only supported on said platform For example: AndroidArg only supports Android
Name | Type | Requirements | Description |
---|---|---|---|
id | String | Unique, Not empty | When pushing shortcuts with the same ID, the existing one is updated |
title | String | Not empty | App short cut label (title) |
iconResourceName | String | Icon resource name from native side (see below for usage) | |
flutterIconPath | String | Icon resource path from flutter side | |
androidArg | AndroidArg | Extra arguments for Android shortcuts | |
androidReadOnlyArg | AndroidReadOnlyArg | Read only args when call get shortcuts, if set from dart side, nothing happens | |
iosArg | IosArg | Extra arguments for IOS shortcuts |
Name | Type | Requirements | Description |
---|---|---|---|
longLabel | String | if there is enough space on the device, longLabel replaces title | |
uri | String | Uri when click on shortcut |
Name | Type | Requirements | Description |
---|---|---|---|
subtitle | String | Subtitle of the shortcut |
Limitations by either platform or because this plugin does not support it yet
- Pinned shortcut cannot be removed, only disabled
- Shortcut after disabled cannot be enabled, however, pinned shortcut can
- Cannot return icon name when cal getShortcuts
- Max 4 shortcuts can be displayed at once
- Cannot return icon name when cal getShortcuts
- Max 4 shortcuts can be displayed at once
- Cannot use icon from flutter side (will implement in the future)
- On click short cut does not support deeplink (will implement in the future)
- Allow icon from flutter side
- Enable deeplink navigation on click shortcut
For bugs please use GitHub Issues. For questions, ideas, and discussions use GitHub Discussions.