Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/quick_actions/quick_actions/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
18 changes: 13 additions & 5 deletions packages/quick_actions/quick_actions/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# quick_actions
<?code-excerpt path-base="example/lib"?>

This Flutter plugin allows you to manage and interact with the application's
home screen quick actions.
Expand All @@ -19,22 +20,29 @@ 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.

<?code-excerpt "readme_excerpts.dart (Initialize)"?>
```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...
});
```

Finally, manage the app's quick actions, for instance:

<?code-excerpt "readme_excerpts.dart (SetShortcutItems)"?>
```dart
quickActions.setShortcutItems(<ShortcutItem>[
await quickActions.setShortcutItems(<ShortcutItem>[
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',
),
]);
```

Expand Down
2 changes: 0 additions & 2 deletions packages/quick_actions/quick_actions/ci_config.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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<void> setShortcutItemsSnippet() async {
const quickActions = QuickActions();
// #docregion SetShortcutItems
await quickActions.setShortcutItems(<ShortcutItem>[
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
}
2 changes: 1 addition & 1 deletion packages/quick_actions/quick_actions/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down