Flutter plugin for creating static & dynamic app shortcuts on the home screen.

Overview

Flutter Shortcuts

GitHub GitHub code size in bytes GitHub top language GitHub language count GitHub tag (latest by date) GitHub issues GitHub Repo stars GitHub forks

Show some ❤️ and the repo

Why use Flutter Shortcuts?

Flutter Shortcuts Plugin is known for :

Flutter Shortcuts
Fast, performant & compatible
Free & Open-source
Production ready
Make App Reactive

Features

All the features listed below can be performed at the runtime.

  Create Shortcuts
  Clear Shortcuts
  Update Shortcuts
  Use both flutter and android asset as shortcut icon

Demo

Quick Start

Step 1: Include plugin to your project

dependencies:
  flutter_shortcuts: <latest version>

Run pub get and get packages.

Step 2: Instantiate Flutter Shortcuts Plugin

final FlutterShortcuts flutterShortcuts = FlutterShortcuts();

Step 3: Initialize Flutter Shortcuts

flutterShortcuts.initialize(debug: true);

Example

Define Shortcut Action

flutterShortcuts.listenAction((String incomingAction) {
    setState(() {
    if (incomingAction != null) {
        action = incomingAction;
    }
  });
});

Get Max Shortcut Limit

Return the maximum number of static and dynamic shortcuts that each launcher icon can have at a time.

int? result = await flutterShortcuts.getMaxShortcutLimit();

Shortcut Icon Asset

Flutter Shortcuts allows you to create shortcut icon from both android drawable or mipmap and flutter Assets.

  • If you want to use icon from Android resources, drawable or mipmap.

use: ShortcutIconAsset.androidAsset

FlutterShortcutItem(
  id: "2",
  action: 'Bookmark page action',
  shortLabel: 'Bookmark Page',
  icon: "ic_launcher",
  shortcutIconAsset: ShortcutIconAsset.androidAsset,
),
  • If you want to create shortcut icon from flutter asset. (DEFAULT)

use: ShortcutIconAsset.flutterAsset

FlutterShortcutItem(
  id: "2",
  action: 'Bookmark page action',
  shortLabel: 'Bookmark Page',
  icon: 'assets/icons/bookmark.png',
  shortcutIconAsset: ShortcutIconAsset.flutterAsset,
),

Set shortcut items

Publishes the list of shortcuts. All existing shortcuts will be replaced.

flutterShortcuts.setShortcutItems(
  shortcutItems: <FlutterShortcutItem>[
    const FlutterShortcutItem(
      id: "1",
      action: 'Home page action',
      shortLabel: 'Home Page',
      icon: 'assets/icons/home.png',
    ),
    const FlutterShortcutItem(
      id: "2",
      action: 'Bookmark page action',
      shortLabel: 'Bookmark Page',
      icon: "ic_launcher",
      shortcutIconAsset: ShortcutIconAsset.androidAsset,
    ),
  ],
),

Clear shortcut item

Delete all dynamic shortcuts from the app.

flutterShortcuts.clearShortcutItems();

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.

flutterShortcuts.pushShortcutItem(
  shortcut: FlutterShortcutItem(
    id: "5",
    action: "Play Music Action",
    shortLabel: "Play Music",
    icon: 'assets/icons/music.png',
  ),
);

Push Shortcut Items

Pushes a list of 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.

flutterShortcuts.pushShortcutItems(
  shortcutList: <FlutterShortcutItem>[
    const FlutterShortcutItem(
      id: "1",
      action: 'Home page new action',
      shortLabel: 'Home Page',
      icon: 'assets/icons/home.png',
    ),
    const FlutterShortcutItem(
      id: "2",
      action: 'Bookmark page new action',
      shortLabel: 'Bookmark Page',
      icon: 'assets/icons/bookmark.png',
    ),
    const FlutterShortcutItem(
      id: "3",
      action: 'Settings Action',
      shortLabel: 'Setting',
      icon: 'assets/icons/settings.png',
    ),
  ],
);

Update Shortcut Item

