diff --git a/packages/quick_actions/quick_actions/CHANGELOG.md b/packages/quick_actions/quick_actions/CHANGELOG.md index b292466fa63c..e19526a3ed4c 100644 --- a/packages/quick_actions/quick_actions/CHANGELOG.md +++ b/packages/quick_actions/quick_actions/CHANGELOG.md @@ -1,5 +1,7 @@ -## NEXT +## 1.1.1 +* Adopts `code-excerpt` for the README's Dart snippets so they are validated + against compilable, analyzed source. * Updates minimum supported SDK version to Flutter 3.38/Dart 3.10. * Updates README to reflect currently supported OS versions for the latest versions of the endorsed platform implementations. diff --git a/packages/quick_actions/quick_actions/README.md b/packages/quick_actions/quick_actions/README.md index 72dcd42220ee..90706fb29755 100644 --- a/packages/quick_actions/quick_actions/README.md +++ b/packages/quick_actions/quick_actions/README.md @@ -1,4 +1,5 @@ # quick_actions + This Flutter plugin allows you to manage and interact with the application's home screen quick actions. @@ -19,11 +20,12 @@ Initialize the library early in your application's lifecycle by providing a callback, which will then be called whenever the user launches the app via a quick action. + ```dart -final QuickActions quickActions = const QuickActions(); -quickActions.initialize((shortcutType) { +const quickActions = QuickActions(); +quickActions.initialize((String shortcutType) { if (shortcutType == 'action_main') { - print('The user tapped on the "Main view" action.'); + debugPrint('The user tapped on the "Main view" action.'); } // More handling code... }); @@ -31,10 +33,16 @@ quickActions.initialize((shortcutType) { Finally, manage the app's quick actions, for instance: + ```dart -quickActions.setShortcutItems([ +await quickActions.setShortcutItems([ const ShortcutItem(type: 'action_main', localizedTitle: 'Main view', icon: 'icon_main'), - const ShortcutItem(type: 'action_help', localizedTitle: 'Help', localizedSubtitle: 'Tap to get help', icon: 'icon_help') + const ShortcutItem( + type: 'action_help', + localizedTitle: 'Help', + localizedSubtitle: 'Tap to get help', + icon: 'icon_help', + ), ]); ``` diff --git a/packages/quick_actions/quick_actions/ci_config.yaml b/packages/quick_actions/quick_actions/ci_config.yaml deleted file mode 100644 index b352e13e0dfa..000000000000 --- a/packages/quick_actions/quick_actions/ci_config.yaml +++ /dev/null @@ -1,2 +0,0 @@ -# TODO(stuartmorgan): Remove this; see https://github.com/flutter/flutter/issues/102679 -exempt_from_excerpts: true diff --git a/packages/quick_actions/quick_actions/example/lib/readme_excerpts.dart b/packages/quick_actions/quick_actions/example/lib/readme_excerpts.dart new file mode 100644 index 000000000000..595773bd00d9 --- /dev/null +++ b/packages/quick_actions/quick_actions/example/lib/readme_excerpts.dart @@ -0,0 +1,35 @@ +// Copyright 2013 The Flutter Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter/foundation.dart'; +import 'package:quick_actions/quick_actions.dart'; + +/// Initializes the plugin and handles quick action launches. +void initializeSnippet() { + // #docregion Initialize + const quickActions = QuickActions(); + quickActions.initialize((String shortcutType) { + if (shortcutType == 'action_main') { + debugPrint('The user tapped on the "Main view" action.'); + } + // More handling code... + }); + // #enddocregion Initialize +} + +/// Sets the shortcut items shown on the device's home screen. +Future setShortcutItemsSnippet() async { + const quickActions = QuickActions(); + // #docregion SetShortcutItems + await quickActions.setShortcutItems([ + const ShortcutItem(type: 'action_main', localizedTitle: 'Main view', icon: 'icon_main'), + const ShortcutItem( + type: 'action_help', + localizedTitle: 'Help', + localizedSubtitle: 'Tap to get help', + icon: 'icon_help', + ), + ]); + // #enddocregion SetShortcutItems +} diff --git a/packages/quick_actions/quick_actions/pubspec.yaml b/packages/quick_actions/quick_actions/pubspec.yaml index 445cf4b24e2c..c8e60c904af5 100644 --- a/packages/quick_actions/quick_actions/pubspec.yaml +++ b/packages/quick_actions/quick_actions/pubspec.yaml @@ -3,7 +3,7 @@ description: Flutter plugin for creating shortcuts on home screen, also known as Quick Actions on iOS and App Shortcuts on Android. repository: https://github.com/flutter/packages/tree/main/packages/quick_actions/quick_actions issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+quick_actions%22 -version: 1.1.0 +version: 1.1.1 environment: sdk: ^3.10.0