Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextStyle support different inherit lerp #103896

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/flutter/lib/src/painting/text_style.dart
Expand Up @@ -1068,7 +1068,6 @@ class TextStyle with Diagnosticable {
/// based on the [backgroundColor] property).
static TextStyle? lerp(TextStyle? a, TextStyle? b, double t) {
assert(t != null);
assert(a == null || b == null || a.inherit == b.inherit);
if (a == null && b == null) {
return null;
}
Expand Down
9 changes: 9 additions & 0 deletions packages/flutter/test/painting/text_style_test.dart
Expand Up @@ -89,6 +89,15 @@ class _DartUiTextStyleToStringMatcher extends Matcher {
Matcher matchesToStringOf(TextStyle textStyle) => _DartUiTextStyleToStringMatcher(textStyle);

void main() {
// Regression test for https://github.com/flutter/flutter/issues/103864
test('TextStyle support different inherit lerp', () {
const TextStyle inheritStyle = TextStyle();
const TextStyle nonInheritStyle = TextStyle(inherit: false);

expect(TextStyle.lerp(inheritStyle, nonInheritStyle, 0.51)!.inherit, false);
expect(TextStyle.lerp(nonInheritStyle, inheritStyle, 0.51)!.inherit, true);
});

test('TextStyle control test', () {
expect(
const TextStyle(inherit: false).toString(),
Expand Down