Updates a single shortcut item based on id. If the ID of the shortcut is not same, no changes will be reflected.

flutterShortcuts.updateShortcutItem(
  shortcut: FlutterShortcutItem(
    id: "1",
    action: 'Go to url action',
    shortLabel: 'Visit Page',
    icon: 'assets/icons/url.png',
  ),
);

Update Shortcut Items

Updates shortcut items. If the IDs of the shortcuts are not same, no changes will be reflected.

flutterShortcuts.updateShortcutItems(
 shortcutList: <FlutterShortcutItem>[
   const FlutterShortcutItem(
     id: "1",
     action: 'Resume playing Action',
     shortLabel: 'Resume playing',
     icon: 'assets/icons/play.png',
   ),
   const FlutterShortcutItem(
     id: "2",
     action: 'Search Songs Action',
     shortLabel: 'Search Songs',
     icon: 'assets/icons/search.png',
   ),
 ],
);

Change Shortcut Item Icon

Change the icon of the shortcut based on id. If the ID of the shortcut is not same, no changes will be reflected.

flutterShortcuts.changeShortcutItemIcon(
  id: "2",
  icon: "assets/icons/next.png",
);

Get shortcut icon properties

Get the icon properties of your shortcut icon.

Map<String, int> result = await flutterShortcuts.getIconProperties();
print( "maxHeight: ${result["maxHeight"]}, maxWidth: ${result["maxWidth"]}");

Project Created & Maintained By

Divyanshu Shekhar

GitHub followers

Subham Praharaj

GitHub followers

Contributions

Contributions are welcomed!

If you feel that a hook is missing, feel free to open a pull-request.

For a custom-hook to be merged, you will need to do the following:

Describe the use-case.

  • Open an issue explaining why we need this hook, how to use it, ... This is important as a hook will not get merged if the hook doens't appeal to a large number of people.

  • If your hook is rejected, don't worry! A rejection doesn't mean that it won't be merged later in the future if more people shows an interest in it. In the mean-time, feel free to publish your hook as a package on https://pub.dev.

  • A hook will not be merged unles fully tested, to avoid breaking it inadvertendly in the future.

Copyright & License

Code and documentation Copyright (c) 2021 Divyanshu Shekhar. Code released under the BSD 3-Clause License.

