-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
Description
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
Use case
I would like to make my icon's color change when background color changes. I realized that it can achieve by BlendMode.different from my own SO question.
I can do this in my local test with below code:
final style = TextStyle(
foreground: Paint()
..blendMode = BlendMode.difference
..color = Colors.white,
// other properties
);
TextSpan(text: String.fromCharCode(icon.codePoint), style: style);Screen.Recording.2023-12-02.at.11.05.01.AM.mov
Proposal
Expose the foreground property of TextStyle in Icon so that we can use it!
class Icon extends StatelessWidget {
const Icon(
this.icon, {
this.foreground,
// other properties
})
Widget build(context) {
// ...
TextStyle(
forground: forground,
// ...
)
}
}Also tested on IconButton:
Screen.Recording.2023-12-02.at.11.23.02.AM.mov
Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team