Skip to content

Commit

Permalink
[rfw] Adds support for DecorationImage.filterQuality. (#6781)
Browse files Browse the repository at this point in the history
And hard-codes filter qualities in tests to prepare for flutter/flutter#148799, which switches the default to `medium`. This hard-codes a filter quality in the test so the test passes no matter what the default is.
  • Loading branch information
goderbauer authored May 23, 2024
1 parent 6525441 commit 79e4cbe
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions packages/rfw/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 1.0.27
* Adds support for `DecorationImage.filterQuality`.

## 1.0.26
* Supports overriding the error widget builder.

Expand Down
1 change: 1 addition & 0 deletions packages/rfw/lib/src/flutter/argument_decoders.dart
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@ class ArgumentDecoders {
centerSlice: rect(source, [...key, 'centerSlice']),
repeat: enumValue<ImageRepeat>(ImageRepeat.values, source, [...key, 'repeat']) ?? ImageRepeat.noRepeat,
matchTextDirection: source.v<bool>([...key, 'matchTextDirection']) ?? false,
filterQuality: enumValue<FilterQuality>(FilterQuality.values, source, [...key, 'filterQuality']) ?? FilterQuality.medium,
);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/rfw/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: rfw
description: "Remote Flutter widgets: a library for rendering declarative widget description files at runtime."
repository: https://github.com/flutter/packages/tree/main/packages/rfw
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+rfw%22
version: 1.0.26
version: 1.0.27

environment:
sdk: ^3.2.0
Expand Down
6 changes: 4 additions & 2 deletions packages/rfw/test/argument_decoders_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ void main() {
1.0, 1.0, 1.0, 1.0, 1.0,
],
},
filterQuality: "none",
},
gradient: {
type: 'sweep',
Expand All @@ -314,6 +315,7 @@ void main() {
blendMode: "xor",
},
onError: event 'image-error-event' { },
filterQuality: "high",
},
gradient: {
type: 'linear',
Expand Down Expand Up @@ -383,13 +385,13 @@ void main() {
(tester.widgetList<DecoratedBox>(find.byType(DecoratedBox)).toList()[1].decoration as BoxDecoration).image.toString(),
'DecorationImage(AssetImage(bundle: null, name: "asset"), ' // this just seemed like the easiest way to check all this...
'ColorFilter.matrix([$matrix]), '
'Alignment.center, centerSlice: Rect.fromLTRB(5.0, 8.0, 105.0, 78.0), scale 1.0, opacity 1.0, FilterQuality.low)',
'Alignment.center, centerSlice: Rect.fromLTRB(5.0, 8.0, 105.0, 78.0), scale 1.0, opacity 1.0, FilterQuality.none)',
);
expect(
(tester.widgetList<DecoratedBox>(find.byType(DecoratedBox)).toList()[0].decoration as BoxDecoration).image.toString(),
'DecorationImage(NetworkImage("x-invalid://", scale: 1.0), '
'ColorFilter.mode(Color(0xff8811ff), BlendMode.xor), Alignment.center, scale 1.0, '
'opacity 1.0, FilterQuality.low)',
'opacity 1.0, FilterQuality.high)',
);

ArgumentDecoders.colorFilterDecoders['custom'] = (DataSource source, List<Object> key) {
Expand Down

0 comments on commit 79e4cbe

Please sign in to comment.