Comments
  • Use this plugin for conversation shortcut

    Use this plugin for conversation shortcut

    Is it possible to use this plugin to achieve Android conversation shortcut?

    https://developer.android.com/guide/topics/ui/conversations#api-shortcuts

    I parsed quickly the source code but I haven't seen anything related to long lived shortcut so I was wondering if it's possible.

    Thanks in advance !

    enhancement hacktoberfest 
    opened by PapyElGringo 2
  • v1.3.0

    v1.3.0

    Status

    READY/IN DEVELOPMENT/HOLD

    Breaking Changes

    YES | NO

    Description

    Type of Change

    • [x] ✨ New feature (non-breaking change which adds functionality)
    • [ ] 🛠️ Bug fix (non-breaking change which fixes an issue)
    • [x] ❌ Breaking change (fix or feature that would cause existing functionality to change)
    • [x] 🧹 Code refactor
    • [x] ✅ Build configuration change
    • [x] 📝 Documentation
    • [ ] 🗑️ Chore
    opened by divshekhar 1
  • Merge pull request #12 from DevsOnFlutter/dev

    Merge pull request #12 from DevsOnFlutter/dev

    v1.3.0

    Status

    READY

    Breaking Changes

    YES

    Description

    Android create shortcut with icon from storage (image file)

    Type of Change

    Enhancement

    • [x] ✨ New feature (non-breaking change which adds functionality)
    • [ ] 🛠️ Bug fix (non-breaking change which fixes an issue)
    • [ ] ❌ Breaking change (fix or feature that would cause existing functionality to change)
    • [ ] 🧹 Code refactor
    • [ ] ✅ Build configuration change
    • [ ] 📝 Documentation
    • [ ] 🗑️ Chore
    opened by redanium 0
  • v1.2.2

    v1.2.2

    Status

    READY/IN DEVELOPMENT/HOLD

    Breaking Changes

    YES | NO

    Description

    Type of Change

    • [ ] ✨ New feature (non-breaking change which adds functionality)
    • [ ] 🛠️ Bug fix (non-breaking change which fixes an issue)
    • [ ] ❌ Breaking change (fix or feature that would cause existing functionality to change)
    • [ ] 🧹 Code refactor
    • [ ] ✅ Build configuration change
    • [x] 📝 Documentation
    • [ ] 🗑️ Chore
    opened by divshekhar 0
  • v1.2.1

    v1.2.1

    Status

    READY/IN DEVELOPMENT/HOLD

    Breaking Changes

    YES | NO

    Description

    Type of Change

    • [ x] ✨ New feature (non-breaking change which adds functionality)
    • [ ] 🛠️ Bug fix (non-breaking change which fixes an issue)
    • [ ] ❌ Breaking change (fix or feature that would cause existing functionality to change)
    • [ ] 🧹 Code refactor
    • [ ] ✅ Build configuration change
    • [ ] 📝 Documentation
    • [ ] 🗑️ Chore
    opened by divshekhar 0
  • label api discarded

    label api discarded

    Status

    READY/IN DEVELOPMENT/HOLD

    Breaking Changes

    YES | NO

    Description

    Type of Change

    • [ ] ✨ New feature (non-breaking change which adds functionality)
    • [ ] 🛠️ Bug fix (non-breaking change which fixes an issue)
    • [ ] ❌ Breaking change (fix or feature that would cause existing functionality to change)
    • [ ] 🧹 Code refactor
    • [ ] ✅ Build configuration change
    • [ ] 📝 Documentation
    • [ ] 🗑️ Chore
    opened by divshekhar 0
  • Create shortcut icon with flutter and native android resources.

    Create shortcut icon with flutter and native android resources.

    Is your feature request related to a problem? Please describe. Option to create shortcut icon with flutter and native android resources.

    Describe the solution you'd like Create an enum.

    opened by divshekhar 0
  • Support setCategories

    Support setCategories

    Hi!

    Thanks a lot for your plugin!

    I would like to know if you could support the setCategories method in the ShortcutInfoCompat.Builder. I need this field to be filled in my app.

    Thanks!

    opened by g123k 1
Releases(v1.3.0)
  • v1.3.0(Dec 25, 2021)

    Update (v1.3.0)

    • Breaking Change renamed FlutterShortcutsItem to ShortcutItem
    • Extra fields added in ShortcutItem
    • (bool) conversationShortcut make conversation shortcuts
    • (bool) isImportant set conversation shortcut importance
    • (bool) isBot set is conversation shortcut bot
    Source code(tar.gz)
    Source code(zip)
  • v1.2.2(Jul 2, 2021)

  • v1.2.1(Jun 27, 2021)

  • v1.2.0(May 26, 2021)

  • v1.1.0(May 25, 2021)

    • Breaking Change updateShortcutItem doesn't take id.
    • Breaking Change changeShortcutItemIcon icon property is by default set to ShortcutIconAsset.flutterAsset.
    • New Feature FlutterShortcutItem new field shortcutIconAsset.
    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(May 23, 2021)

    Features:

    • initialize
    • getMaxShortcutLimit
    • setShortcutItems
    • clearShortcutItems
    • pushShortcutItem
    • addShortcutItems
    • updateShortcutItems
    • updateShortcutItem
    • changeShortcutItemIcon
    Source code(tar.gz)
    Source code(zip)
Owner
Divyanshu Shekhar
Student | Developer
Divyanshu Shekhar
Shortcuts and actions - Spice up your Flutter Desktop/Web apps with Shortcuts and Actions

Spice up your Flutter Desktop/Web apps with Shortcuts and Actions A desktop/web

Waleed Arshad 12 Nov 20, 2022
A Flutter plugin for changing the Home Screen, Lock Screen (or both) Wallpaper on Android devices.

wallpaper_manager A Flutter plugin for changing the Home Screen, Lock Screen (or both) Wallpaper(s) on Android devices. Usage Installation In the pubs

