Kate Lovett b2bbb52ee1
Add remaining dart fixes for Color deprecations when importing painting.dart (#162609)
Towards https://github.com/flutter/flutter/issues/160617

Noticed the `opacity` and `withOpacity` deprecations were supported by
dart fix, but not the others. Adding them here.

But strange too given `dart:ui` does not support dart fix
(https://github.com/dart-lang/sdk/issues/59764)..

---

We think since `painting.dart` exports `dart:ui`, this is somewhat of a
workaround.

If a user has this atop their file:

```dart
import 'package:flutter/painting.dart'; // 👍  dart fix will work here
```
 If instead

```dart
import 'dart:ui'; //   dart fix will not work here
```

Will continue to follow up on dart fix support for `dart:X` libraries,
for now hopefully this will help!

## 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
2025-03-14 22:33:08 +00:00

166 lines
4.7 KiB
YAML

# Copyright 2014 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# For details regarding the *Flutter Fix* feature, see
# https://flutter.dev/to/flutter-fix
# Please add new fixes to the top of the file, separated by one blank line
# from other fixes. In a comment, include a link to the PR where the change
# requiring the fix was made.
# Every fix must be tested. See the flutter/packages/flutter/test_fixes/README.md
# file for instructions on testing these data driven fixes.
# For documentation about this file format, see
# https://dart.dev/go/data-driven-fixes.
# * Fixes in this file are from the Painting library. *
version: 1
transforms:
# Change made in https://github.com/flutter/flutter/pull/128522
- title: "Migrate to 'textScaler'"
date: 2023-06-09
element:
uris: [ 'painting.dart' ]
method: 'computeMaxIntrinsicWidth'
inClass: 'TextPainter'
changes:
- kind: 'addParameter'
index: 4
name: 'textScaler'
style: optional_named
argumentValue:
expression: 'TextScaler.linear({% textScaleFactor %})'
requiredIf: "textScaleFactor != ''"
- kind: 'removeParameter'
name: 'textScaleFactor'
variables:
textScaleFactor:
kind: 'fragment'
value: 'arguments[textScaleFactor]'
# Change made in https://github.com/flutter/flutter/pull/128522
- title: "Migrate to 'textScaler'"
date: 2023-06-09
element:
uris: [ 'painting.dart' ]
method: 'computeWidth'
inClass: 'TextPainter'
changes:
- kind: 'addParameter'
index: 4
name: 'textScaler'
style: optional_named
argumentValue:
expression: 'TextScaler.linear({% textScaleFactor %})'
requiredIf: "textScaleFactor != ''"
- kind: 'removeParameter'
name: 'textScaleFactor'
variables:
textScaleFactor:
kind: 'fragment'
value: 'arguments[textScaleFactor]'
# Change made in https://github.com/flutter/flutter/pull/128522
- title: "Migrate to 'textScaler'"
date: 2023-06-09
element:
uris: [ 'painting.dart' ]
constructor: ''
inClass: 'TextPainter'
changes:
- kind: 'addParameter'
index: 0
name: 'textScaler'
style: optional_named
argumentValue:
expression: 'TextScaler.linear({% textScaleFactor %})'
requiredIf: "textScaleFactor != ''"
- kind: 'removeParameter'
name: 'textScaleFactor'
variables:
textScaleFactor:
kind: 'fragment'
value: 'arguments[textScaleFactor]'
# Change made in https://github.com/flutter/flutter/pull/128522
- title: "Migrate to 'textScaler'"
date: 2023-06-09
element:
uris: [ 'painting.dart' ]
method: 'getTextStyle'
inClass: 'TextStyle'
changes:
- kind: 'addParameter'
index: 0
name: 'textScaler'
style: optional_named
argumentValue:
expression: 'TextScaler.linear({% textScaleFactor %})'
requiredIf: "textScaleFactor != ''"
- kind: 'removeParameter'
name: 'textScaleFactor'
variables:
textScaleFactor:
kind: 'fragment'
value: 'arguments[textScaleFactor]'
# Changes made in https://github.com/flutter/flutter/pull/121152
- title: "Rename to 'fromViewPadding'"
date: 2022-02-21
element:
uris: [ 'painting.dart' ]
constructor: 'fromWindowPadding'
inClass: 'EdgeInsets'
changes:
- kind: 'rename'
newName: 'fromViewPadding'
- title: "Rename from 'opacity' to 'a'"
date: 2024-09-10
element:
uris: [ 'painting.dart' ]
method: 'opacity'
inClass: 'Color'
changes:
- kind: 'rename'
newName: 'a'
- title: "Replace 'value' with 'toARGB32()'"
date: 2025-02-03
element:
uris: [ 'painting.dart' ]
method: 'value'
inClass: 'Color'
changes:
- kind: 'replacedBy'
newElement:
uris: [ 'painting.dart' ]
method: 'toARGB32'
inClass: 'Color'
- title: "Rename 'withOpacity'"
date: 2024-09-10
element:
uris: [ 'painting.dart' ]
method: 'withOpacity'
inClass: 'Color'
changes:
- kind: 'rename'
newName: 'withValues'
- kind: 'removeParameter'
index: 0
- kind: 'addParameter'
index: 0
name: 'alpha'
style: optional_named
argumentValue:
expression: '{% opacity %}'
requiredIf: "opacity != ''"
variables:
opacity:
kind: 'fragment'
value: 'arguments[0]'
# Before adding a new fix: read instructions at the top of this file.