ngthailam / flutter_app_short_cut

A Flutter plugin to integrate App shortcuts on Android and IOS
BSD 3-Clause "New" or "Revised" License
3 stars 0 forks source link

flutter_app_shortcut

A plugin to implement Android native App shortcut and IOS quick actions


Android IOS

Getting Started

Where to get it?

Go to the plugin official pub.dev page to install


How to use it?

Review this file to get full example usages

Android

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 a new icon with asset in flutter side

IOS

FlutterAppShortcut().push(
    ShortcutArg(
        id: 'id_1',
        title: 'Home page',
        iconResourceName: 'register',
        iosArg: IosArg(subtitle: 'My subtitle'),
    );
)

Add a new icon



Supported operations

'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

Arguments with platform prefix is only supported on said platform For example: AndroidArg only supports Android

ShortcutArg

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

AndroidArg

Name Type Requirements Description
longLabel String if there is enough space on the device, longLabel replaces title
uri String Uri when click on shortcut


IosArg

Name Type Requirements Description
subtitle String Subtitle of the shortcut



Limitations

Limitations by either platform or because this plugin does not support it yet

Android

TODOs

IOS

Bugs, Ideas, and Feedback

For bugs please use GitHub Issues. For questions, ideas, and discussions use GitHub Discussions.



License

See license