Aditya Mulgundkar 38 Nov 28, 2022
Dart library for creating static trees of execution.

Processing tree Dart library for building and executing static trees of execution created in runtime. When to use it The main idea behind usage of thi

The Tosters 1 Dec 20, 2021
Awesome Flutter Snippets is a collection snippets and shortcuts for commonly used Flutter functions and classes

Awesome Flutter Snippets Awesome Flutter Snippets is a collection of commonly used Flutter classes and methods. It increases your speed of development

Neevash Ramdial (Nash) 139 Dec 9, 2022
Home app - A dynamic flutter app which can be used to generate alerts, set alarms and send sms or call someone

first_app A dynamic flutter app which can be used to generate alerts, set alarms

null 0 Apr 9, 2022
Dynamic var - Dart dilinde dynamic ve var veri tiplerini anlamanızı kolaylaştıracak örnektir.

dynamic ve var arasındaki fark dynamic Tanımlanan değişkenin tipi daha sonra kod içerisinde değişebilir. Örneğin int olarak tanımlanan bir a değişkeni

Abdullah Sevmez 0 Jan 1, 2022
Home-Service-App - Home Service App Built With Flutter

Home-Service-App Home Service App Sample Images

Justin Roy 2 Sep 4, 2022
Smart home UI - A Flutter UI for Smart Home App

smart_home_app UI for Smart Home App Images

Aymen Ziouche 11 Dec 22, 2022
Flutter plugin to manage home screen widget within flutter app.

Flutter App Widget App Widget / Home Screen widget plugin for flutter app Usage Please see app_widget subdirectory for the usage documentation. Plafor

Alexander Dischberg 6 Dec 16, 2022
Doctor Consultation App in Flutter containing splash screen on boarding screen Routing state management Dash board Bottom navigation Decorated Drawer and Doctors Screen in the last.

Online doctor Consultation App UI in Flutter Doctor Consultation App UI in Flutter Visit Website Features State Management Navigation Bar Responsive D

Habib ullah 14 Jan 1, 2023
Android test task master - Create PIN code screen, authentication by PIN code screen and menu screen

Here is described test tasks for a android dev. Need to implement three screens:

null 3 Oct 4, 2022
Esizer - A Flutter package provide responsive, dynamic, configurable size for each device screen size

ESizer A Flutter package provide responsive, dynamic, configurable size for each

Extreme Vietnam Public 1 Feb 15, 2022
A Flutter App with animation on login and home screen

Animação com Flutter Sobre: App com animação na tela de login e home. Obs: Sem validação, somente foi feito o teste para animação da tela Imagens: LOG

null 2 Nov 9, 2022
A fully-featured Last.fm client and scrobbler with Shazam-like scrobbling, a collage generator, home screen widgets, and more!

Finale A fully-featured Last.fm client and scrobbler with Shazam-like scrobbling, a collage generator, and more! The app is available on iOS, Android,

Noah Rubin 66 Jan 5, 2023
Flutterbodydetection - A flutter plugin that uses MLKit on iOS/Android platforms to enable body pose and mask detection using Pose Detection and Selfie Segmentation APIs for both static images and live camera stream.

body_detection A flutter plugin that uses MLKit on iOS/Android platforms to enable body pose and mask detection using Pose Detection and Selfie Segmen

null 18 Dec 5, 2022
Application to practice creating different types of screen in flutter

Diseño de paginas en flutter. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this i

Diego Martinez 2 Nov 29, 2021
The read-a-book app is using static data. the application I developed has a homepage and detail page

book_app A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this

Adil Ahmet Sargın 1 Nov 12, 2021
Eder Zambrano 0 Feb 13, 2022
A Flutter plugin to use iOS 16.1+ Live Activities ⛹️ & iPhone 14 Pro Dynamic Island ⚫️ features

Live Activities A Flutter plugin to use iOS 16.1+ Live Activities & iPhone 14 Pro Dynamic Island features. ?? What is it ? This plugin use iOS Activit

Dimitri Dessus 53 Dec 26, 2022