Unverified Commit e3426679 authored by derdilla's avatar derdilla Committed by GitHub

fix Ink not updating on TextField newline (#140700)

Fixes a layout bug when using an EditableText and something containing an Ink widget.
parent ab30122f
......@@ -37,6 +37,7 @@ import 'scroll_position.dart';
import 'scrollable.dart';
import 'scrollable_helpers.dart';
import 'shortcuts.dart';
import 'size_changed_layout_notifier.dart';
import 'spell_check.dart';
import 'tap_region.dart';
import 'text.dart';
......@@ -4951,6 +4952,7 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
_openInputConnection();
_updateSelectionRects(force: true);
},
child: SizeChangedLayoutNotifier(
child: _Editable(
key: _editableKey,
startHandleLayerLink: _startHandleLayerLink,
......@@ -4996,6 +4998,7 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
),
),
),
),
);
},
),
......
......@@ -16731,6 +16731,34 @@ void main() {
final EditableTextState state = tester.state<EditableTextState>(find.byType(EditableText));
expect(state.renderEditable.cursorColor, cursorColor.withOpacity(opacity));
});
testWidgets('should notify on size change', (WidgetTester tester) async {
int notifyCount = 0;
await tester.pumpWidget(MaterialApp(
home: Scaffold(
body: NotificationListener<SizeChangedLayoutNotification>(
onNotification: (SizeChangedLayoutNotification notification) {
notifyCount += 1;
return false;
},
child: EditableText(
backgroundCursorColor: Colors.grey,
cursorColor: Colors.grey,
controller: controller,
focusNode: focusNode,
maxLines: 3,
minLines: 1,
style: textStyle,
),
),
),
));
expect(notifyCount, equals(0));
await tester.enterText(find.byType(EditableText), '\n');
await tester.pumpAndSettle();
expect(notifyCount, equals(1));
});
}
class UnsettableController extends TextEditingController {
......
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