Add textHeightBehavior and textWidthBasis to AnimatedDefaultTextStyle (#50748)

diff --git a/packages/flutter/lib/src/widgets/implicit_animations.dart b/packages/flutter/lib/src/widgets/implicit_animations.dart
index 562f686..99757be 100644
--- a/packages/flutter/lib/src/widgets/implicit_animations.dart
+++ b/packages/flutter/lib/src/widgets/implicit_animations.dart
@@ -2,8 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+import 'dart:ui' as ui show TextHeightBehavior;
+
 import 'package:flutter/animation.dart';
 import 'package:flutter/foundation.dart';
+import 'package:flutter/painting.dart';
 import 'package:flutter/rendering.dart';
 import 'package:vector_math/vector_math_64.dart';
 
@@ -1502,8 +1505,9 @@
 /// without explicit style) over a given duration whenever the given style
 /// changes.
 ///
-/// The [textAlign], [softWrap], [textOverflow], and [maxLines] properties are
-/// not animated and take effect immediately when changed.
+/// The [textAlign], [softWrap], [textOverflow], [maxLines], [textWidthBasis]
+/// and [textHeightBehavior] properties are not animated and take effect
+/// immediately when changed.
 ///
 /// Here's an illustration of what using this widget looks like, using a [curve]
 /// of [Curves.elasticInOut].
@@ -1529,6 +1533,8 @@
     this.softWrap = true,
     this.overflow = TextOverflow.clip,
     this.maxLines,
+    this.textWidthBasis = TextWidthBasis.parent,
+    this.textHeightBehavior,
     Curve curve = Curves.linear,
     @required Duration duration,
     VoidCallback onEnd,
@@ -1537,6 +1543,7 @@
        assert(softWrap != null),
        assert(overflow != null),
        assert(maxLines == null || maxLines > 0),
+       assert(textWidthBasis != null),
        super(key: key, curve: curve, duration: duration, onEnd: onEnd);
 
   /// The widget below this widget in the tree.
@@ -1575,6 +1582,14 @@
   /// See [DefaultTextStyle.maxLines] for more details.
   final int maxLines;
 
+  /// The strategy to use when calculating the width of the Text.
+  ///
+  /// See [TextWidthBasis] for possible values and their implications.
+  final TextWidthBasis textWidthBasis;
+
+  /// {@macro flutter.dart:ui.textHeightBehavior}
+  final ui.TextHeightBehavior textHeightBehavior;
+
   @override
   _AnimatedDefaultTextStyleState createState() => _AnimatedDefaultTextStyleState();
 
@@ -1586,6 +1601,8 @@
     properties.add(FlagProperty('softWrap', value: softWrap, ifTrue: 'wrapping at box width', ifFalse: 'no wrapping except at line break characters', showName: true));
     properties.add(EnumProperty<TextOverflow>('overflow', overflow, defaultValue: null));
     properties.add(IntProperty('maxLines', maxLines, defaultValue: null));
+    properties.add(EnumProperty<TextWidthBasis>('textWidthBasis', textWidthBasis, defaultValue: TextWidthBasis.parent));
+    properties.add(DiagnosticsProperty<ui.TextHeightBehavior>('textHeightBehavior', textHeightBehavior, defaultValue: null));
   }
 }
 
@@ -1605,6 +1622,8 @@
       softWrap: widget.softWrap,
       overflow: widget.overflow,
       maxLines: widget.maxLines,
+      textWidthBasis: widget.textWidthBasis,
+      textHeightBehavior: widget.textHeightBehavior,
       child: widget.child,
     );
   }
diff --git a/packages/flutter/test/widgets/default_text_style_test.dart b/packages/flutter/test/widgets/default_text_style_test.dart
index 7d90a4b..9f1536a 100644
--- a/packages/flutter/test/widgets/default_text_style_test.dart
+++ b/packages/flutter/test/widgets/default_text_style_test.dart
@@ -2,8 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+import 'dart:ui' as ui show TextHeightBehavior;
+
 import 'package:flutter_test/flutter_test.dart';
 import 'package:flutter/widgets.dart';
+import 'package:flutter/painting.dart';
 
 void main() {
   testWidgets('DefaultTextStyle changes propagate to Text', (WidgetTester tester) async {
@@ -67,6 +70,8 @@
     expect(text1.softWrap, isTrue);
     expect(text1.overflow, TextOverflow.clip);
     expect(text1.maxLines, isNull);
+    expect(text1.textWidthBasis, TextWidthBasis.parent);
+    expect(text1.textHeightBehavior, isNull);
 
     await tester.pumpWidget(const AnimatedDefaultTextStyle(
       style: s2,
@@ -74,6 +79,8 @@
       softWrap: false,
       overflow: TextOverflow.fade,
       maxLines: 3,
+      textWidthBasis: TextWidthBasis.longestLine,
+      textHeightBehavior: ui.TextHeightBehavior(applyHeightToFirstAscent: false),
       child: textWidget,
       duration: Duration(milliseconds: 1000),
     ));
@@ -85,6 +92,8 @@
     expect(text2.softWrap, false);
     expect(text2.overflow, TextOverflow.fade);
     expect(text2.maxLines, 3);
+    expect(text2.textWidthBasis, TextWidthBasis.longestLine);
+    expect(text2.textHeightBehavior, const ui.TextHeightBehavior(applyHeightToFirstAscent: false));
 
     await tester.pump(const Duration(milliseconds: 1000));
 
@@ -95,5 +104,7 @@
     expect(text3.softWrap, false);
     expect(text3.overflow, TextOverflow.fade);
     expect(text3.maxLines, 3);
+    expect(text2.textWidthBasis, TextWidthBasis.longestLine);
+    expect(text2.textHeightBehavior, const ui.TextHeightBehavior(applyHeightToFirstAscent: false));
   });
 }