Unverified Commit 64765d86 authored by YeungKC's avatar YeungKC Committed by GitHub

done (#82286)

parent 79709605
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment