Skip to content

Commit

Permalink
v1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
divshekhar committed Dec 25, 2021
1 parent 6b5c20b commit 0bb9afe
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 36 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 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

## v1.2.2

* Compatibility added in Readme
Expand Down
69 changes: 53 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

![GitHub](https://img.shields.io/github/license/DevsOnFlutter/flutter_shortcuts?style=plastic) ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/DevsOnFlutter/flutter_shortcuts?style=plastic) ![GitHub top language](https://img.shields.io/github/languages/top/DevsOnFlutter/flutter_shortcuts?style=plastic) ![GitHub language count](https://img.shields.io/github/languages/count/DevsOnFlutter/flutter_shortcuts?style=plastic) ![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/DevsOnFlutter/flutter_shortcuts?style=plastic) ![GitHub issues](https://img.shields.io/github/issues/DevsOnFlutter/flutter_shortcuts?style=plastic) ![GitHub Repo stars](https://img.shields.io/github/stars/DevsOnFlutter/flutter_shortcuts?style=social) ![GitHub forks](https://img.shields.io/github/forks/DevsOnFlutter/flutter_shortcuts?style=social)

## Compatibility
## Compatibility

&nbsp; Android </br>
&nbsp; iOS (active issue: [iOS support for quick actions](https://github.com/DevsOnFlutter/flutter_shortcuts/issues/1))
Expand All @@ -29,6 +29,7 @@ All the features listed below can be performed at the runtime.
&nbsp; Create Shortcuts </br>
&nbsp; Clear Shortcuts </br>
&nbsp; Update Shortcuts </br>
&nbsp; Conversation Shortcuts </br>
&nbsp; Use both flutter and android asset as shortcut icon </br>

## Demo
Expand Down Expand Up @@ -90,7 +91,7 @@ Flutter Shortcuts allows you to create shortcut icon from both android `drawable
use: `ShortcutIconAsset.androidAsset`

```dart
FlutterShortcutItem(
ShortcutItem(
id: "2",
action: 'Bookmark page action',
shortLabel: 'Bookmark Page',
Expand All @@ -104,7 +105,7 @@ FlutterShortcutItem(
use: `ShortcutIconAsset.flutterAsset`

```dart
FlutterShortcutItem(
ShortcutItem(
id: "2",
action: 'Bookmark page action',
shortLabel: 'Bookmark Page',
Expand All @@ -119,14 +120,14 @@ Publishes the list of shortcuts. All existing shortcuts will be replaced.

```dart
flutterShortcuts.setShortcutItems(
shortcutItems: <FlutterShortcutItem>[
const FlutterShortcutItem(
shortcutItems: <ShortcutItem>[
const ShortcutItem(
id: "1",
action: 'Home page action',
shortLabel: 'Home Page',
icon: 'assets/icons/home.png',
),
const FlutterShortcutItem(
const ShortcutItem(
id: "2",
action: 'Bookmark page action',
shortLabel: 'Bookmark Page',
Expand All @@ -151,7 +152,7 @@ Push a new shortcut item. If there is already a dynamic or pinned shortcut with

```dart
flutterShortcuts.pushShortcutItem(
shortcut: FlutterShortcutItem(
shortcut: ShortcutItem(
id: "5",
action: "Play Music Action",
shortLabel: "Play Music",
Expand All @@ -166,20 +167,20 @@ Pushes a list of shortcut item. If there is already a dynamic or pinned shortcut

```dart
flutterShortcuts.pushShortcutItems(
shortcutList: <FlutterShortcutItem>[
const FlutterShortcutItem(
shortcutList: <ShortcutItem>[
const ShortcutItem(
id: "1",
action: 'Home page new action',
shortLabel: 'Home Page',
icon: 'assets/icons/home.png',
),
const FlutterShortcutItem(
const ShortcutItem(
id: "2",
action: 'Bookmark page new action',
shortLabel: 'Bookmark Page',
icon: 'assets/icons/bookmark.png',
),
const FlutterShortcutItem(
const ShortcutItem(
id: "3",
action: 'Settings Action',
shortLabel: 'Setting',
Expand All @@ -195,7 +196,7 @@ Updates a single shortcut item based on id. If the ID of the shortcut is not sam

```dart
flutterShortcuts.updateShortcutItem(
shortcut: FlutterShortcutItem(
shortcut: ShortcutItem(
id: "1",
action: 'Go to url action',
shortLabel: 'Visit Page',
Expand All @@ -210,14 +211,14 @@ flutterShortcuts.updateShortcutItem(

```dart
flutterShortcuts.updateShortcutItems(
shortcutList: <FlutterShortcutItem>[
const FlutterShortcutItem(
shortcutList: <ShortcutItem>[
const ShortcutItem(
id: "1",
action: 'Resume playing Action',
shortLabel: 'Resume playing',
icon: 'assets/icons/play.png',
),
const FlutterShortcutItem(
const ShortcutItem(
id: "2",
action: 'Search Songs Action',
shortLabel: 'Search Songs',
Expand All @@ -227,6 +228,42 @@ flutterShortcuts.updateShortcutItems(
);
```

### Set Conversation Shortcut

Set `conversationShortcut: true` in ShortcutItem to make the shortcut as conversation shortcut.

The conversation shortcut can also be set as important and bot by setting `isImportant: true` & `isBot: true`.

```dart
await flutterShortcuts.pushShortcutItems(
shortcutList: <ShortcutItem>[
const ShortcutItem(
id: "1",
action: 'open_chat_1',
shortLabel: 'Divyanshu Shekhar',
icon: 'assets/icons/home.png',
conversationShortcut: true,
isImportant: true,
),
const ShortcutItem(
id: "2",
action: 'oepn_chat_2',
shortLabel: 'Subham Praharaj',
icon: 'assets/icons/bookmark.png',
conversationShortcut: true,
),
const ShortcutItem(
id: "3",
action: 'oepn_chat_3',
shortLabel: 'Auto Reply Bot',
icon: 'assets/icons/url.png',
conversationShortcut: true,
isBot: true,
),
],
);
```

### 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.
Expand Down Expand Up @@ -291,4 +328,4 @@ Describe the use-case.

## Copyright & License

Code and documentation Copyright (c) 2021 [Divyanshu Shekhar](https://divyanshushekhar.com). Code released under the [BSD 3-Clause License](./LICENSE).
Code and documentation Copyright (c) 2021 [Divyanshu Shekhar](https://hackthedeveloper.com). Code released under the [BSD 3-Clause License](./LICENSE).
34 changes: 17 additions & 17 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ class _MyAppState extends State<MyApp> {
child: Text("Set Shortcuts"),
onPressed: () async {
await flutterShortcuts.setShortcutItems(
shortcutItems: <FlutterShortcutItem>[
const FlutterShortcutItem(
shortcutItems: <ShortcutItem>[
const ShortcutItem(
id: "1",
action: 'Home page action',
shortLabel: 'Home Page',
icon: 'assets/icons/home.png',
),
const FlutterShortcutItem(
const ShortcutItem(
id: "2",
action: 'Bookmark page action',
shortLabel: 'Bookmark Page',
Expand Down Expand Up @@ -118,7 +118,7 @@ class _MyAppState extends State<MyApp> {
child: Text("push Shortcut Item"),
onPressed: () async {
await flutterShortcuts.pushShortcutItem(
shortcut: FlutterShortcutItem(
shortcut: ShortcutItem(
id: "5",
action: "Play Music Action",
shortLabel: "Play Music",
Expand All @@ -131,14 +131,14 @@ class _MyAppState extends State<MyApp> {
child: Text("Update all shortcuts"),
onPressed: () async {
await flutterShortcuts.updateShortcutItems(
shortcutList: <FlutterShortcutItem>[
const FlutterShortcutItem(
shortcutList: <ShortcutItem>[
const ShortcutItem(
id: "1",
action: 'Resume playing Action',
shortLabel: 'Resume playing',
icon: 'assets/icons/play.png',
),
const FlutterShortcutItem(
const ShortcutItem(
id: "2",
action: 'Search Songs Action',
shortLabel: 'Search Songs',
Expand All @@ -157,20 +157,20 @@ class _MyAppState extends State<MyApp> {
child: Text("Add Shortcut"),
onPressed: () async {
await flutterShortcuts.pushShortcutItems(
shortcutList: <FlutterShortcutItem>[
const FlutterShortcutItem(
shortcutList: <ShortcutItem>[
const ShortcutItem(
id: "1",
action: 'Home page new action',
shortLabel: 'Home Page',
icon: 'assets/icons/home.png',
),
const FlutterShortcutItem(
const ShortcutItem(
id: "2",
action: 'Bookmark page new action',
shortLabel: 'Bookmark Page',
icon: 'assets/icons/bookmark.png',
),
const FlutterShortcutItem(
const ShortcutItem(
id: "3",
action: 'Settings Action',
shortLabel: 'Setting',
Expand All @@ -184,7 +184,7 @@ class _MyAppState extends State<MyApp> {
child: Text("Update Shortcut with ID"),
onPressed: () {
flutterShortcuts.updateShortcutItem(
shortcut: FlutterShortcutItem(
shortcut: ShortcutItem(
id: "1",
action: 'Go to url action',
shortLabel: 'Visit Page',
Expand Down Expand Up @@ -228,24 +228,24 @@ class _MyAppState extends State<MyApp> {
ElevatedButton(
child: Text("Set conversation Shortcut"),
onPressed: () async {
await flutterShortcuts.pushShortcutItems(
shortcutList: <FlutterShortcutItem>[
const FlutterShortcutItem(
await flutterShortcuts.setShortcutItems(
shortcutItems: <ShortcutItem>[
const ShortcutItem(
id: "1",
action: 'open_chat_1',
shortLabel: 'Divyanshu Shekhar',
icon: 'assets/icons/home.png',
conversationShortcut: true,
isImportant: true,
),
const FlutterShortcutItem(
const ShortcutItem(
id: "2",
action: 'oepn_chat_2',
shortLabel: 'Subham Praharaj',
icon: 'assets/icons/bookmark.png',
conversationShortcut: true,
),
const FlutterShortcutItem(
const ShortcutItem(
id: "3",
action: 'oepn_chat_3',
shortLabel: 'Auto Reply Bot',
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ packages:
path: ".."
relative: true
source: path
version: "1.2.2"
version: "1.3.0"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_shortcuts
description: Flutter plugin for creating static & dynamic app shortcuts on home screen.
version: 1.2.2
description: Flutter plugin for creating static & dynamic app/conversation shortcuts on home screen.
version: 1.3.0
repository: https://github.com/DevsOnFlutter/flutter_shortcuts
documentation: https://github.com/DevsOnFlutter/flutter_shortcuts/blob/main/README.md

Expand Down

0 comments on commit 0bb9afe

Please sign in to comment.