Skip to content

Commit 1101ddf

Browse files
committed
Merge branch 'development'
Release 0.6.1
2 parents 59f5c66 + 161b2c1 commit 1101ddf

File tree

9 files changed

+58
-29
lines changed

9 files changed

+58
-29
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@ jobs:
2121
name: Lint
2222
runs-on: ubuntu-latest
2323
steps:
24-
- uses: actions/checkout@v1
25-
- uses: actions/setup-java@v1
24+
- uses: actions/checkout@v3
25+
- uses: actions/setup-java@v3
2626
with:
27-
java-version: '12.x'
28-
- uses: actions/cache@v2
27+
distribution: 'adopt'
28+
java-version: '12'
29+
- uses: actions/cache@v3
2930
with:
3031
path: /opt/hostedtoolcache/flutter
3132
key: ${{ github.ref }}-${{ env.flutter_version }}
@@ -43,11 +44,12 @@ jobs:
4344
name: Test
4445
runs-on: ubuntu-latest
4546
steps:
46-
- uses: actions/checkout@v1
47-
- uses: actions/setup-java@v1
47+
- uses: actions/checkout@v3
48+
- uses: actions/setup-java@v3
4849
with:
49-
java-version: '12.x'
50-
- uses: actions/cache@v2
50+
distribution: 'adopt'
51+
java-version: '12'
52+
- uses: actions/cache@v3
5153
with:
5254
path: /opt/hostedtoolcache/flutter
5355
key: ${{ github.ref }}-${{ env.flutter_version }}

CHANGELOG.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,20 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## 0.6.1 - 2022-12-15
8+
### Added
9+
- Added `CommandPaletteStyle.barrierFilter`, which is an optional `ImageFilter` which can be used to add an effect (usually a blurring) behind the command palette when it's open
10+
11+
### Changed
12+
- The default value of `CommandPaletteStyle.borderRadius` has been changed to `BorderRadius.all(Radius.circular(5))`
13+
14+
### Fixed
15+
- `CommandPaletteStyle.borderRadius` now correctly applies to the border of the entire modal, and not just the part with the actions/instructions.
16+
717
## 0.6.0 - 2022-12-10
818
### Fixed
919
- Semi-Breaking: Changed the type of `CommandPaletteConfig.openKeySet` and `CommandPaletteConfig.closeKeySet` from `LogicalKeySet` to `ShortcutActivator` (note: `LogicalKeySet` already implements `ShortcutActivator`, so existing custom shortcuts should still work, but a proposed solution is discussed below). This was done to fix an issue on Web builds for MacOS (discussed [here](https://github.com/TNorbury/command_palette/issues/22)). If you don't set custom values for the open and close key sets (or if you're not targeting Web), then no change will be required on your part. But if you are, the following change is suggested to make sure everything works well: If you're opening the palette with a keyboard shortcut, such as CTRL/CMD+U, then you could go from `LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyU)`/`LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.keyU)` to `SingleActivator(LogicalKeyboardKey.keyU, control: true)`/`SingleActivator(LogicalKeyboardKey.keyU, meta: true)`. This also changes how the command palette control shortcuts (Up/down/enter/backspace) are handled (from `LogicalKeySet` to `SingleActivator`). This should make things a bit cleaner on my end, and more stable going forward.
10-
- Escape query correctly so that single a '' don't cause filtering to crash
20+
- Escape query correctly so that single a '\\' don't cause filtering to crash
1121

1222
## 0.5.1 - 2022-12-02
1323
### Added
@@ -61,4 +71,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6171

6272
## 0.1.0 - 2021-11-03
6373
### Added
64-
- initial release
74+
- initial release

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ packages:
4242
path: ".."
4343
relative: true
4444
source: path
45-
version: "0.6.0"
45+
version: "0.6.1"
4646
fake_async:
4747
dependency: transitive
4848
description:

lib/src/command_palette.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import 'package:flutter/foundation.dart';
22
import 'package:flutter/material.dart';
3-
import 'package:flutter/services.dart';
43

54
import '../command_palette.dart';
65
import 'controller/command_palette_controller.dart';
@@ -209,6 +208,7 @@ class _CommandPaletteInnerState extends State<_CommandPaletteInner> {
209208
prefixNestedActions: styleToCopy.prefixNestedActions,
210209
instructionColor: styleToCopy.instructionColor ??
211210
newActionLabelTextStyle?.color?.withOpacity(.84),
211+
barrierFilter: styleToCopy.barrierFilter,
212212
);
213213

214214
widget.controller.style = _style;
@@ -267,6 +267,7 @@ class _CommandPaletteInnerState extends State<_CommandPaletteInner> {
267267
transitionCurve: widget.config.transitionCurve,
268268
transitionDuration: widget.config.transitionDuration,
269269
closeKeySet: widget.config.closeKeySet,
270+
filter: widget.config.style?.barrierFilter,
270271
),
271272
)
272273
.then(

lib/src/models/command_palette_style.dart

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import 'dart:ui';
2+
13
import 'package:flutter/material.dart';
24

35
/// Used to style a [CommandPalette]
@@ -63,10 +65,7 @@ class CommandPaletteStyle {
6365
///
6466
/// Defaults to
6567
/// ```
66-
/// BorderRadius.only(
67-
/// bottomLeft: Radius.circular(5),
68-
/// bottomRight: Radius.circular(5),
69-
/// )
68+
/// BorderRadius.all(Radius.circular(5))
7069
/// ```
7170
final BorderRadiusGeometry borderRadius;
7271

@@ -80,6 +79,10 @@ class CommandPaletteStyle {
8079
/// Defaults to `Colors.black12`
8180
final Color commandPaletteBarrierColor;
8281

82+
/// Filter to apply behind the command palette when it's open. It's used to set
83+
/// [ModalRoute.filter].
84+
final ImageFilter? barrierFilter;
85+
8386
/// Decoration used for the text field
8487
///
8588
/// Defaults to
@@ -114,15 +117,13 @@ class CommandPaletteStyle {
114117
this.highlightSearchSubstring = true,
115118
this.actionDescriptionTextStyle,
116119
this.elevation = 4.0,
117-
this.borderRadius = const BorderRadius.only(
118-
bottomLeft: Radius.circular(5),
119-
bottomRight: Radius.circular(5),
120-
),
120+
this.borderRadius = const BorderRadius.all(Radius.circular(5)),
121121
this.actionLabelTextAlign = TextAlign.left,
122122
this.commandPaletteBarrierColor = Colors.black12,
123123
this.textFieldInputDecoration,
124124
this.prefixNestedActions = true,
125125
this.instructionColor,
126+
this.barrierFilter,
126127
});
127128

128129
@override
@@ -142,7 +143,8 @@ class CommandPaletteStyle {
142143
other.commandPaletteBarrierColor == commandPaletteBarrierColor &&
143144
other.textFieldInputDecoration == textFieldInputDecoration &&
144145
other.prefixNestedActions == prefixNestedActions &&
145-
other.instructionColor == instructionColor;
146+
other.instructionColor == instructionColor &&
147+
other.barrierFilter == barrierFilter;
146148
}
147149

148150
@override
@@ -159,7 +161,8 @@ class CommandPaletteStyle {
159161
commandPaletteBarrierColor.hashCode ^
160162
textFieldInputDecoration.hashCode ^
161163
prefixNestedActions.hashCode ^
162-
instructionColor.hashCode;
164+
instructionColor.hashCode ^
165+
barrierFilter.hashCode;
163166
}
164167
}
165168

lib/src/widgets/command_palette_modal.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// ignore_for_file: body_might_complete_normally_nullable
22

3+
import 'dart:ui';
4+
35
import 'package:command_palette/src/controller/command_palette_controller.dart';
46
import 'package:flutter/material.dart';
57
import 'package:flutter/services.dart';
@@ -43,8 +45,10 @@ class CommandPaletteModal extends ModalRoute<void> {
4345
required Duration transitionDuration,
4446
required Curve transitionCurve,
4547
required this.closeKeySet,
48+
ImageFilter? filter,
4649
}) : _transitionDuration = transitionDuration,
47-
_transitionCurve = transitionCurve;
50+
_transitionCurve = transitionCurve,
51+
super(filter: filter);
4852

4953
@override
5054
Color? get barrierColor =>

lib/src/widgets/command_palette_text_field.dart

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ class _CommandPaletteTextFieldState extends State<CommandPaletteTextField> {
5454
Widget build(BuildContext context) {
5555
final CommandPaletteController controller =
5656
CommandPaletteControllerProvider.of(context);
57-
InputDecoration inputDecoration =
58-
controller.style.textFieldInputDecoration!;
57+
final style = controller.style;
58+
InputDecoration inputDecoration = style.textFieldInputDecoration!;
5959

6060
// if no prefix was provided, the selected action is a nested action, and
6161
// the user indicates that they want nested actions to have prefix text,
@@ -64,7 +64,7 @@ class _CommandPaletteTextFieldState extends State<CommandPaletteTextField> {
6464
inputDecoration.prefixIcon == null &&
6565
inputDecoration.prefixText == null;
6666
if (styleHasNoPrefix &&
67-
controller.style.prefixNestedActions &&
67+
style.prefixNestedActions &&
6868
controller.currentlySelectedAction?.actionType ==
6969
CommandPaletteActionType.nested) {
7070
inputDecoration = inputDecoration.copyWith(
@@ -73,8 +73,13 @@ class _CommandPaletteTextFieldState extends State<CommandPaletteTextField> {
7373
);
7474
}
7575

76+
final radius = style.borderRadius.resolve(Directionality.of(context));
7677
return Material(
7778
elevation: 4,
79+
borderRadius: BorderRadius.only(
80+
topLeft: radius.topLeft,
81+
topRight: radius.topRight,
82+
),
7883
child: TextField(
7984
controller: controller.textEditingController,
8085
textInputAction: TextInputAction.done,

lib/src/widgets/options/command_palette_body.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@ class CommandPaletteBody extends StatelessWidget {
1818
CommandPaletteController controller =
1919
CommandPaletteControllerProvider.of(context);
2020
List<CommandPaletteAction> actions = controller.getFilteredActions();
21-
21+
final borderRadius =
22+
controller.style.borderRadius.resolve(Directionality.of(context));
2223
return Material(
2324
elevation: controller.style.elevation,
24-
borderRadius: controller.style.borderRadius,
25+
borderRadius: BorderRadius.only(
26+
bottomLeft: borderRadius.bottomLeft,
27+
bottomRight: borderRadius.bottomRight,
28+
),
2529
clipBehavior: Clip.antiAlias,
2630
child: Column(
2731
mainAxisSize: MainAxisSize.min,

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: command_palette
22
description: Flutter implementation of the Command Palette. Can be brought up via a keyboard shortcut.
3-
version: 0.6.0
3+
version: 0.6.1
44
homepage: https://github.com/TNorbury/command_palette
55
issue_tracker: https://github.com/TNorbury/command_palette/issues
66
repository: https://github.com/TNorbury/command_palette

0 commit comments

Comments
 (0)