├── .github ├── CODEOWNERS ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── BUG_REPORT.md │ └── FEATURE_REQUEST.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ └── ci.yml ├── .gitignore ├── .idea ├── flutter_shortcuts.iml ├── libraries │ ├── Dart_SDK.xml │ └── Flutter_Plugins.xml ├── misc.xml ├── modules.xml ├── vcs.xml └── workspace.xml ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── android ├── .classpath ├── .gitignore ├── .idea │ ├── .gitignore │ ├── .name │ ├── caches │ │ └── build_file_checksums.ser │ ├── compiler.xml │ ├── gradle.xml │ ├── jarRepositories.xml │ ├── misc.xml │ ├── modules.xml │ └── vcs.xml ├── .project ├── .settings │ └── org.eclipse.buildship.core.prefs ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── settings.gradle └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── divyanshushekhar │ └── flutter_shortcuts │ ├── FlutterShortcutsPlugin.java │ └── MethodCallImplementation.java ├── example ├── .gitignore ├── .metadata ├── README.md ├── android │ ├── .gitignore │ ├── .project │ ├── .settings │ │ └── org.eclipse.buildship.core.prefs │ ├── app │ │ ├── .classpath │ │ ├── .project │ │ ├── .settings │ │ │ └── org.eclipse.buildship.core.prefs │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── divyanshushekhar │ │ │ │ │ └── flutter_shortcuts_example │ │ │ │ │ └── MainActivity.java │ │ │ └── res │ │ │ │ ├── drawable-v21 │ │ │ │ └── launch_background.xml │ │ │ │ ├── drawable │ │ │ │ ├── bookmark_icon.png │ │ │ │ └── launch_background.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── values-night │ │ │ │ └── styles.xml │ │ │ │ └── values │ │ │ │ └── styles.xml │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── assets │ ├── icons │ │ ├── arrows.png │ │ ├── bookmark.png │ │ ├── home.png │ │ ├── music.png │ │ ├── next.png │ │ ├── play.png │ │ ├── search.png │ │ ├── settings.png │ │ └── url.png │ └── svg │ │ ├── play-button.svg │ │ ├── settings.svg │ │ └── share.svg ├── ios │ ├── .gitignore │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ │ ├── Info.plist │ │ └── Runner-Bridging-Header.h ├── lib │ └── main.dart ├── pubspec.lock ├── pubspec.yaml └── test │ └── widget_test.dart ├── flutter_shortcuts.iml ├── ios ├── .gitignore ├── Assets │ └── .gitkeep ├── Classes │ ├── FlutterShortcutsPlugin.h │ ├── FlutterShortcutsPlugin.m │ └── SwiftFlutterShortcutsPlugin.swift └── flutter_shortcuts.podspec ├── lib ├── flutter_shortcuts.dart └── src │ ├── helper │ ├── action │ │ └── shortcut_action.dart │ ├── enums │ │ └── shortcut_icon_asset.dart │ ├── helper.dart │ └── model │ │ └── shortcut_item.dart │ ├── method_call │ └── flutter_shortcuts_method_call_handler.dart │ └── platform │ └── flutter_shortcuts_platform.dart ├── pubspec.lock ├── pubspec.yaml └── test └── flutter_shortcuts_test.dart /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Every request must be reviewed and accepted by: 2 | 3 | * @divshekhar -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [divshekhar] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: ["https://paypal.me/dshekhar17"] 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/BUG_REPORT.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | 5 | --- 6 | 7 | **Describe the bug** 8 | A clear and concise description of what the bug is. 9 | 10 | **To Reproduce** 11 | Steps to reproduce the behavior: 12 | 1. Go to '...' 13 | 2. Click on '....' 14 | 3. Scroll down to '....' 15 | 4. See error 16 | 17 | **Expected behavior** 18 | A clear and concise description of what you expected to happen. 19 | 20 | **Screenshots** 21 | If applicable, add screenshots to help explain your problem. 22 | 23 | **Logs ** 24 | Run `flutter analyze` and attach any output of that command below. 25 | If there are any analysis errors, try resolving them before filing this issue. 26 | 27 | Paste the output of running `flutter doctor -v` here. 28 | 29 | **Additional context** 30 | Add any other context about the problem here. -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | **Is your feature request related to a problem? Please describe.** 8 | A clear and concise description of what the problem is. 9 | 10 | **Describe the solution you'd like** 11 | A clear and concise description of what you want to happen. 12 | 13 | **Describe alternatives you've considered** 14 | A clear and concise description of any alternative solutions or features you've considered. 15 | 16 | **Additional context** 17 | Add any other context or screenshots about the feature request here. -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 8 | 9 | ## Status 10 | 11 | **READY/IN DEVELOPMENT/HOLD** 12 | 13 | ## Breaking Changes 14 | 15 | YES | NO 16 | 17 | ## Description 18 | 19 | 20 | 21 | ## Type of Change 22 | 23 | 24 | 25 | - [ ] ✨ New feature (non-breaking change which adds functionality) 26 | - [ ] 🛠️ Bug fix (non-breaking change which fixes an issue) 27 | - [ ] ❌ Breaking change (fix or feature that would cause existing functionality to change) 28 | - [ ] 🧹 Code refactor 29 | - [ ] ✅ Build configuration change 30 | - [ ] 📝 Documentation 31 | - [ ] 🗑️ Chore -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | pull_request: 5 | branches: [main] 6 | 7 | jobs: 8 | build: 9 | runs-on: ubuntu-latest 10 | 11 | steps: 12 | - uses: actions/checkout@v2 13 | # Setup the flutter environment. 14 | - uses: subosito/flutter-action@v1.4.0 15 | 16 | - name: Install Dependencies 17 | run: flutter packages get 18 | 19 | - name: Format 20 | run: flutter format --set-exit-if-changed lib 21 | 22 | - name: Analyze 23 | run: flutter analyze --no-pub 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | .packages 5 | .pub/ 6 | 7 | build/ 8 | -------------------------------------------------------------------------------- /.idea/flutter_shortcuts.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /.idea/libraries/Dart_SDK.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /.idea/libraries/Flutter_Plugins.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 18 | 19 | 21 | 22 | 23 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 1622026976188 48 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 1d9032c7e1d867f071f2277eb1673e8f9b0274e3 8 | channel: stable 9 | 10 | project_type: plugin 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## v1.3.0 2 | 3 | * **Breaking Change** renamed `FlutterShortcutsItem` to `ShortcutItem` 4 | * Extra fields added in ShortcutItem 5 | * `(bool) conversationShortcut` make conversation shortcuts 6 | * `(bool) isImportant` set conversation shortcut importance 7 | * `(bool) isBot` set is conversation shortcut bot 8 | 9 | ## v1.2.2 10 | 11 | * Compatibility added in Readme 12 | 13 | ## v1.2.1 14 | 15 | * **Optimised Shortcuts** 16 | * Readme updated 17 | 18 | ## v1.2.0 19 | 20 | * **Breaking Change** renamed `initialize` to `listenAction`. 21 | * **Breaking Change** `initialize` takes bool debug. 22 | 23 | ## v1.1.0 24 | 25 | * **Breaking Change** `updateShortcutItem` doesn't take id. 26 | * **Breaking Change** `changeShortcutItemIcon` icon property is by default set to `ShortcutIconAsset.flutterAsset`. 27 | * **New Feature** `FlutterShortcutItem` new field `shortcutIconAsset`. 28 | 29 | ## v1.0.1 30 | 31 | * Demo provided in README 32 | 33 | ## v1.0.0 34 | 35 | * Initial Development Release 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | (c) Copyright 2021 divshekhar (Divyanshu Shekhar) 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | 3. Neither the name of the copyright holder nor the names of its contributors 16 | may be used to endorse or promote products derived from this software without 17 | specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 22 | THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 24 | OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 26 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 27 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Flutter Shortcuts 2 | 3 | 4 | 5 | ![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) 6 | 7 | ## Compatibility 8 | 9 | ✅   Android
10 | ❌   iOS (active issue: [iOS support for quick actions](https://github.com/DevsOnFlutter/flutter_shortcuts/issues/1)) 11 | 12 | ## Show some :heart: and :star: the repo 13 | 14 | ## Why use Flutter Shortcuts? 15 | 16 | Flutter Shortcuts Plugin is known for : 17 | 18 | | Flutter Shortcuts | 19 | | :--------------------------------- | 20 | | Fast, performant & compatible | 21 | | Free & Open-source | 22 | | Production ready | 23 | | Make App Reactive | 24 | 25 | ## Features 26 | 27 | All the features listed below can be performed at the runtime. 28 | 29 | ✅   Create Shortcuts
30 | ✅   Clear Shortcuts
31 | ✅   Update Shortcuts
32 | ✅   Conversation Shortcuts
33 | ✅   Use both flutter and android asset as shortcut icon
34 | 35 | ## Demo 36 | 37 | || 38 | |---| 39 | 40 | ## Quick Start 41 | 42 | ### Step 1: Include plugin to your project 43 | 44 | ```yml 45 | dependencies: 46 | flutter_shortcuts: 47 | ``` 48 | 49 | Run pub get and get packages. 50 | 51 | ### Step 2: Instantiate Flutter Shortcuts Plugin 52 | 53 | ```dart 54 | final FlutterShortcuts flutterShortcuts = FlutterShortcuts(); 55 | ``` 56 | 57 | ### Step 3: Initialize Flutter Shortcuts 58 | 59 | ```dart 60 | flutterShortcuts.initialize(debug: true); 61 | ``` 62 | 63 | ## Example 64 | 65 | ### Define Shortcut Action 66 | 67 | ```dart 68 | flutterShortcuts.listenAction((String incomingAction) { 69 | setState(() { 70 | if (incomingAction != null) { 71 | action = incomingAction; 72 | } 73 | }); 74 | }); 75 | ``` 76 | 77 | ### Get Max Shortcut Limit 78 | 79 | Return the maximum number of static and dynamic shortcuts that each launcher icon can have at a time. 80 | 81 | ```dart 82 | int? result = await flutterShortcuts.getMaxShortcutLimit(); 83 | ``` 84 | 85 | ### Shortcut Icon Asset 86 | 87 | Flutter Shortcuts allows you to create shortcut icon from both android `drawable` or `mipmap` and flutter Assets. 88 | 89 | * If you want to use icon from Android resources, `drawable` or `mipmap`. 90 | 91 | use: `ShortcutIconAsset.androidAsset` 92 | 93 | ```dart 94 | ShortcutItem( 95 | id: "2", 96 | action: 'Bookmark page action', 97 | shortLabel: 'Bookmark Page', 98 | icon: "ic_launcher", 99 | shortcutIconAsset: ShortcutIconAsset.androidAsset, 100 | ), 101 | ``` 102 | 103 | * If you want to create shortcut icon from flutter asset. (DEFAULT) 104 | 105 | use: `ShortcutIconAsset.flutterAsset` 106 | 107 | ```dart 108 | ShortcutItem( 109 | id: "2", 110 | action: 'Bookmark page action', 111 | shortLabel: 'Bookmark Page', 112 | icon: 'assets/icons/bookmark.png', 113 | shortcutIconAsset: ShortcutIconAsset.flutterAsset, 114 | ), 115 | ``` 116 | 117 | ### Set shortcut items 118 | 119 | Publishes the list of shortcuts. All existing shortcuts will be replaced. 120 | 121 | ```dart 122 | flutterShortcuts.setShortcutItems( 123 | shortcutItems: [ 124 | const ShortcutItem( 125 | id: "1", 126 | action: 'Home page action', 127 | shortLabel: 'Home Page', 128 | icon: 'assets/icons/home.png', 129 | ), 130 | const ShortcutItem( 131 | id: "2", 132 | action: 'Bookmark page action', 133 | shortLabel: 'Bookmark Page', 134 | icon: "ic_launcher", 135 | shortcutIconAsset: ShortcutIconAsset.androidAsset, 136 | ), 137 | ], 138 | ), 139 | ``` 140 | 141 | ### Clear shortcut item 142 | 143 | Delete all dynamic shortcuts from the app. 144 | 145 | ```dart 146 | flutterShortcuts.clearShortcutItems(); 147 | ``` 148 | 149 | ### Push Shortcut Item 150 | 151 | 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. 152 | 153 | ```dart 154 | flutterShortcuts.pushShortcutItem( 155 | shortcut: ShortcutItem( 156 | id: "5", 157 | action: "Play Music Action", 158 | shortLabel: "Play Music", 159 | icon: 'assets/icons/music.png', 160 | ), 161 | ); 162 | ``` 163 | 164 | ### Push Shortcut Items 165 | 166 | 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. 167 | 168 | ```dart 169 | flutterShortcuts.pushShortcutItems( 170 | shortcutList: [ 171 | const ShortcutItem( 172 | id: "1", 173 | action: 'Home page new action', 174 | shortLabel: 'Home Page', 175 | icon: 'assets/icons/home.png', 176 | ), 177 | const ShortcutItem( 178 | id: "2", 179 | action: 'Bookmark page new action', 180 | shortLabel: 'Bookmark Page', 181 | icon: 'assets/icons/bookmark.png', 182 | ), 183 | const ShortcutItem( 184 | id: "3", 185 | action: 'Settings Action', 186 | shortLabel: 'Setting', 187 | icon: 'assets/icons/settings.png', 188 | ), 189 | ], 190 | ); 191 | ``` 192 | 193 | ### Update Shortcut Item 194 | 195 | Updates a single shortcut item based on id. If the ID of the shortcut is not same, no changes will be reflected. 196 | 197 | ```dart 198 | flutterShortcuts.updateShortcutItem( 199 | shortcut: ShortcutItem( 200 | id: "1", 201 | action: 'Go to url action', 202 | shortLabel: 'Visit Page', 203 | icon: 'assets/icons/url.png', 204 | ), 205 | ); 206 | ``` 207 | 208 | ### Update Shortcut Items 209 | 210 | Updates shortcut items. If the IDs of the shortcuts are not same, no changes will be reflected. 211 | 212 | ```dart 213 | flutterShortcuts.updateShortcutItems( 214 | shortcutList: [ 215 | const ShortcutItem( 216 | id: "1", 217 | action: 'Resume playing Action', 218 | shortLabel: 'Resume playing', 219 | icon: 'assets/icons/play.png', 220 | ), 221 | const ShortcutItem( 222 | id: "2", 223 | action: 'Search Songs Action', 224 | shortLabel: 'Search Songs', 225 | icon: 'assets/icons/search.png', 226 | ), 227 | ], 228 | ); 229 | ``` 230 | 231 | ### Set Conversation Shortcut 232 | 233 | Set `conversationShortcut: true` in ShortcutItem to make the shortcut as conversation shortcut. 234 | 235 | The conversation shortcut can also be set as important and bot by setting `isImportant: true` & `isBot: true`. 236 | 237 | ```dart 238 | await flutterShortcuts.pushShortcutItems( 239 | shortcutList: [ 240 | const ShortcutItem( 241 | id: "1", 242 | action: 'open_chat_1', 243 | shortLabel: 'Divyanshu Shekhar', 244 | icon: 'assets/icons/home.png', 245 | conversationShortcut: true, 246 | isImportant: true, 247 | ), 248 | const ShortcutItem( 249 | id: "2", 250 | action: 'oepn_chat_2', 251 | shortLabel: 'Subham Praharaj', 252 | icon: 'assets/icons/bookmark.png', 253 | conversationShortcut: true, 254 | ), 255 | const ShortcutItem( 256 | id: "3", 257 | action: 'oepn_chat_3', 258 | shortLabel: 'Auto Reply Bot', 259 | icon: 'assets/icons/url.png', 260 | conversationShortcut: true, 261 | isBot: true, 262 | ), 263 | ], 264 | ); 265 | ``` 266 | 267 | ### Change Shortcut Item Icon 268 | 269 | Change the icon of the shortcut based on id. If the ID of the shortcut is not same, no changes will be reflected. 270 | 271 | ```dart 272 | flutterShortcuts.changeShortcutItemIcon( 273 | id: "2", 274 | icon: "assets/icons/next.png", 275 | ); 276 | ``` 277 | 278 | ### Get shortcut icon properties 279 | 280 | Get the icon properties of your shortcut icon. 281 | 282 | ```dart 283 | Map result = await flutterShortcuts.getIconProperties(); 284 | print( "maxHeight: ${result["maxHeight"]}, maxWidth: ${result["maxWidth"]}"); 285 | ``` 286 | 287 | ## Project Created & Maintained By 288 | 289 | ### Divyanshu Shekhar 290 | 291 | 292 | 293 | [![GitHub followers](https://img.shields.io/github/followers/divshekhar.svg?style=social&label=Follow)](https://github.com/divshekhar/) 294 | 295 | ### Subham Praharaj 296 | 297 | 298 | 299 | [![GitHub followers](https://img.shields.io/github/followers/skpraharaj.svg?style=social&label=Follow)](https://github.com/skpraharaj/) 300 | 301 | ## Contributions 302 | 303 | Contributions are welcomed! 304 | 305 | If you feel that a hook is missing, feel free to open a pull-request. 306 | 307 | For a custom-hook to be merged, you will need to do the following: 308 | 309 | Describe the use-case. 310 | 311 | * Open an issue explaining why we need this hook, how to use it, ... 312 | This is important as a hook will not get merged if the hook doens't appeal to 313 | a large number of people. 314 | 315 | * If your hook is rejected, don't worry! A rejection doesn't mean that it won't 316 | be merged later in the future if more people shows an interest in it. 317 | In the mean-time, feel free to publish your hook as a package on https://pub.dev. 318 | 319 | * A hook will not be merged unles fully tested, to avoid breaking it inadvertendly 320 | in the future. 321 | 322 | ## Stargazers 323 | [![Stargazers repo roster for @DevsOnFlutter/flutter_shortcuts](https://reporoster.com/stars/dark/DevsOnFlutter/flutter_shortcuts)](https://github.com/DevsOnFlutter/flutter_shortcuts/stargazers) 324 | 325 | ## Forkers 326 | 327 | [![Forkers repo roster for @DevsOnFlutter/flutter_shortcuts](https://reporoster.com/forks/dark/DevsOnFlutter/flutter_shortcuts)](https://github.com/DevsOnFlutter/flutter_shortcuts/network/members) 328 | 329 | ## Copyright & License 330 | 331 | Code and documentation Copyright (c) 2021 [Divyanshu Shekhar](https://hackthedeveloper.com). Code released under the [BSD 3-Clause License](./LICENSE). 332 | -------------------------------------------------------------------------------- /android/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /android/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /android/.idea/.name: -------------------------------------------------------------------------------- 1 | flutter_shortcuts -------------------------------------------------------------------------------- /android/.idea/caches/build_file_checksums.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/android/.idea/caches/build_file_checksums.ser -------------------------------------------------------------------------------- /android/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /android/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 20 | -------------------------------------------------------------------------------- /android/.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | -------------------------------------------------------------------------------- /android/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /android/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /android/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | flutter_shortcuts 4 | Project android created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.buildship.core.gradleprojectbuilder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.buildship.core.gradleprojectnature 22 | 23 | 24 | 25 | 0 26 | 27 | 30 28 | 29 | org.eclipse.core.resources.regexFilterMatcher 30 | node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /android/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | arguments= 2 | auto.sync=false 3 | build.scans.enabled=false 4 | connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(7.1.1)) 5 | connection.project.dir= 6 | eclipse.preferences.version=1 7 | gradle.user.home= 8 | java.home=C\:/Program Files/AdoptOpenJDK/jdk-15.0.2.7-hotspot 9 | jvm.arguments= 10 | offline.mode=false 11 | override.workspace.settings=true 12 | show.console.view=true 13 | show.executions.view=true 14 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | group 'com.divyanshushekhar.flutter_shortcuts' 2 | version '1.0' 3 | 4 | buildscript { 5 | repositories { 6 | google() 7 | mavenCentral() 8 | } 9 | 10 | dependencies { 11 | classpath 'com.android.tools.build:gradle:7.0.4' 12 | } 13 | } 14 | 15 | rootProject.allprojects { 16 | repositories { 17 | google() 18 | mavenCentral() 19 | } 20 | } 21 | 22 | apply plugin: 'com.android.library' 23 | 24 | android { 25 | compileSdkVersion 31 26 | 27 | defaultConfig { 28 | minSdkVersion 16 29 | } 30 | } 31 | 32 | dependencies { 33 | implementation "androidx.core:core:1.8.0-alpha02" 34 | implementation 'androidx.core:core-google-shortcuts:1.1.0-alpha01' 35 | } -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip 6 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'flutter_shortcuts' 2 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /android/src/main/java/com/divyanshushekhar/flutter_shortcuts/FlutterShortcutsPlugin.java: -------------------------------------------------------------------------------- 1 | package com.divyanshushekhar.flutter_shortcuts; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | 6 | import androidx.annotation.NonNull; 7 | 8 | import io.flutter.embedding.engine.plugins.FlutterPlugin; 9 | import io.flutter.embedding.engine.plugins.activity.ActivityAware; 10 | import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding; 11 | import io.flutter.plugin.common.BinaryMessenger; 12 | import io.flutter.plugin.common.MethodChannel; 13 | 14 | public class FlutterShortcutsPlugin implements FlutterPlugin, ActivityAware { 15 | private static final String CHANNEL_ID = "com.divyanshushekhar.flutter_shortcuts"; 16 | private static final String TAG = "[Flutter Shortcuts]"; 17 | 18 | public static String getTAG() { 19 | return TAG; 20 | } 21 | 22 | public static String getChannelId() { 23 | return CHANNEL_ID; 24 | } 25 | 26 | private MethodChannel channel; 27 | private MethodCallImplementation handler; 28 | 29 | @SuppressWarnings("deprecation") 30 | public static void registerWith(io.flutter.plugin.common.PluginRegistry.Registrar registrar) { 31 | final FlutterShortcutsPlugin plugin = new FlutterShortcutsPlugin(); 32 | plugin.setupChannel(registrar.messenger(), registrar.context(), registrar.activity()); 33 | } 34 | 35 | @Override 36 | public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) { 37 | setupChannel(binding.getBinaryMessenger(), binding.getApplicationContext(), null); 38 | } 39 | 40 | @Override 41 | public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) { 42 | teardownChannel(); 43 | } 44 | 45 | @Override 46 | public void onAttachedToActivity(@NonNull ActivityPluginBinding binding) { 47 | handler.setActivity(binding.getActivity()); 48 | } 49 | 50 | @Override 51 | public void onDetachedFromActivity() { 52 | handler.setActivity(null); 53 | } 54 | 55 | @Override 56 | public void onReattachedToActivityForConfigChanges(@NonNull ActivityPluginBinding binding) { 57 | onAttachedToActivity(binding); 58 | } 59 | 60 | @Override 61 | public void onDetachedFromActivityForConfigChanges() { 62 | onDetachedFromActivity(); 63 | } 64 | 65 | private void setupChannel(BinaryMessenger messenger, Context context, Activity activity) { 66 | channel = new MethodChannel(messenger, CHANNEL_ID); 67 | handler = new MethodCallImplementation(context, activity); 68 | channel.setMethodCallHandler(handler); 69 | } 70 | 71 | private void teardownChannel() { 72 | channel.setMethodCallHandler(null); 73 | channel = null; 74 | handler = null; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /android/src/main/java/com/divyanshushekhar/flutter_shortcuts/MethodCallImplementation.java: -------------------------------------------------------------------------------- 1 | package com.divyanshushekhar.flutter_shortcuts; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.app.Activity; 5 | import android.content.Context; 6 | import android.content.Intent; 7 | import android.content.res.AssetFileDescriptor; 8 | import android.content.res.AssetManager; 9 | import android.content.res.Resources; 10 | import android.graphics.Bitmap; 11 | import android.graphics.BitmapFactory; 12 | import android.graphics.drawable.Icon; 13 | import android.os.Build; 14 | import android.util.Log; 15 | 16 | import androidx.annotation.NonNull; 17 | import androidx.annotation.RequiresApi; 18 | import androidx.core.app.Person; 19 | import androidx.core.content.pm.ShortcutInfoCompat; 20 | import androidx.core.content.pm.ShortcutManagerCompat; 21 | import androidx.core.graphics.drawable.IconCompat; 22 | 23 | import java.io.IOException; 24 | import java.util.ArrayList; 25 | import java.util.HashMap; 26 | import java.util.List; 27 | import java.util.Map; 28 | import java.util.Objects; 29 | 30 | import io.flutter.FlutterInjector; 31 | import io.flutter.embedding.engine.loader.FlutterLoader; 32 | import io.flutter.plugin.common.MethodCall; 33 | import io.flutter.plugin.common.MethodChannel; 34 | 35 | public class MethodCallImplementation implements MethodChannel.MethodCallHandler { 36 | private static final String EXTRA_ACTION = "flutter_shortcuts"; 37 | private static final String TAG = FlutterShortcutsPlugin.getTAG(); 38 | 39 | private final Context context; 40 | private Activity activity; 41 | 42 | private boolean debug; 43 | 44 | void debugPrint(String message) { 45 | if(debug) { 46 | Log.d(TAG,message); 47 | } 48 | } 49 | 50 | MethodCallImplementation(Context context, Activity activity) { 51 | this.context = context; 52 | this.activity = activity; 53 | } 54 | 55 | void setActivity(Activity activity) { 56 | this.activity = activity; 57 | } 58 | 59 | @RequiresApi(api = Build.VERSION_CODES.O) 60 | @Override 61 | public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result result) { 62 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1) { 63 | result.success(null); 64 | return; 65 | } 66 | 67 | switch (call.method) { 68 | case "initialize": 69 | initialize(call); 70 | break; 71 | case "getLaunchAction": 72 | getLaunchAction(result); 73 | break; 74 | case "getMaxShortcutLimit": 75 | result.success(getMaxShortcutLimit()); 76 | break; 77 | case "getIconProperties": 78 | result.success(getIconProperties()); 79 | break; 80 | case "setShortcutItems": 81 | setShortcutItems(call); 82 | break; 83 | case "pushShortcutItem": 84 | pushShortcutItem(call); 85 | break; 86 | case "pushShortcutItems": 87 | pushShortcutItems(call); 88 | break; 89 | case "updateShortcutItems": 90 | updateShortcutItems(call); 91 | break; 92 | case "updateShortcutItem": 93 | updateShortcutItem(call); 94 | break; 95 | case "changeShortcutItemIcon": 96 | changeShortcutItemIcon(call); 97 | break; 98 | case "clearShortcutItems": 99 | ShortcutManagerCompat.removeAllDynamicShortcuts(context); 100 | debugPrint("Removed all shortcuts."); 101 | break; 102 | default: 103 | result.notImplemented(); 104 | break; 105 | } 106 | } 107 | 108 | private void initialize(MethodCall call) { 109 | List> args = call.arguments(); 110 | this.debug = Boolean.parseBoolean(args.get(0).get("debug")); 111 | debugPrint("Flutter Shortcuts Initialized"); 112 | } 113 | 114 | @RequiresApi(api = Build.VERSION_CODES.N_MR1) 115 | private void getLaunchAction(MethodChannel.Result result) { 116 | if (activity == null) { 117 | result.error( 118 | "flutter_shortcuts_no_activity", 119 | "There is no activity available when launching action", 120 | null); 121 | return; 122 | } 123 | final Intent intent = activity.getIntent(); 124 | final String launchAction = intent.getStringExtra(EXTRA_ACTION); 125 | 126 | if (launchAction != null && !launchAction.isEmpty()) { 127 | ShortcutManagerCompat.reportShortcutUsed(context,launchAction); 128 | intent.removeExtra(EXTRA_ACTION); 129 | } 130 | 131 | result.success(launchAction); 132 | debugPrint("Launch Action: " + launchAction); 133 | } 134 | 135 | @RequiresApi(api = Build.VERSION_CODES.N_MR1) 136 | private int getMaxShortcutLimit() { 137 | return ShortcutManagerCompat.getMaxShortcutCountPerActivity(context); 138 | } 139 | 140 | @RequiresApi(api = Build.VERSION_CODES.N_MR1) 141 | private Map getIconProperties() { 142 | Map properties = new HashMap<>(); 143 | properties.put("maxHeight", ShortcutManagerCompat.getIconMaxHeight(context)); 144 | properties.put("maxWidth", ShortcutManagerCompat.getIconMaxWidth(context)); 145 | return properties; 146 | } 147 | 148 | @RequiresApi(api = Build.VERSION_CODES.N_MR1) 149 | private void setShortcutItems(MethodCall call) { 150 | List> args = call.arguments(); 151 | List shortcuts; 152 | try { 153 | shortcuts = shortcutInfoCompatList(args); 154 | ShortcutManagerCompat.setDynamicShortcuts(context,shortcuts); 155 | debugPrint("Shortcuts created"); 156 | } catch (Exception e) { 157 | Log.e(TAG,e.toString()); 158 | } 159 | } 160 | 161 | @RequiresApi(api = Build.VERSION_CODES.N_MR1) 162 | private void pushShortcutItem(MethodCall call) { 163 | final List> args = call.arguments(); 164 | List shortcuts; 165 | try { 166 | shortcuts = shortcutInfoCompatList(args); 167 | ShortcutManagerCompat.addDynamicShortcuts(context,shortcuts); 168 | debugPrint("Shortcut pushed"); 169 | } catch (Exception e) { 170 | Log.e(TAG,e.toString()); 171 | } 172 | } 173 | 174 | @RequiresApi(api = Build.VERSION_CODES.N_MR1) 175 | private void pushShortcutItems(MethodCall call) { 176 | final List> args = call.arguments(); 177 | List shortcuts; 178 | try { 179 | shortcuts = shortcutInfoCompatList(args); 180 | ShortcutManagerCompat.addDynamicShortcuts(context,shortcuts); 181 | debugPrint("Shortcuts pushed"); 182 | } catch (Exception e) { 183 | Log.e(TAG,e.toString()); 184 | } 185 | } 186 | 187 | @RequiresApi(api = Build.VERSION_CODES.N_MR1) 188 | private void updateShortcutItems(MethodCall call) { 189 | List> args = call.arguments(); 190 | boolean updated = false; 191 | try { 192 | List updateShortcuts = shortcutInfoCompatList(args); 193 | updated = ShortcutManagerCompat.updateShortcuts(context,updateShortcuts); 194 | } catch(Exception e) { 195 | Log.e(TAG, e.toString()); 196 | } 197 | if(updated) { 198 | debugPrint("Shortcuts updated"); 199 | } else { 200 | debugPrint("Unable to update shortcuts"); 201 | } 202 | } 203 | 204 | @RequiresApi(api = Build.VERSION_CODES.N_MR1) 205 | private void updateShortcutItem(MethodCall call) { 206 | final List> args = call.arguments(); 207 | Map info = args.get(0); 208 | final String id = (String) info.get("id"); 209 | final String icon = (String) info.get("icon"); 210 | final String action = (String) info.get("action"); 211 | final String shortLabel = (String) info.get("shortLabel"); 212 | final String longLabel = (String) info.get("LongLabel"); 213 | final int iconType = Integer.parseInt(Objects.requireNonNull( (String) info.get("shortcutIconType"))); 214 | 215 | final boolean isImportant = (boolean) info.get("isImportant"); 216 | final boolean isBot = (boolean) info.get("isBot"); 217 | final boolean isConversationShortcut = (boolean) info.get("conversationShortcut"); 218 | 219 | List dynamicShortcuts = ShortcutManagerCompat.getDynamicShortcuts(context); 220 | final List shortcutList = new ArrayList<>(); 221 | int flag = 1; 222 | for(ShortcutInfoCompat si : dynamicShortcuts) { 223 | if(si.getId().equals(id)) { 224 | ShortcutInfoCompat.Builder shortcutInfo = buildShortcutUsingCompat( 225 | id,icon,action,shortLabel,longLabel,iconType); 226 | 227 | // Set Person if isConversationShortcut is true 228 | if(isConversationShortcut) { 229 | Person.Builder personBuilder = new Person.Builder() 230 | .setKey(id) 231 | .setName(shortLabel) 232 | .setImportant(isImportant) 233 | .setBot(isBot); 234 | 235 | // Setting Icon for person builder 236 | setIconCompat(iconType, icon, personBuilder); 237 | 238 | shortcutInfo 239 | .setLongLived(true) 240 | .setPerson(personBuilder.build()); 241 | 242 | } 243 | 244 | shortcutList.add(shortcutInfo.build()); 245 | flag = 0; 246 | continue; 247 | } 248 | shortcutList.add(si); 249 | } 250 | if (flag == 1) { 251 | Log.e(TAG, "ID did not match any shortcut"); 252 | return; 253 | } 254 | try { 255 | ShortcutManagerCompat.updateShortcuts(context,shortcutList); 256 | debugPrint("Shortcut updated"); 257 | } catch(Exception e) { 258 | Log.e(TAG,e.toString()); 259 | } 260 | } 261 | 262 | @SuppressLint("RestrictedApi") 263 | @RequiresApi(api = Build.VERSION_CODES.O) 264 | private void changeShortcutItemIcon(MethodCall call) { 265 | try { 266 | final List args = call.arguments(); 267 | final String refId = args.get(0); 268 | final String changeIcon = args.get(1); 269 | Icon icon = getIconFromFlutterAsset(context,changeIcon); 270 | IconCompat iconCompat = IconCompat.createFromIcon(context,icon); 271 | List dynamicShortcuts = ShortcutManagerCompat.getDynamicShortcuts(context); 272 | 273 | final List shortcutList = new ArrayList<>(); 274 | int flag = 1; 275 | for(ShortcutInfoCompat si : dynamicShortcuts) { 276 | String id = si.getId(); 277 | if(id.equals(refId)) { 278 | String shortLabel = (String) si.getShortLabel(); 279 | String longLabel = (String) si.getLongLabel(); 280 | 281 | ShortcutInfoCompat.Builder shortcutInfo = buildShortcutUsingCompat( 282 | id,null,null,shortLabel,longLabel,0); 283 | 284 | shortcutInfo.setIcon(iconCompat).setIntent(si.getIntent()); 285 | shortcutList.add(shortcutInfo.build()); 286 | flag = 0; 287 | continue; 288 | } 289 | shortcutList.add(si); 290 | } 291 | if (flag == 1) { 292 | Log.e(TAG, "ID did not match any shortcut"); 293 | return; 294 | } 295 | try { 296 | ShortcutManagerCompat.updateShortcuts(context,shortcutList); 297 | debugPrint("Shortcut Icon Changed."); 298 | } catch(Exception e) { 299 | Log.e(TAG,e.toString()); 300 | } 301 | } catch(Exception e) { 302 | Log.e(TAG,e.toString()); 303 | } 304 | } 305 | 306 | /* ******************** Utility Functions ********************* */ 307 | 308 | @RequiresApi(api = Build.VERSION_CODES.N_MR1) 309 | private List shortcutInfoCompatList( 310 | List> shortcuts) { 311 | final List shortcutList = new ArrayList<>(); 312 | 313 | for (Map shortcut : shortcuts) { 314 | final String id = (String) shortcut.get("id"); 315 | final String icon = (String) shortcut.get("icon"); 316 | final String action = (String) shortcut.get("action"); 317 | 318 | // Short Label for the shortcut 319 | // Name for Person 320 | final String shortLabel = (String) shortcut.get("shortLabel"); 321 | 322 | // Long Label for the shortcut 323 | final String longLabel = (String) shortcut.get("LongLabel"); 324 | 325 | final boolean isImportant = (boolean) shortcut.get("isImportant"); 326 | final boolean isBot = (boolean) shortcut.get("isBot"); 327 | final boolean isConversationShortcut = (boolean) shortcut.get("conversationShortcut"); 328 | 329 | final int iconType = Integer.parseInt(Objects.requireNonNull( 330 | (String) shortcut.get("shortcutIconType"))); 331 | 332 | ShortcutInfoCompat.Builder shortcutInfoCompat = buildShortcutUsingCompat( 333 | id, icon, action, shortLabel, longLabel, iconType); 334 | 335 | // Set Person if isConversationShortcut is true 336 | if(isConversationShortcut) { 337 | Person.Builder personBuilder = new Person.Builder() 338 | .setKey(id) 339 | .setName(shortLabel) 340 | .setImportant(isImportant) 341 | .setBot(isBot); 342 | 343 | // Setting Icon for person builder 344 | setIconCompat(iconType, icon, personBuilder); 345 | 346 | shortcutInfoCompat 347 | .setLongLived(true) 348 | .setPerson(personBuilder.build()); 349 | 350 | } 351 | 352 | shortcutList.add(shortcutInfoCompat.build()); 353 | } 354 | return shortcutList; 355 | } 356 | 357 | @RequiresApi(api = Build.VERSION_CODES.KITKAT) 358 | private ShortcutInfoCompat.Builder buildShortcutUsingCompat( 359 | String id, String icon, String action, String shortLabel, 360 | String longLabel, int iconType) { 361 | 362 | assert id != null; 363 | ShortcutInfoCompat.Builder shortcutInfoCompat = new ShortcutInfoCompat.Builder(context, id); 364 | 365 | if(action != null) { 366 | Intent intent; 367 | intent = getIntentToOpenMainActivity(action); 368 | shortcutInfoCompat.setIntent(intent); 369 | } 370 | 371 | if(longLabel != null) { 372 | shortcutInfoCompat.setLongLabel(longLabel); 373 | } 374 | 375 | if(icon != null) { 376 | setIconCompat(iconType, icon, shortcutInfoCompat); 377 | } 378 | 379 | if(shortLabel != null) { 380 | shortcutInfoCompat.setShortLabel(shortLabel); 381 | } 382 | 383 | return shortcutInfoCompat; 384 | } 385 | 386 | /* *********************** ShortcutInfoCompat ******************* */ 387 | private void setIconCompat(int iconType,String icon,ShortcutInfoCompat.Builder shortcutBuilderCompat) { 388 | // 0 - ShortcutIconType.androidAsset 389 | // 1 - ShortcutIconType.flutterAsset 390 | switch (iconType) { 391 | case 0: 392 | setIconFromNativeCompat(shortcutBuilderCompat, icon); 393 | break; 394 | case 1: 395 | setIconFromFlutterCompat(shortcutBuilderCompat, icon); 396 | break; 397 | default: 398 | break; 399 | } 400 | } 401 | 402 | private void setIconFromNativeCompat(ShortcutInfoCompat.Builder shortcutBuilder, String icon) { 403 | final int resourceId = loadResourceId(context, icon); 404 | if (resourceId > 0) { 405 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) { 406 | shortcutBuilder.setIcon(IconCompat.createFromIcon(context,Icon.createWithResource(context, resourceId))); 407 | } 408 | } 409 | } 410 | 411 | private void setIconFromFlutterCompat(ShortcutInfoCompat.Builder shortcutBuilder, String icon) { 412 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { 413 | shortcutBuilder.setIcon(IconCompat.createFromIcon(context,getIconFromFlutterAsset(context,icon))); 414 | } 415 | } 416 | 417 | /* *********************** Person ******************* */ 418 | private void setIconCompat(int iconType,String icon,Person.Builder personBuilderCompat) { 419 | // 0 - ShortcutIconType.androidAsset 420 | // 1 - ShortcutIconType.flutterAsset 421 | switch (iconType) { 422 | case 0: 423 | setIconFromNativeCompat(personBuilderCompat, icon); 424 | break; 425 | case 1: 426 | setIconFromFlutterCompat(personBuilderCompat, icon); 427 | break; 428 | default: 429 | break; 430 | } 431 | } 432 | 433 | private void setIconFromNativeCompat(Person.Builder personBuilder, String icon) { 434 | final int resourceId = loadResourceId(context, icon); 435 | if (resourceId > 0) { 436 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) { 437 | personBuilder.setIcon(IconCompat.createFromIcon(context,Icon.createWithResource(context, resourceId))); 438 | } 439 | } 440 | } 441 | 442 | private void setIconFromFlutterCompat(Person.Builder personBuilder, String icon) { 443 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { 444 | personBuilder.setIcon(IconCompat.createFromIcon(context,getIconFromFlutterAsset(context,icon))); 445 | } 446 | } 447 | 448 | @RequiresApi(api = Build.VERSION_CODES.O) 449 | private Icon getIconFromFlutterAsset(Context context, String path) { 450 | AssetManager assetManager = context.getAssets(); 451 | FlutterLoader loader = FlutterInjector.instance().flutterLoader(); 452 | String key = loader.getLookupKeyForAsset(path); 453 | AssetFileDescriptor fd = null; 454 | try { 455 | fd = assetManager.openFd(key); 456 | } catch (IOException e) { 457 | e.printStackTrace(); 458 | } 459 | Bitmap image = null; 460 | try { 461 | assert fd != null; 462 | image = BitmapFactory.decodeStream(fd.createInputStream()); 463 | } catch (IOException e) { 464 | e.printStackTrace(); 465 | } 466 | return Icon.createWithAdaptiveBitmap(image); 467 | } 468 | 469 | private int loadResourceId(Context context, String icon) { 470 | if (icon == null) { 471 | return 0; 472 | } 473 | 474 | final String packageName = context.getPackageName(); 475 | final Resources res = context.getResources(); 476 | final int resourceId = res.getIdentifier(icon, "drawable", packageName); 477 | 478 | if (resourceId == 0) { 479 | return res.getIdentifier(icon, "mipmap", packageName); 480 | } else { 481 | return resourceId; 482 | } 483 | } 484 | 485 | private Intent getIntentToOpenMainActivity(String type) { 486 | final String packageName = context.getPackageName(); 487 | 488 | return context 489 | .getPackageManager() 490 | .getLaunchIntentForPackage(packageName) 491 | .setAction(Intent.ACTION_RUN) 492 | .putExtra(EXTRA_ACTION, type) 493 | .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) 494 | .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); 495 | } 496 | } 497 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Android Studio will place build artifacts here 44 | /android/app/debug 45 | /android/app/profile 46 | /android/app/release 47 | -------------------------------------------------------------------------------- /example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 1d9032c7e1d867f071f2277eb1673e8f9b0274e3 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # flutter_shortcuts_example 2 | 3 | Demonstrates how to use the flutter_shortcuts plugin. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | -------------------------------------------------------------------------------- /example/android/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | android 4 | Project android created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.buildship.core.gradleprojectbuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.buildship.core.gradleprojectnature 16 | 17 | 18 | 19 | 1621653958531 20 | 21 | 30 22 | 23 | org.eclipse.core.resources.regexFilterMatcher 24 | node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /example/android/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | arguments= 2 | auto.sync=false 3 | build.scans.enabled=false 4 | connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) 5 | connection.project.dir= 6 | eclipse.preferences.version=1 7 | gradle.user.home= 8 | java.home=C\:/Program Files/AdoptOpenJDK/jdk-15.0.2.7-hotspot 9 | jvm.arguments= 10 | offline.mode=false 11 | override.workspace.settings=true 12 | show.console.view=true 13 | show.executions.view=true 14 | -------------------------------------------------------------------------------- /example/android/app/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /example/android/app/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | app 4 | Project app created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.buildship.core.gradleprojectbuilder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.buildship.core.gradleprojectnature 22 | 23 | 24 | 25 | 1621653958536 26 | 27 | 30 28 | 29 | org.eclipse.core.resources.regexFilterMatcher 30 | node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /example/android/app/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | connection.project.dir=.. 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 26 | 27 | android { 28 | compileSdkVersion 31 29 | 30 | defaultConfig { 31 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 32 | applicationId "com.divyanshushekhar.flutter_shortcuts_example" 33 | minSdkVersion 16 34 | targetSdkVersion 31 35 | versionCode flutterVersionCode.toInteger() 36 | versionName flutterVersionName 37 | } 38 | 39 | buildTypes { 40 | release { 41 | // TODO: Add your own signing config for the release build. 42 | // Signing with the debug keys for now, so `flutter run --release` works. 43 | signingConfig signingConfigs.debug 44 | } 45 | } 46 | } 47 | 48 | flutter { 49 | source '../..' 50 | } 51 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 14 | 18 | 22 | 27 | 31 | 32 | 33 | 34 | 35 | 36 | 38 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/divyanshushekhar/flutter_shortcuts_example/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.divyanshushekhar.flutter_shortcuts_example; 2 | 3 | import io.flutter.embedding.android.FlutterActivity; 4 | 5 | public class MainActivity extends FlutterActivity { 6 | } 7 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/bookmark_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/android/app/src/main/res/drawable/bookmark_icon.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | mavenCentral() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:7.0.4' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | google() 15 | mavenCentral() 16 | } 17 | } 18 | 19 | rootProject.buildDir = '../build' 20 | subprojects { 21 | project.buildDir = "${rootProject.buildDir}/${project.name}" 22 | } 23 | subprojects { 24 | project.evaluationDependsOn(':app') 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip 7 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /example/assets/icons/arrows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/assets/icons/arrows.png -------------------------------------------------------------------------------- /example/assets/icons/bookmark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/assets/icons/bookmark.png -------------------------------------------------------------------------------- /example/assets/icons/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/assets/icons/home.png -------------------------------------------------------------------------------- /example/assets/icons/music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/assets/icons/music.png -------------------------------------------------------------------------------- /example/assets/icons/next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/assets/icons/next.png -------------------------------------------------------------------------------- /example/assets/icons/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/assets/icons/play.png -------------------------------------------------------------------------------- /example/assets/icons/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/assets/icons/search.png -------------------------------------------------------------------------------- /example/assets/icons/settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/assets/icons/settings.png -------------------------------------------------------------------------------- /example/assets/icons/url.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/assets/icons/url.png -------------------------------------------------------------------------------- /example/assets/svg/play-button.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /example/assets/svg/settings.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 12 | 13 | 14 | 15 | 16 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /example/assets/svg/share.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 13 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 14 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 15 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXCopyFilesBuildPhase section */ 19 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 20 | isa = PBXCopyFilesBuildPhase; 21 | buildActionMask = 2147483647; 22 | dstPath = ""; 23 | dstSubfolderSpec = 10; 24 | files = ( 25 | ); 26 | name = "Embed Frameworks"; 27 | runOnlyForDeploymentPostprocessing = 0; 28 | }; 29 | /* End PBXCopyFilesBuildPhase section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 33 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 34 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 35 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 36 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 37 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 38 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 39 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 40 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 42 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 43 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 44 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | 9740EEB11CF90186004384FC /* Flutter */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 62 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 63 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 64 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 65 | ); 66 | name = Flutter; 67 | sourceTree = ""; 68 | }; 69 | 97C146E51CF9000F007C117D = { 70 | isa = PBXGroup; 71 | children = ( 72 | 9740EEB11CF90186004384FC /* Flutter */, 73 | 97C146F01CF9000F007C117D /* Runner */, 74 | 97C146EF1CF9000F007C117D /* Products */, 75 | ); 76 | sourceTree = ""; 77 | }; 78 | 97C146EF1CF9000F007C117D /* Products */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 97C146EE1CF9000F007C117D /* Runner.app */, 82 | ); 83 | name = Products; 84 | sourceTree = ""; 85 | }; 86 | 97C146F01CF9000F007C117D /* Runner */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 90 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 91 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 92 | 97C147021CF9000F007C117D /* Info.plist */, 93 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 94 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 95 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 96 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 97 | ); 98 | path = Runner; 99 | sourceTree = ""; 100 | }; 101 | /* End PBXGroup section */ 102 | 103 | /* Begin PBXNativeTarget section */ 104 | 97C146ED1CF9000F007C117D /* Runner */ = { 105 | isa = PBXNativeTarget; 106 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 107 | buildPhases = ( 108 | 9740EEB61CF901F6004384FC /* Run Script */, 109 | 97C146EA1CF9000F007C117D /* Sources */, 110 | 97C146EB1CF9000F007C117D /* Frameworks */, 111 | 97C146EC1CF9000F007C117D /* Resources */, 112 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 113 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 114 | ); 115 | buildRules = ( 116 | ); 117 | dependencies = ( 118 | ); 119 | name = Runner; 120 | productName = Runner; 121 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 122 | productType = "com.apple.product-type.application"; 123 | }; 124 | /* End PBXNativeTarget section */ 125 | 126 | /* Begin PBXProject section */ 127 | 97C146E61CF9000F007C117D /* Project object */ = { 128 | isa = PBXProject; 129 | attributes = { 130 | LastUpgradeCheck = 1020; 131 | ORGANIZATIONNAME = ""; 132 | TargetAttributes = { 133 | 97C146ED1CF9000F007C117D = { 134 | CreatedOnToolsVersion = 7.3.1; 135 | LastSwiftMigration = 1100; 136 | }; 137 | }; 138 | }; 139 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 140 | compatibilityVersion = "Xcode 9.3"; 141 | developmentRegion = en; 142 | hasScannedForEncodings = 0; 143 | knownRegions = ( 144 | en, 145 | Base, 146 | ); 147 | mainGroup = 97C146E51CF9000F007C117D; 148 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 149 | projectDirPath = ""; 150 | projectRoot = ""; 151 | targets = ( 152 | 97C146ED1CF9000F007C117D /* Runner */, 153 | ); 154 | }; 155 | /* End PBXProject section */ 156 | 157 | /* Begin PBXResourcesBuildPhase section */ 158 | 97C146EC1CF9000F007C117D /* Resources */ = { 159 | isa = PBXResourcesBuildPhase; 160 | buildActionMask = 2147483647; 161 | files = ( 162 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 163 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 164 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 165 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 166 | ); 167 | runOnlyForDeploymentPostprocessing = 0; 168 | }; 169 | /* End PBXResourcesBuildPhase section */ 170 | 171 | /* Begin PBXShellScriptBuildPhase section */ 172 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 173 | isa = PBXShellScriptBuildPhase; 174 | buildActionMask = 2147483647; 175 | files = ( 176 | ); 177 | inputPaths = ( 178 | ); 179 | name = "Thin Binary"; 180 | outputPaths = ( 181 | ); 182 | runOnlyForDeploymentPostprocessing = 0; 183 | shellPath = /bin/sh; 184 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 185 | }; 186 | 9740EEB61CF901F6004384FC /* Run Script */ = { 187 | isa = PBXShellScriptBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | ); 191 | inputPaths = ( 192 | ); 193 | name = "Run Script"; 194 | outputPaths = ( 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | shellPath = /bin/sh; 198 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 199 | }; 200 | /* End PBXShellScriptBuildPhase section */ 201 | 202 | /* Begin PBXSourcesBuildPhase section */ 203 | 97C146EA1CF9000F007C117D /* Sources */ = { 204 | isa = PBXSourcesBuildPhase; 205 | buildActionMask = 2147483647; 206 | files = ( 207 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 208 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 209 | ); 210 | runOnlyForDeploymentPostprocessing = 0; 211 | }; 212 | /* End PBXSourcesBuildPhase section */ 213 | 214 | /* Begin PBXVariantGroup section */ 215 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 216 | isa = PBXVariantGroup; 217 | children = ( 218 | 97C146FB1CF9000F007C117D /* Base */, 219 | ); 220 | name = Main.storyboard; 221 | sourceTree = ""; 222 | }; 223 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 224 | isa = PBXVariantGroup; 225 | children = ( 226 | 97C147001CF9000F007C117D /* Base */, 227 | ); 228 | name = LaunchScreen.storyboard; 229 | sourceTree = ""; 230 | }; 231 | /* End PBXVariantGroup section */ 232 | 233 | /* Begin XCBuildConfiguration section */ 234 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 235 | isa = XCBuildConfiguration; 236 | buildSettings = { 237 | ALWAYS_SEARCH_USER_PATHS = NO; 238 | CLANG_ANALYZER_NONNULL = YES; 239 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 240 | CLANG_CXX_LIBRARY = "libc++"; 241 | CLANG_ENABLE_MODULES = YES; 242 | CLANG_ENABLE_OBJC_ARC = YES; 243 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 244 | CLANG_WARN_BOOL_CONVERSION = YES; 245 | CLANG_WARN_COMMA = YES; 246 | CLANG_WARN_CONSTANT_CONVERSION = YES; 247 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 248 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 249 | CLANG_WARN_EMPTY_BODY = YES; 250 | CLANG_WARN_ENUM_CONVERSION = YES; 251 | CLANG_WARN_INFINITE_RECURSION = YES; 252 | CLANG_WARN_INT_CONVERSION = YES; 253 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 254 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 255 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 256 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 257 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 258 | CLANG_WARN_STRICT_PROTOTYPES = YES; 259 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 260 | CLANG_WARN_UNREACHABLE_CODE = YES; 261 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 262 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 263 | COPY_PHASE_STRIP = NO; 264 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 265 | ENABLE_NS_ASSERTIONS = NO; 266 | ENABLE_STRICT_OBJC_MSGSEND = YES; 267 | GCC_C_LANGUAGE_STANDARD = gnu99; 268 | GCC_NO_COMMON_BLOCKS = YES; 269 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 270 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 271 | GCC_WARN_UNDECLARED_SELECTOR = YES; 272 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 273 | GCC_WARN_UNUSED_FUNCTION = YES; 274 | GCC_WARN_UNUSED_VARIABLE = YES; 275 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 276 | MTL_ENABLE_DEBUG_INFO = NO; 277 | SDKROOT = iphoneos; 278 | SUPPORTED_PLATFORMS = iphoneos; 279 | TARGETED_DEVICE_FAMILY = "1,2"; 280 | VALIDATE_PRODUCT = YES; 281 | }; 282 | name = Profile; 283 | }; 284 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 285 | isa = XCBuildConfiguration; 286 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 287 | buildSettings = { 288 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 289 | CLANG_ENABLE_MODULES = YES; 290 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 291 | ENABLE_BITCODE = NO; 292 | INFOPLIST_FILE = Runner/Info.plist; 293 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 294 | PRODUCT_BUNDLE_IDENTIFIER = com.divyanshushekhar.flutterShortcutsExample; 295 | PRODUCT_NAME = "$(TARGET_NAME)"; 296 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 297 | SWIFT_VERSION = 5.0; 298 | VERSIONING_SYSTEM = "apple-generic"; 299 | }; 300 | name = Profile; 301 | }; 302 | 97C147031CF9000F007C117D /* Debug */ = { 303 | isa = XCBuildConfiguration; 304 | buildSettings = { 305 | ALWAYS_SEARCH_USER_PATHS = NO; 306 | CLANG_ANALYZER_NONNULL = YES; 307 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 308 | CLANG_CXX_LIBRARY = "libc++"; 309 | CLANG_ENABLE_MODULES = YES; 310 | CLANG_ENABLE_OBJC_ARC = YES; 311 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 312 | CLANG_WARN_BOOL_CONVERSION = YES; 313 | CLANG_WARN_COMMA = YES; 314 | CLANG_WARN_CONSTANT_CONVERSION = YES; 315 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 316 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 317 | CLANG_WARN_EMPTY_BODY = YES; 318 | CLANG_WARN_ENUM_CONVERSION = YES; 319 | CLANG_WARN_INFINITE_RECURSION = YES; 320 | CLANG_WARN_INT_CONVERSION = YES; 321 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 322 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 323 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 324 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 325 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 326 | CLANG_WARN_STRICT_PROTOTYPES = YES; 327 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 328 | CLANG_WARN_UNREACHABLE_CODE = YES; 329 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 330 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 331 | COPY_PHASE_STRIP = NO; 332 | DEBUG_INFORMATION_FORMAT = dwarf; 333 | ENABLE_STRICT_OBJC_MSGSEND = YES; 334 | ENABLE_TESTABILITY = YES; 335 | GCC_C_LANGUAGE_STANDARD = gnu99; 336 | GCC_DYNAMIC_NO_PIC = NO; 337 | GCC_NO_COMMON_BLOCKS = YES; 338 | GCC_OPTIMIZATION_LEVEL = 0; 339 | GCC_PREPROCESSOR_DEFINITIONS = ( 340 | "DEBUG=1", 341 | "$(inherited)", 342 | ); 343 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 344 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 345 | GCC_WARN_UNDECLARED_SELECTOR = YES; 346 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 347 | GCC_WARN_UNUSED_FUNCTION = YES; 348 | GCC_WARN_UNUSED_VARIABLE = YES; 349 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 350 | MTL_ENABLE_DEBUG_INFO = YES; 351 | ONLY_ACTIVE_ARCH = YES; 352 | SDKROOT = iphoneos; 353 | TARGETED_DEVICE_FAMILY = "1,2"; 354 | }; 355 | name = Debug; 356 | }; 357 | 97C147041CF9000F007C117D /* Release */ = { 358 | isa = XCBuildConfiguration; 359 | buildSettings = { 360 | ALWAYS_SEARCH_USER_PATHS = NO; 361 | CLANG_ANALYZER_NONNULL = YES; 362 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 363 | CLANG_CXX_LIBRARY = "libc++"; 364 | CLANG_ENABLE_MODULES = YES; 365 | CLANG_ENABLE_OBJC_ARC = YES; 366 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 367 | CLANG_WARN_BOOL_CONVERSION = YES; 368 | CLANG_WARN_COMMA = YES; 369 | CLANG_WARN_CONSTANT_CONVERSION = YES; 370 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 371 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 372 | CLANG_WARN_EMPTY_BODY = YES; 373 | CLANG_WARN_ENUM_CONVERSION = YES; 374 | CLANG_WARN_INFINITE_RECURSION = YES; 375 | CLANG_WARN_INT_CONVERSION = YES; 376 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 377 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 378 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 379 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 380 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 381 | CLANG_WARN_STRICT_PROTOTYPES = YES; 382 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 383 | CLANG_WARN_UNREACHABLE_CODE = YES; 384 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 385 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 386 | COPY_PHASE_STRIP = NO; 387 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 388 | ENABLE_NS_ASSERTIONS = NO; 389 | ENABLE_STRICT_OBJC_MSGSEND = YES; 390 | GCC_C_LANGUAGE_STANDARD = gnu99; 391 | GCC_NO_COMMON_BLOCKS = YES; 392 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 393 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 394 | GCC_WARN_UNDECLARED_SELECTOR = YES; 395 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 396 | GCC_WARN_UNUSED_FUNCTION = YES; 397 | GCC_WARN_UNUSED_VARIABLE = YES; 398 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 399 | MTL_ENABLE_DEBUG_INFO = NO; 400 | SDKROOT = iphoneos; 401 | SUPPORTED_PLATFORMS = iphoneos; 402 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 403 | TARGETED_DEVICE_FAMILY = "1,2"; 404 | VALIDATE_PRODUCT = YES; 405 | }; 406 | name = Release; 407 | }; 408 | 97C147061CF9000F007C117D /* Debug */ = { 409 | isa = XCBuildConfiguration; 410 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 411 | buildSettings = { 412 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 413 | CLANG_ENABLE_MODULES = YES; 414 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 415 | ENABLE_BITCODE = NO; 416 | INFOPLIST_FILE = Runner/Info.plist; 417 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 418 | PRODUCT_BUNDLE_IDENTIFIER = com.divyanshushekhar.flutterShortcutsExample; 419 | PRODUCT_NAME = "$(TARGET_NAME)"; 420 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 421 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 422 | SWIFT_VERSION = 5.0; 423 | VERSIONING_SYSTEM = "apple-generic"; 424 | }; 425 | name = Debug; 426 | }; 427 | 97C147071CF9000F007C117D /* Release */ = { 428 | isa = XCBuildConfiguration; 429 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 430 | buildSettings = { 431 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 432 | CLANG_ENABLE_MODULES = YES; 433 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 434 | ENABLE_BITCODE = NO; 435 | INFOPLIST_FILE = Runner/Info.plist; 436 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 437 | PRODUCT_BUNDLE_IDENTIFIER = com.divyanshushekhar.flutterShortcutsExample; 438 | PRODUCT_NAME = "$(TARGET_NAME)"; 439 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 440 | SWIFT_VERSION = 5.0; 441 | VERSIONING_SYSTEM = "apple-generic"; 442 | }; 443 | name = Release; 444 | }; 445 | /* End XCBuildConfiguration section */ 446 | 447 | /* Begin XCConfigurationList section */ 448 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 449 | isa = XCConfigurationList; 450 | buildConfigurations = ( 451 | 97C147031CF9000F007C117D /* Debug */, 452 | 97C147041CF9000F007C117D /* Release */, 453 | 249021D3217E4FDB00AE95B9 /* Profile */, 454 | ); 455 | defaultConfigurationIsVisible = 0; 456 | defaultConfigurationName = Release; 457 | }; 458 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 459 | isa = XCConfigurationList; 460 | buildConfigurations = ( 461 | 97C147061CF9000F007C117D /* Debug */, 462 | 97C147071CF9000F007C117D /* Release */, 463 | 249021D4217E4FDB00AE95B9 /* Profile */, 464 | ); 465 | defaultConfigurationIsVisible = 0; 466 | defaultConfigurationName = Release; 467 | }; 468 | /* End XCConfigurationList section */ 469 | }; 470 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 471 | } 472 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | flutter_shortcuts_example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_shortcuts/flutter_shortcuts.dart'; 3 | 4 | void main() { 5 | runApp(MyApp()); 6 | } 7 | 8 | class MyApp extends StatefulWidget { 9 | @override 10 | _MyAppState createState() => _MyAppState(); 11 | } 12 | 13 | class _MyAppState extends State { 14 | String action = 'No Action'; 15 | final FlutterShortcuts flutterShortcuts = FlutterShortcuts(); 16 | int? maxLimit; 17 | 18 | @override 19 | void initState() { 20 | super.initState(); 21 | flutterShortcuts.initialize(debug: true); 22 | flutterShortcuts.listenAction((String incomingAction) { 23 | setState(() { 24 | action = incomingAction; 25 | }); 26 | }); 27 | } 28 | 29 | @override 30 | Widget build(BuildContext context) { 31 | return MaterialApp( 32 | home: Scaffold( 33 | appBar: AppBar( 34 | title: const Text('Flutter Shortcuts Plugin'), 35 | ), 36 | body: SingleChildScrollView( 37 | child: Container( 38 | padding: EdgeInsets.all(10), 39 | child: Column( 40 | crossAxisAlignment: CrossAxisAlignment.start, 41 | children: [ 42 | Padding( 43 | padding: const EdgeInsets.all(8.0), 44 | child: Center( 45 | child: Text( 46 | 'ShortcutItem action : $action\n', 47 | style: TextStyle( 48 | fontSize: 16, 49 | fontWeight: FontWeight.bold, 50 | ), 51 | ), 52 | ), 53 | ), 54 | Text( 55 | "Flutter Shortcuts Max Limit -> ${maxLimit == null ? '' : maxLimit}"), 56 | Row( 57 | children: [ 58 | ElevatedButton( 59 | child: Text("Get Max Shortcut Limit"), 60 | onPressed: () async { 61 | int? result = 62 | await flutterShortcuts.getMaxShortcutLimit(); 63 | setState(() { 64 | maxLimit = result; 65 | }); 66 | }, 67 | ), 68 | ], 69 | ), 70 | Divider(), 71 | Text("Flutter Shortcuts Set and Clear"), 72 | Row( 73 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 74 | children: [ 75 | ElevatedButton( 76 | child: Text("Set Shortcuts"), 77 | onPressed: () async { 78 | await flutterShortcuts.setShortcutItems( 79 | shortcutItems: [ 80 | const ShortcutItem( 81 | id: "1", 82 | action: 'Home page action', 83 | shortLabel: 'Home Page', 84 | icon: 'assets/icons/home.png', 85 | ), 86 | const ShortcutItem( 87 | id: "2", 88 | action: 'Bookmark page action', 89 | shortLabel: 'Bookmark Page', 90 | // icon: 'assets/icons/bookmark.png', 91 | icon: "ic_launcher", 92 | shortcutIconAsset: ShortcutIconAsset.androidAsset, 93 | ), 94 | ], 95 | ).then((value) { 96 | setState(() { 97 | if (action == 'No Action') { 98 | action = 'Flutter Shortcuts Ready'; 99 | } 100 | }); 101 | }); 102 | }, 103 | ), 104 | ElevatedButton( 105 | child: Text("Clear All Shortcuts"), 106 | onPressed: () { 107 | flutterShortcuts.clearShortcutItems(); 108 | }, 109 | ), 110 | ], 111 | ), 112 | Divider(), 113 | Text("Flutter Shortcuts Add and Update"), 114 | Row( 115 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 116 | children: [ 117 | ElevatedButton( 118 | child: Text("push Shortcut Item"), 119 | onPressed: () async { 120 | await flutterShortcuts.pushShortcutItem( 121 | shortcut: ShortcutItem( 122 | id: "5", 123 | action: "Play Music Action", 124 | shortLabel: "Play Music", 125 | icon: 'assets/icons/music.png', 126 | ), 127 | ); 128 | }, 129 | ), 130 | ElevatedButton( 131 | child: Text("Update all shortcuts"), 132 | onPressed: () async { 133 | await flutterShortcuts.updateShortcutItems( 134 | shortcutList: [ 135 | const ShortcutItem( 136 | id: "1", 137 | action: 'Resume playing Action', 138 | shortLabel: 'Resume playing', 139 | icon: 'assets/icons/play.png', 140 | ), 141 | const ShortcutItem( 142 | id: "2", 143 | action: 'Search Songs Action', 144 | shortLabel: 'Search Songs', 145 | icon: 'assets/icons/search.png', 146 | ), 147 | ], 148 | ); 149 | }, 150 | ), 151 | ], 152 | ), 153 | Row( 154 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 155 | children: [ 156 | ElevatedButton( 157 | child: Text("Add Shortcut"), 158 | onPressed: () async { 159 | await flutterShortcuts.pushShortcutItems( 160 | shortcutList: [ 161 | const ShortcutItem( 162 | id: "1", 163 | action: 'Home page new action', 164 | shortLabel: 'Home Page', 165 | icon: 'assets/icons/home.png', 166 | ), 167 | const ShortcutItem( 168 | id: "2", 169 | action: 'Bookmark page new action', 170 | shortLabel: 'Bookmark Page', 171 | icon: 'assets/icons/bookmark.png', 172 | ), 173 | const ShortcutItem( 174 | id: "3", 175 | action: 'Settings Action', 176 | shortLabel: 'Setting', 177 | icon: 'assets/icons/settings.png', 178 | ), 179 | ], 180 | ); 181 | }, 182 | ), 183 | ElevatedButton( 184 | child: Text("Update Shortcut with ID"), 185 | onPressed: () { 186 | flutterShortcuts.updateShortcutItem( 187 | shortcut: ShortcutItem( 188 | id: "1", 189 | action: 'Go to url action', 190 | shortLabel: 'Visit Page', 191 | icon: 'assets/icons/url.png', 192 | ), 193 | ); 194 | }, 195 | ), 196 | ], 197 | ), 198 | Divider(), 199 | Text("Icons"), 200 | Row( 201 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 202 | children: [ 203 | ElevatedButton( 204 | child: Text("icon Properties"), 205 | onPressed: () async { 206 | Map result = 207 | await flutterShortcuts.getIconProperties(); 208 | print( 209 | "maxHeight: ${result["maxHeight"]}, maxWidth: ${result["maxWidth"]}", 210 | ); 211 | }, 212 | ), 213 | ElevatedButton( 214 | child: Text("Change icon of 2nd Shortcut"), 215 | onPressed: () { 216 | flutterShortcuts.changeShortcutItemIcon( 217 | id: "2", 218 | icon: "assets/icons/next.png", 219 | ); 220 | }, 221 | ), 222 | ], 223 | ), 224 | Text("Conversation Shortcuts"), 225 | Row( 226 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 227 | children: [ 228 | ElevatedButton( 229 | child: Text("Set conversation Shortcut"), 230 | onPressed: () async { 231 | await flutterShortcuts.setShortcutItems( 232 | shortcutItems: [ 233 | const ShortcutItem( 234 | id: "1", 235 | action: 'open_chat_1', 236 | shortLabel: 'Divyanshu Shekhar', 237 | icon: 'assets/icons/home.png', 238 | conversationShortcut: true, 239 | isImportant: true, 240 | ), 241 | const ShortcutItem( 242 | id: "2", 243 | action: 'oepn_chat_2', 244 | shortLabel: 'Subham Praharaj', 245 | icon: 'assets/icons/bookmark.png', 246 | conversationShortcut: true, 247 | ), 248 | const ShortcutItem( 249 | id: "3", 250 | action: 'oepn_chat_3', 251 | shortLabel: 'Auto Reply Bot', 252 | icon: 'assets/icons/url.png', 253 | conversationShortcut: true, 254 | isBot: true, 255 | ), 256 | ], 257 | ); 258 | }, 259 | ), 260 | ], 261 | ), 262 | ], 263 | ), 264 | ), 265 | ), 266 | ), 267 | ); 268 | } 269 | } 270 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.8.1" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "2.1.0" 18 | characters: 19 | dependency: transitive 20 | description: 21 | name: characters 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.1.0" 25 | charcode: 26 | dependency: transitive 27 | description: 28 | name: charcode 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.3.1" 32 | clock: 33 | dependency: transitive 34 | description: 35 | name: clock 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.1.0" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.15.0" 46 | cupertino_icons: 47 | dependency: "direct main" 48 | description: 49 | name: cupertino_icons 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "1.0.3" 53 | fake_async: 54 | dependency: transitive 55 | description: 56 | name: fake_async 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "1.2.0" 60 | flutter: 61 | dependency: "direct main" 62 | description: flutter 63 | source: sdk 64 | version: "0.0.0" 65 | flutter_shortcuts: 66 | dependency: "direct main" 67 | description: 68 | path: ".." 69 | relative: true 70 | source: path 71 | version: "1.3.0" 72 | flutter_test: 73 | dependency: "direct dev" 74 | description: flutter 75 | source: sdk 76 | version: "0.0.0" 77 | matcher: 78 | dependency: transitive 79 | description: 80 | name: matcher 81 | url: "https://pub.dartlang.org" 82 | source: hosted 83 | version: "0.12.10" 84 | meta: 85 | dependency: transitive 86 | description: 87 | name: meta 88 | url: "https://pub.dartlang.org" 89 | source: hosted 90 | version: "1.7.0" 91 | path: 92 | dependency: transitive 93 | description: 94 | name: path 95 | url: "https://pub.dartlang.org" 96 | source: hosted 97 | version: "1.8.0" 98 | plugin_platform_interface: 99 | dependency: transitive 100 | description: 101 | name: plugin_platform_interface 102 | url: "https://pub.dartlang.org" 103 | source: hosted 104 | version: "2.0.0" 105 | sky_engine: 106 | dependency: transitive 107 | description: flutter 108 | source: sdk 109 | version: "0.0.99" 110 | source_span: 111 | dependency: transitive 112 | description: 113 | name: source_span 114 | url: "https://pub.dartlang.org" 115 | source: hosted 116 | version: "1.8.1" 117 | stack_trace: 118 | dependency: transitive 119 | description: 120 | name: stack_trace 121 | url: "https://pub.dartlang.org" 122 | source: hosted 123 | version: "1.10.0" 124 | stream_channel: 125 | dependency: transitive 126 | description: 127 | name: stream_channel 128 | url: "https://pub.dartlang.org" 129 | source: hosted 130 | version: "2.1.0" 131 | string_scanner: 132 | dependency: transitive 133 | description: 134 | name: string_scanner 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "1.1.0" 138 | term_glyph: 139 | dependency: transitive 140 | description: 141 | name: term_glyph 142 | url: "https://pub.dartlang.org" 143 | source: hosted 144 | version: "1.2.0" 145 | test_api: 146 | dependency: transitive 147 | description: 148 | name: test_api 149 | url: "https://pub.dartlang.org" 150 | source: hosted 151 | version: "0.4.2" 152 | typed_data: 153 | dependency: transitive 154 | description: 155 | name: typed_data 156 | url: "https://pub.dartlang.org" 157 | source: hosted 158 | version: "1.3.0" 159 | vector_math: 160 | dependency: transitive 161 | description: 162 | name: vector_math 163 | url: "https://pub.dartlang.org" 164 | source: hosted 165 | version: "2.1.0" 166 | sdks: 167 | dart: ">=2.12.0 <3.0.0" 168 | flutter: ">=1.20.0" 169 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_shortcuts_example 2 | description: Demonstrates how to use the flutter_shortcuts plugin. 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `pub publish`. This is preferred for private packages. 6 | publish_to: "none" # Remove this line if you wish to publish to pub.dev 7 | 8 | environment: 9 | sdk: ">=2.12.0 <3.0.0" 10 | 11 | dependencies: 12 | flutter: 13 | sdk: flutter 14 | 15 | flutter_shortcuts: 16 | # When depending on this package from a real application you should use: 17 | # flutter_shortcuts: ^x.y.z 18 | # See https://dart.dev/tools/pub/dependencies#version-constraints 19 | # The example app is bundled with the plugin so we use a path dependency on 20 | # the parent directory to use the current plugin's version. 21 | path: ../ 22 | 23 | # The following adds the Cupertino Icons font to your application. 24 | # Use with the CupertinoIcons class for iOS style icons. 25 | cupertino_icons: ^1.0.2 26 | 27 | dev_dependencies: 28 | flutter_test: 29 | sdk: flutter 30 | 31 | # For information on the generic Dart part of this file, see the 32 | # following page: https://dart.dev/tools/pub/pubspec 33 | 34 | # The following section is specific to Flutter. 35 | flutter: 36 | # The following line ensures that the Material Icons font is 37 | # included with your application, so that you can use the icons in 38 | # the material Icons class. 39 | uses-material-design: true 40 | 41 | # To add assets to your application, add an assets section, like this: 42 | assets: 43 | - assets/icons/ 44 | - assets/svg/ 45 | 46 | # An image asset can refer to one or more resolution-specific "variants", see 47 | # https://flutter.dev/assets-and-images/#resolution-aware. 48 | 49 | # For details regarding adding assets from package dependencies, see 50 | # https://flutter.dev/assets-and-images/#from-packages 51 | 52 | # To add custom fonts to your application, add a fonts section here, 53 | # in this "flutter" section. Each entry in this list should have a 54 | # "family" key with the font family name, and a "fonts" key with a 55 | # list giving the asset and other descriptors for the font. For 56 | # example: 57 | # fonts: 58 | # - family: Schyler 59 | # fonts: 60 | # - asset: fonts/Schyler-Regular.ttf 61 | # - asset: fonts/Schyler-Italic.ttf 62 | # style: italic 63 | # - family: Trajan Pro 64 | # fonts: 65 | # - asset: fonts/TrajanPro.ttf 66 | # - asset: fonts/TrajanPro_Bold.ttf 67 | # weight: 700 68 | # 69 | # For details regarding fonts from package dependencies, 70 | # see https://flutter.dev/custom-fonts/#from-packages 71 | -------------------------------------------------------------------------------- /example/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter_test/flutter_test.dart'; 9 | 10 | import 'package:flutter_shortcuts_example/main.dart'; 11 | 12 | void main() { 13 | testWidgets('Verify Platform version', (WidgetTester tester) async { 14 | // Build our app and trigger a frame. 15 | await tester.pumpWidget(MyApp()); 16 | }); 17 | } 18 | -------------------------------------------------------------------------------- /flutter_shortcuts.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vagrant/ 3 | .sconsign.dblite 4 | .svn/ 5 | 6 | .DS_Store 7 | *.swp 8 | profile 9 | 10 | DerivedData/ 11 | build/ 12 | GeneratedPluginRegistrant.h 13 | GeneratedPluginRegistrant.m 14 | 15 | .generated/ 16 | 17 | *.pbxuser 18 | *.mode1v3 19 | *.mode2v3 20 | *.perspectivev3 21 | 22 | !default.pbxuser 23 | !default.mode1v3 24 | !default.mode2v3 25 | !default.perspectivev3 26 | 27 | xcuserdata 28 | 29 | *.moved-aside 30 | 31 | *.pyc 32 | *sync/ 33 | Icon? 34 | .tags* 35 | 36 | /Flutter/Generated.xcconfig 37 | /Flutter/flutter_export_environment.sh -------------------------------------------------------------------------------- /ios/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevsOnFlutter/flutter_shortcuts/cb797b0b39f51f91801e2fd2b3461701f99fc72f/ios/Assets/.gitkeep -------------------------------------------------------------------------------- /ios/Classes/FlutterShortcutsPlugin.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface FlutterShortcutsPlugin : NSObject 4 | @end 5 | -------------------------------------------------------------------------------- /ios/Classes/FlutterShortcutsPlugin.m: -------------------------------------------------------------------------------- 1 | #import "FlutterShortcutsPlugin.h" 2 | #if __has_include() 3 | #import 4 | #else 5 | // Support project import fallback if the generated compatibility header 6 | // is not copied when this plugin is created as a library. 7 | // https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816 8 | #import "flutter_shortcuts-Swift.h" 9 | #endif 10 | 11 | @implementation FlutterShortcutsPlugin 12 | + (void)registerWithRegistrar:(NSObject*)registrar { 13 | [SwiftFlutterShortcutsPlugin registerWithRegistrar:registrar]; 14 | } 15 | @end 16 | -------------------------------------------------------------------------------- /ios/Classes/SwiftFlutterShortcutsPlugin.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | 4 | public class SwiftFlutterShortcutsPlugin: NSObject, FlutterPlugin { 5 | public static func register(with registrar: FlutterPluginRegistrar) { 6 | let channel = FlutterMethodChannel(name: "flutter_shortcuts", binaryMessenger: registrar.messenger()) 7 | let instance = SwiftFlutterShortcutsPlugin() 8 | registrar.addMethodCallDelegate(instance, channel: channel) 9 | } 10 | 11 | public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { 12 | result("iOS " + UIDevice.current.systemVersion) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ios/flutter_shortcuts.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. 3 | # Run `pod lib lint flutter_shortcuts.podspec` to validate before publishing. 4 | # 5 | Pod::Spec.new do |s| 6 | s.name = 'flutter_shortcuts' 7 | s.version = '0.0.1' 8 | s.summary = 'A new Flutter plugin.' 9 | s.description = <<-DESC 10 | A new Flutter plugin. 11 | DESC 12 | s.homepage = 'http://example.com' 13 | s.license = { :file => '../LICENSE' } 14 | s.author = { 'Your Company' => 'email@example.com' } 15 | s.source = { :path => '.' } 16 | s.source_files = 'Classes/**/*' 17 | s.dependency 'Flutter' 18 | s.platform = :ios, '8.0' 19 | 20 | # Flutter.framework does not contain a i386 slice. 21 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } 22 | s.swift_version = '5.0' 23 | end 24 | -------------------------------------------------------------------------------- /lib/flutter_shortcuts.dart: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2021 divshekhar (Divyanshu Shekhar). 4 | All rights reserved. 5 | 6 | The plugin is governed by the BSD-3-clause License. Please see the LICENSE file 7 | for more details. 8 | 9 | */ 10 | 11 | import 'dart:async'; 12 | 13 | import 'package:flutter_shortcuts/src/platform/flutter_shortcuts_platform.dart'; 14 | import 'package:flutter_shortcuts/src/helper/helper.dart'; 15 | 16 | export 'package:flutter_shortcuts/src/helper/helper.dart'; 17 | 18 | class FlutterShortcuts { 19 | /// [initialize] initializes the flutter_shortcuts plugin. 20 | Future initialize({bool debug = true}) async { 21 | FlutterShortcutsPlatform.instance.initialize(debug); 22 | } 23 | 24 | /// [listenAction] performs action when shortcut is initiated. 25 | Future listenAction(ShortcutAction action) async { 26 | FlutterShortcutsPlatform.instance.listenAction(action); 27 | } 28 | 29 | /// [getMaxShortcutLimit] returns the maximum number of static or dynamic 30 | /// shortcuts that each launcher icon can have at a time. 31 | Future getMaxShortcutLimit() { 32 | return FlutterShortcutsPlatform.instance.getMaxShortcutLimit(); 33 | } 34 | 35 | /// [getIconProperties] returns the "maxHeight" and "maxWidth" of the shortcut icon. 36 | /// Example: {"maxHeight": 250, "maxWidth": 200} 37 | Future> getIconProperties() { 38 | return FlutterShortcutsPlatform.instance.getIconProperties(); 39 | } 40 | 41 | /// [setShortcutItems] will set all the shortcut items. 42 | Future setShortcutItems( 43 | {required List shortcutItems}) async { 44 | return FlutterShortcutsPlatform.instance.setShortcutItems(shortcutItems); 45 | } 46 | 47 | /// [clearShortcutItems] will remove all the shortcut items. 48 | Future clearShortcutItems() async { 49 | return FlutterShortcutsPlatform.instance.clearShortcutItems(); 50 | } 51 | 52 | /// [pushShortcutItem] will push a new shortcut item. 53 | /// If there is already a dynamic or pinned shortcut with the same ID, 54 | /// the shortcut will be updated and pushed at the end of the shortcut list. 55 | Future pushShortcutItem({required ShortcutItem shortcut}) async { 56 | return FlutterShortcutsPlatform.instance.pushShortcutItem(shortcut); 57 | } 58 | 59 | /// [pushShortcutItems] updates dynamic or pinned shortcuts with same IDs 60 | /// and pushes new shortcuts with different IDs. 61 | Future pushShortcutItems( 62 | {required List shortcutList}) async { 63 | return FlutterShortcutsPlatform.instance.pushShortcutItems(shortcutList); 64 | } 65 | 66 | /// [updateShortcutItems] updates shortcut items. 67 | /// If the IDs of the shortcuts are not same, no changes will be reflected. 68 | Future updateShortcutItems( 69 | {required List shortcutList}) async { 70 | return FlutterShortcutsPlatform.instance.updateShortcutItems(shortcutList); 71 | } 72 | 73 | /// [updateShortcutItem] updates a single shortcut item based on id. 74 | /// If the ID of the shortcut is not same, no changes will be reflected. 75 | Future updateShortcutItem({required ShortcutItem shortcut}) async { 76 | return FlutterShortcutsPlatform.instance.updateShortcutItem(shortcut); 77 | } 78 | 79 | /// [changeShortcutItemIcon] will change the icon of the shortcut based on id. 80 | /// If the ID of the shortcut is not same, no changes will be reflected. 81 | Future changeShortcutItemIcon( 82 | {required String id, required String icon}) async { 83 | return FlutterShortcutsPlatform.instance.changeShortcutItemIcon(id, icon); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /lib/src/helper/action/shortcut_action.dart: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2021 divshekhar (Divyanshu Shekhar). 4 | All rights reserved. 5 | 6 | The plugin is governed by the BSD-3-clause License. Please see the LICENSE file 7 | for more details. 8 | 9 | */ 10 | 11 | typedef void ShortcutAction(String action); 12 | -------------------------------------------------------------------------------- /lib/src/helper/enums/shortcut_icon_asset.dart: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2021 divshekhar (Divyanshu Shekhar). 4 | All rights reserved. 5 | 6 | The plugin is governed by the BSD-3-clause License. Please see the LICENSE file 7 | for more details. 8 | 9 | */ 10 | 11 | enum ShortcutIconAsset { 12 | /// Creates Icon from the native resources `drawable` & `mipmap` directory. 13 | androidAsset, 14 | 15 | /// Creates Icon from the flutter resources `assets/icons/flutter.png`. 16 | flutterAsset, 17 | } 18 | -------------------------------------------------------------------------------- /lib/src/helper/helper.dart: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2021 divshekhar (Divyanshu Shekhar). 4 | All rights reserved. 5 | 6 | The plugin is governed by the BSD-3-clause License. Please see the LICENSE file 7 | for more details. 8 | 9 | */ 10 | 11 | export 'action/shortcut_action.dart'; 12 | export 'model/shortcut_item.dart'; 13 | export 'enums/shortcut_icon_asset.dart'; 14 | -------------------------------------------------------------------------------- /lib/src/helper/model/shortcut_item.dart: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2021 divshekhar (Divyanshu Shekhar). 4 | All rights reserved. 5 | 6 | The plugin is governed by the BSD-3-clause License. Please see the LICENSE file 7 | for more details. 8 | 9 | */ 10 | 11 | import '../enums/shortcut_icon_asset.dart'; 12 | 13 | class ShortcutItem { 14 | /// Create a shortcut item. 15 | /// Eg. 16 | /// ```dart 17 | /// const ShortcutItem( 18 | /// id: "1", 19 | /// action: 'Home page action', 20 | /// shortLabel: 'Home Page', 21 | /// icon: 'assets/icons/home.png', 22 | /// ); 23 | /// ``` 24 | 25 | const ShortcutItem({ 26 | required this.id, 27 | required this.action, 28 | required this.shortLabel, 29 | this.shortcutIconAsset = ShortcutIconAsset.flutterAsset, 30 | this.longLabel, 31 | this.icon, 32 | this.conversationShortcut = false, 33 | this.isImportant = false, 34 | this.isBot = false, 35 | }); 36 | 37 | /// ID of the shortcut that differentiates it from other shortcuts. 38 | final String id; 39 | 40 | /// Action performed by the shortcut 41 | final String action; 42 | 43 | /// Short label of the shortcut 44 | final String shortLabel; 45 | 46 | /// Long label of the shortcut 47 | final String? longLabel; 48 | 49 | /// Flutter asset path. Only Supports image files. Eg. .png/.jpg 50 | final String? icon; 51 | 52 | /// `ShortcutIconType.androidAsset` or `ShortcutIconType.flutterAsset` 53 | final ShortcutIconAsset shortcutIconAsset; 54 | 55 | /// `true` if the shortcut is a person. 56 | final bool conversationShortcut; 57 | 58 | /// true if the person shortcut is a person 59 | final bool isImportant; 60 | 61 | /// true if the person shortcut is a machine/bot 62 | final bool isBot; 63 | 64 | Map serialize() { 65 | return { 66 | 'id': id, 67 | 'action': action, 68 | 'shortLabel': shortLabel, 69 | 'longLabel': longLabel, 70 | 'icon': icon, 71 | 'shortcutIconType': shortcutIconAsset.index.toString(), 72 | 'conversationShortcut': conversationShortcut, 73 | 'isImportant': isImportant, 74 | 'isBot': isBot, 75 | }; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /lib/src/method_call/flutter_shortcuts_method_call_handler.dart: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2021 divshekhar (Divyanshu Shekhar). 4 | All rights reserved. 5 | 6 | The plugin is governed by the BSD-3-clause License. Please see the LICENSE file 7 | for more details. 8 | 9 | */ 10 | 11 | import 'package:flutter/services.dart'; 12 | import 'package:flutter_shortcuts/src/platform/flutter_shortcuts_platform.dart'; 13 | import 'package:flutter_shortcuts/src/helper/helper.dart'; 14 | import 'package:flutter/foundation.dart'; 15 | 16 | class FlutterShortcutsMethodCallHandler extends FlutterShortcutsPlatform { 17 | final MethodChannel _channel = 18 | MethodChannel('com.divyanshushekhar.flutter_shortcuts'); 19 | 20 | MethodChannel get channel => _channel; 21 | 22 | @override 23 | Future initialize(bool debug) async { 24 | Map initValue = { 25 | 'debug': kReleaseMode ? false.toString() : debug.toString(), 26 | }; 27 | await channel.invokeMethod('initialize', [initValue]); 28 | } 29 | 30 | @override 31 | Future listenAction(ShortcutAction actionHandler) async { 32 | channel.setMethodCallHandler((MethodCall call) async { 33 | assert(call.method == 'launch'); 34 | actionHandler(call.arguments); 35 | }); 36 | final String? action = 37 | await channel.invokeMethod('getLaunchAction'); 38 | if (action != null) { 39 | actionHandler(action); 40 | } 41 | } 42 | 43 | @override 44 | Future getMaxShortcutLimit() { 45 | return channel.invokeMethod('getMaxShortcutLimit'); 46 | } 47 | 48 | @override 49 | Future> getIconProperties() async { 50 | return Map.castFrom( 51 | await channel.invokeMethod('getIconProperties')); 52 | } 53 | 54 | @override 55 | Future setShortcutItems(List items) async { 56 | final List> itemsList = 57 | items.map((item) => item.serialize()).toList(); 58 | await channel.invokeMethod('setShortcutItems', itemsList); 59 | } 60 | 61 | @override 62 | Future clearShortcutItems() async { 63 | await channel.invokeMethod('clearShortcutItems'); 64 | } 65 | 66 | @override 67 | Future pushShortcutItem(ShortcutItem shortcut) async { 68 | final Map item = shortcut.serialize(); 69 | await channel.invokeMethod('pushShortcutItem', [item]); 70 | } 71 | 72 | @override 73 | Future pushShortcutItems(List items) async { 74 | final List> itemsList = 75 | items.map((item) => item.serialize()).toList(); 76 | await channel.invokeMethod('pushShortcutItems', itemsList); 77 | } 78 | 79 | @override 80 | Future updateShortcutItems(List items) async { 81 | final List> itemsList = 82 | items.map((item) => item.serialize()).toList(); 83 | await channel.invokeMethod('updateShortcutItems', itemsList); 84 | } 85 | 86 | @override 87 | Future updateShortcutItem(ShortcutItem shortcut) async { 88 | final Map item = shortcut.serialize(); 89 | await channel.invokeMethod('updateShortcutItem', [item]); 90 | } 91 | 92 | @override 93 | Future changeShortcutItemIcon(String id, String icon) async { 94 | await channel.invokeMethod('changeShortcutItemIcon', [id, icon]); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /lib/src/platform/flutter_shortcuts_platform.dart: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2021 divshekhar (Divyanshu Shekhar). 4 | All rights reserved. 5 | 6 | The plugin is governed by the BSD-3-clause License. Please see the LICENSE file 7 | for more details. 8 | 9 | */ 10 | 11 | import 'package:flutter_shortcuts/src/method_call/flutter_shortcuts_method_call_handler.dart'; 12 | import 'package:flutter_shortcuts/src/helper/helper.dart'; 13 | import 'package:plugin_platform_interface/plugin_platform_interface.dart'; 14 | 15 | abstract class FlutterShortcutsPlatform extends PlatformInterface { 16 | FlutterShortcutsPlatform() : super(token: _token); 17 | 18 | static final Object _token = Object(); 19 | 20 | static FlutterShortcutsPlatform _instance = 21 | FlutterShortcutsMethodCallHandler(); 22 | 23 | /// returns the instance of the [FlutterShortcutsMethodChannel]. 24 | static FlutterShortcutsPlatform get instance => _instance; 25 | 26 | static set instance(FlutterShortcutsPlatform instance) { 27 | PlatformInterface.verifyToken(instance, _token); 28 | _instance = instance; 29 | } 30 | 31 | Future initialize(bool debug) async { 32 | throw UnimplementedError("initialize() has not been implemented."); 33 | } 34 | 35 | Future listenAction(ShortcutAction action) async { 36 | throw UnimplementedError("listenAction() has not been implemented."); 37 | } 38 | 39 | Future getMaxShortcutLimit() { 40 | throw UnimplementedError("getMaxShortcutLimit() has not been implemented."); 41 | } 42 | 43 | Future> getIconProperties() { 44 | throw UnimplementedError("getIconProperties() has not been implemented."); 45 | } 46 | 47 | Future setShortcutItems(List items) async { 48 | throw UnimplementedError("setShortcutItems() has not been implemented."); 49 | } 50 | 51 | Future clearShortcutItems() async { 52 | throw UnimplementedError("clearShortcutItems() has not been implemented."); 53 | } 54 | 55 | Future pushShortcutItem(ShortcutItem shortcut) async { 56 | throw UnimplementedError("pushShortcutItem() has not been implemented."); 57 | } 58 | 59 | Future pushShortcutItems(List items) async { 60 | throw UnimplementedError("pushShortcutItems() has not been implemented."); 61 | } 62 | 63 | Future updateShortcutItems(List items) async { 64 | throw UnimplementedError("updateShortcutItems() has not been implemented."); 65 | } 66 | 67 | Future updateShortcutItem(ShortcutItem shortcut) async { 68 | throw UnimplementedError("updateShortcutItem() has not been implemented."); 69 | } 70 | 71 | Future changeShortcutItemIcon(String id, String icon) async { 72 | throw UnimplementedError( 73 | "changeShortcutItemIcon() has not been implemented."); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.8.1" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "2.1.0" 18 | characters: 19 | dependency: transitive 20 | description: 21 | name: characters 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.1.0" 25 | charcode: 26 | dependency: transitive 27 | description: 28 | name: charcode 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.3.1" 32 | clock: 33 | dependency: transitive 34 | description: 35 | name: clock 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.1.0" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.15.0" 46 | fake_async: 47 | dependency: transitive 48 | description: 49 | name: fake_async 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "1.2.0" 53 | flutter: 54 | dependency: "direct main" 55 | description: flutter 56 | source: sdk 57 | version: "0.0.0" 58 | flutter_test: 59 | dependency: "direct dev" 60 | description: flutter 61 | source: sdk 62 | version: "0.0.0" 63 | matcher: 64 | dependency: transitive 65 | description: 66 | name: matcher 67 | url: "https://pub.dartlang.org" 68 | source: hosted 69 | version: "0.12.10" 70 | meta: 71 | dependency: transitive 72 | description: 73 | name: meta 74 | url: "https://pub.dartlang.org" 75 | source: hosted 76 | version: "1.7.0" 77 | path: 78 | dependency: transitive 79 | description: 80 | name: path 81 | url: "https://pub.dartlang.org" 82 | source: hosted 83 | version: "1.8.0" 84 | pedantic: 85 | dependency: "direct dev" 86 | description: 87 | name: pedantic 88 | url: "https://pub.dartlang.org" 89 | source: hosted 90 | version: "1.11.0" 91 | plugin_platform_interface: 92 | dependency: "direct main" 93 | description: 94 | name: plugin_platform_interface 95 | url: "https://pub.dartlang.org" 96 | source: hosted 97 | version: "2.0.0" 98 | sky_engine: 99 | dependency: transitive 100 | description: flutter 101 | source: sdk 102 | version: "0.0.99" 103 | source_span: 104 | dependency: transitive 105 | description: 106 | name: source_span 107 | url: "https://pub.dartlang.org" 108 | source: hosted 109 | version: "1.8.1" 110 | stack_trace: 111 | dependency: transitive 112 | description: 113 | name: stack_trace 114 | url: "https://pub.dartlang.org" 115 | source: hosted 116 | version: "1.10.0" 117 | stream_channel: 118 | dependency: transitive 119 | description: 120 | name: stream_channel 121 | url: "https://pub.dartlang.org" 122 | source: hosted 123 | version: "2.1.0" 124 | string_scanner: 125 | dependency: transitive 126 | description: 127 | name: string_scanner 128 | url: "https://pub.dartlang.org" 129 | source: hosted 130 | version: "1.1.0" 131 | term_glyph: 132 | dependency: transitive 133 | description: 134 | name: term_glyph 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "1.2.0" 138 | test_api: 139 | dependency: transitive 140 | description: 141 | name: test_api 142 | url: "https://pub.dartlang.org" 143 | source: hosted 144 | version: "0.4.2" 145 | typed_data: 146 | dependency: transitive 147 | description: 148 | name: typed_data 149 | url: "https://pub.dartlang.org" 150 | source: hosted 151 | version: "1.3.0" 152 | vector_math: 153 | dependency: transitive 154 | description: 155 | name: vector_math 156 | url: "https://pub.dartlang.org" 157 | source: hosted 158 | version: "2.1.0" 159 | sdks: 160 | dart: ">=2.12.0 <3.0.0" 161 | flutter: ">=1.20.0" 162 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_shortcuts 2 | description: Flutter plugin for creating static & dynamic app/conversation shortcuts on home screen. 3 | version: 1.3.0 4 | repository: https://github.com/DevsOnFlutter/flutter_shortcuts 5 | documentation: https://github.com/DevsOnFlutter/flutter_shortcuts/blob/main/README.md 6 | 7 | environment: 8 | sdk: ">=2.12.0 <3.0.0" 9 | flutter: ">=1.20.0" 10 | 11 | dependencies: 12 | flutter: 13 | sdk: flutter 14 | plugin_platform_interface: ^2.0.0 15 | 16 | dev_dependencies: 17 | flutter_test: 18 | sdk: flutter 19 | pedantic: ^1.11.0 20 | 21 | # For information on the generic Dart part of this file, see the 22 | # following page: https://dart.dev/tools/pub/pubspec 23 | 24 | # The following section is specific to Flutter. 25 | flutter: 26 | # This section identifies this Flutter project as a plugin project. 27 | # The 'pluginClass' and Android 'package' identifiers should not ordinarily 28 | # be modified. They are used by the tooling to maintain consistency when 29 | # adding or updating assets for this project. 30 | plugin: 31 | platforms: 32 | android: 33 | package: com.divyanshushekhar.flutter_shortcuts 34 | pluginClass: FlutterShortcutsPlugin 35 | ios: 36 | pluginClass: FlutterShortcutsPlugin 37 | 38 | # To add assets to your plugin package, add an assets section, like this: 39 | # assets: 40 | # - images/a_dot_burr.jpeg 41 | # - images/a_dot_ham.jpeg 42 | # 43 | # For details regarding assets in packages, see 44 | # https://flutter.dev/assets-and-images/#from-packages 45 | # 46 | # An image asset can refer to one or more resolution-specific "variants", see 47 | # https://flutter.dev/assets-and-images/#resolution-aware. 48 | 49 | # To add custom fonts to your plugin package, add a fonts section here, 50 | # in this "flutter" section. Each entry in this list should have a 51 | # "family" key with the font family name, and a "fonts" key with a 52 | # list giving the asset and other descriptors for the font. For 53 | # example: 54 | # fonts: 55 | # - family: Schyler 56 | # fonts: 57 | # - asset: fonts/Schyler-Regular.ttf 58 | # - asset: fonts/Schyler-Italic.ttf 59 | # style: italic 60 | # - family: Trajan Pro 61 | # fonts: 62 | # - asset: fonts/TrajanPro.ttf 63 | # - asset: fonts/TrajanPro_Bold.ttf 64 | # weight: 700 65 | # 66 | # For details regarding fonts in packages, see 67 | # https://flutter.dev/custom-fonts/#from-packages 68 | -------------------------------------------------------------------------------- /test/flutter_shortcuts_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/services.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | 4 | void main() { 5 | const MethodChannel channel = MethodChannel('flutter_shortcuts'); 6 | 7 | TestWidgetsFlutterBinding.ensureInitialized(); 8 | 9 | setUp(() { 10 | channel.setMockMethodCallHandler((MethodCall methodCall) async { 11 | return '42'; 12 | }); 13 | }); 14 | 15 | tearDown(() { 16 | channel.setMockMethodCallHandler(null); 17 | }); 18 | } 19 | --------------------------------------------------------------------------------