done (#82286)
This commit is contained in:
@@ -3194,7 +3194,7 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
|
||||
@override
|
||||
double computeMaxIntrinsicWidth(double height) {
|
||||
_layoutText(maxWidth: double.infinity);
|
||||
return _textPainter.maxIntrinsicWidth + cursorWidth;
|
||||
return _textPainter.maxIntrinsicWidth + _caretMargin;
|
||||
}
|
||||
|
||||
/// An estimate of the height of a line in the text. See [TextPainter.preferredLineHeight].
|
||||
|
||||
@@ -6611,6 +6611,7 @@ void main() {
|
||||
// the cursor regardless of alignment.
|
||||
stepWidth = null;
|
||||
const double WIDTH_OF_CHAR = 16.0;
|
||||
const double CARET_GAP = 1.0;
|
||||
await tester.pumpWidget(buildFrame(
|
||||
stepWidth: stepWidth,
|
||||
cursorWidth: 18.0,
|
||||
@@ -6618,7 +6619,7 @@ void main() {
|
||||
));
|
||||
await tester.enterText(find.byType(TextField), text);
|
||||
await tester.pumpAndSettle();
|
||||
expect(tester.getSize(find.byType(TextField)).width, WIDTH_OF_CHAR * text.length + 18.0);
|
||||
expect(tester.getSize(find.byType(TextField)).width, WIDTH_OF_CHAR * text.length + 18.0 + CARET_GAP);
|
||||
await tester.pumpWidget(buildFrame(
|
||||
stepWidth: stepWidth,
|
||||
cursorWidth: 18.0,
|
||||
@@ -6626,7 +6627,7 @@ void main() {
|
||||
));
|
||||
await tester.enterText(find.byType(TextField), text);
|
||||
await tester.pumpAndSettle();
|
||||
expect(tester.getSize(find.byType(TextField)).width, WIDTH_OF_CHAR * text.length + 18.0);
|
||||
expect(tester.getSize(find.byType(TextField)).width, WIDTH_OF_CHAR * text.length + 18.0 + CARET_GAP);
|
||||
});
|
||||
|
||||
testWidgets('TextField style is merged with theme', (WidgetTester tester) async {
|
||||
|
||||
@@ -85,7 +85,7 @@ void main() {
|
||||
);
|
||||
expect(editable.getMinIntrinsicWidth(double.infinity), 50.0);
|
||||
// The width includes the width of the cursor (1.0).
|
||||
expect(editable.getMaxIntrinsicWidth(double.infinity), 51.0);
|
||||
expect(editable.getMaxIntrinsicWidth(double.infinity), 52.0);
|
||||
expect(editable.getMinIntrinsicHeight(double.infinity), 10.0);
|
||||
expect(editable.getMaxIntrinsicHeight(double.infinity), 10.0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user