Adds dart fixes for Color opacity functions (#154953)
fixes https://github.com/flutter/flutter/issues/154572
This commit is contained in:
parent
1c3b501f53
commit
746d8af006
@ -117,4 +117,36 @@ transforms:
|
|||||||
- kind: 'rename'
|
- kind: 'rename'
|
||||||
newName: 'fromViewPadding'
|
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: "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.
|
# Before adding a new fix: read instructions at the top of this file.
|
||||||
|
@ -18,4 +18,8 @@ void main() {
|
|||||||
|
|
||||||
TextPainter.computeWidth(textScaleFactor: textScaleFactor);
|
TextPainter.computeWidth(textScaleFactor: textScaleFactor);
|
||||||
TextPainter.computeMaxIntrinsicWidth(textScaleFactor: textScaleFactor);
|
TextPainter.computeMaxIntrinsicWidth(textScaleFactor: textScaleFactor);
|
||||||
|
|
||||||
|
Color color = Color.from(alpha: 1, red: 0, green: 1, blue: 0);
|
||||||
|
print(color.opacity);
|
||||||
|
color = color.withOpacity(0.55);
|
||||||
}
|
}
|
||||||
|
@ -18,4 +18,8 @@ void main() {
|
|||||||
|
|
||||||
TextPainter.computeWidth(textScaler: TextScaler.linear(textScaleFactor));
|
TextPainter.computeWidth(textScaler: TextScaler.linear(textScaleFactor));
|
||||||
TextPainter.computeMaxIntrinsicWidth(textScaler: TextScaler.linear(textScaleFactor));
|
TextPainter.computeMaxIntrinsicWidth(textScaler: TextScaler.linear(textScaleFactor));
|
||||||
|
|
||||||
|
Color color = Color.from(alpha: 1, red: 0, green: 1, blue: 0);
|
||||||
|
print(color.a);
|
||||||
|
color = color.withValues(alpha: 0.55);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user