Last updated:
0 purchases
flutter shortcut plus
flutter_shortcut_plus #
Flutter plugin for creating static & dynamic app/conversation shortcuts on home screen. Supports iOS android
Fork #
Address of the original author,
Adapt iOS based on this code
Demo #
Quick Start #
Step 1: Include plugin to your project #
dependencies:
flutter_shortcut_plus: <latest version>
copied to clipboard
Run pub get and get packages.
Step 2: Initialize Flutter Shortcuts (Optional) #
Officially Supported Platforms/Implementations:
Android
FlutterShortcut.initialize(debug: true);
copied to clipboard
Example #
Define Shortcut Action #
FlutterShortcut.listenAction((String incomingAction) {
setState(() {
if (incomingAction != null) {
action = incomingAction;
}
});
});
copied to clipboard
Get Max Shortcut Limit #
Return the maximum number of static and dynamic shortcuts that each launcher icon can have at a time.
Officially Supported Platforms/Implementations:
Android
int? result = await FlutterShortcut.getMaxShortcutLimit();
copied to clipboard
Shortcut Icon Asset #
Flutter Shortcuts allows you to create shortcut icon from both android drawable or mipmap and flutter Assets.
Android resources, drawable or mipmap.
iOS resources , Assets.xcassets
use: ShortcutIconAsset.nativeAsset
ShortcutItem(
id: "2",
action: 'shortcut.messages',
shortLabel: 'Messages',
icon: "message",
shortcutIconAsset: ShortcutIconAsset.nativeAsset,
),
copied to clipboard
If you want to create shortcut icon from flutter asset. (DEFAULT)
use: ShortcutIconAsset.flutterAsset
ShortcutItem(
id: "1",
action: 'shortcut.scan',
shortLabel: 'Scan code',
icon: 'assets/scan.png',
shortcutIconAsset: ShortcutIconAsset.flutterAsset,
),
copied to clipboard
Set shortcut items #
Publishes the list of shortcuts. All existing shortcuts will be replaced.
FlutterShortcut.setShortcutItems(
shortcutItems: <ShortcutItem>[
const ShortcutItem(
id: "1",
action: 'shortcut.scan',
shortLabel: 'Scan code',
icon: 'assets/scan.png',
),
const ShortcutItem(
id: "2",
action: 'shortcut.messages',
shortLabel: 'Messages',
icon: "messages",
shortcutIconAsset: ShortcutIconAsset.nativeAsset,
),
],
),
copied to clipboard
Clear shortcut item #
Delete all dynamic shortcuts from the app.
FlutterShortcut.clearShortcutItems();
copied to clipboard
Push Shortcut Item #
Push a new shortcut item. If there is already a dynamic or pinned shortcut with the same ID, the shortcut will be updated and pushed at the end of the shortcut list.
FlutterShortcut.pushShortcutItem(
shortcut: ShortcutItem(
id: "2",
action: 'shortcut.messages',
shortLabel: 'Messages',
icon: "messages",
shortcutIconAsset: ShortcutIconAsset.nativeAsset,
),
);
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.