Changing RenderEditable.textAlign doesn't break hot reload anymore (#44605)

This commit is contained in:
Mouad Debbar
2019-11-11 14:35:15 -08:00
committed by GitHub
parent 23d1ae0ff7
commit 9307a83f7c
2 changed files with 25 additions and 1 deletions

View File

@@ -637,7 +637,7 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
if (_textPainter.textAlign == value)
return;
_textPainter.textAlign = value;
markNeedsPaint();
markNeedsTextLayout();
}
/// The directionality of the text.

View File

@@ -179,6 +179,30 @@ void main() {
expect(editable, paintsExactlyCountTimes(#drawRRect, 0));
}, skip: isBrowser);
test('Can change textAlign', () {
final TextSelectionDelegate delegate = FakeEditableTextState();
final RenderEditable editable = RenderEditable(
textAlign: TextAlign.start,
textDirection: TextDirection.ltr,
offset: ViewportOffset.zero(),
textSelectionDelegate: delegate,
text: const TextSpan(text: 'test'),
startHandleLayerLink: LayerLink(),
endHandleLayerLink: LayerLink(),
);
layout(editable);
editable.layout(BoxConstraints.loose(const Size(100, 100)));
expect(editable.textAlign, TextAlign.start);
expect(editable.debugNeedsLayout, isFalse);
editable.textAlign = TextAlign.center;
expect(editable.textAlign, TextAlign.center);
expect(editable.debugNeedsLayout, isTrue);
});
test('Cursor with ideographic script', () {
final TextSelectionDelegate delegate = FakeEditableTextState();
final ValueNotifier<bool> showCursor = ValueNotifier<bool>(true);