Skip to content

Commit 4d63906

Browse files
authored
Turned on ImageFilter.compose for web CupertinoDesktopTextSelectionToolbar (#163229)
flutter/flutter#120123 was closed out so this should work now. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
1 parent 571d495 commit 4d63906

2 files changed

Lines changed: 5 additions & 17 deletions

File tree

packages/flutter/lib/src/cupertino/desktop_text_selection_toolbar.dart

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ library;
1010

1111
import 'dart:ui';
1212

13-
import 'package:flutter/foundation.dart';
1413
import 'package:flutter/widgets.dart';
1514

1615
import 'colors.dart';
@@ -108,15 +107,10 @@ class CupertinoDesktopTextSelectionToolbar extends StatelessWidget {
108107
borderRadius: BorderRadius.all(_kToolbarBorderRadius),
109108
),
110109
child: BackdropFilter(
111-
// Flutter web doesn't support ImageFilter.compose on CanvasKit yet
112-
// (https://github.com/flutter/flutter/issues/120123).
113-
filter:
114-
kIsWeb
115-
? ImageFilter.blur(sigmaX: _kToolbarBlurSigma, sigmaY: _kToolbarBlurSigma)
116-
: ImageFilter.compose(
117-
outer: ColorFilter.matrix(_matrixWithSaturation(_kToolbarSaturationBoost)),
118-
inner: ImageFilter.blur(sigmaX: _kToolbarBlurSigma, sigmaY: _kToolbarBlurSigma),
119-
),
110+
filter: ImageFilter.compose(
111+
outer: ColorFilter.matrix(_matrixWithSaturation(_kToolbarSaturationBoost)),
112+
inner: ImageFilter.blur(sigmaX: _kToolbarBlurSigma, sigmaY: _kToolbarBlurSigma),
113+
),
120114
child: DecoratedBox(
121115
decoration: BoxDecoration(
122116
color: _kToolbarBackgroundColor.resolveFrom(context),

packages/flutter/test/cupertino/desktop_text_selection_toolbar_test.dart

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import 'dart:ui';
66

77
import 'package:flutter/cupertino.dart';
8-
import 'package:flutter/foundation.dart';
98
import 'package:flutter_test/flutter_test.dart';
109

1110
void main() {
@@ -41,12 +40,7 @@ void main() {
4140
// for blur and saturation, but checking if it's a _ComposeImageFilter
4241
// should be enough. Outer and inner parameters don't matter, we just need
4342
// a new _ComposeImageFilter to get its runtimeType.
44-
//
45-
// As web doesn't support ImageFilter.compose, we use just blur when
46-
// kIsWeb.
47-
kIsWeb
48-
? ImageFilter.blur().runtimeType
49-
: ImageFilter.compose(outer: ImageFilter.blur(), inner: ImageFilter.blur()).runtimeType,
43+
ImageFilter.compose(outer: ImageFilter.blur(), inner: ImageFilter.blur()).runtimeType,
5044
);
5145
});
5246

0 commit comments

Comments
 (0)