diff --git a/packages/flutter/lib/src/material/text_field.dart b/packages/flutter/lib/src/material/text_field.dart index 7e7dab3092..15abc884d0 100644 --- a/packages/flutter/lib/src/material/text_field.dart +++ b/packages/flutter/lib/src/material/text_field.dart @@ -364,7 +364,8 @@ class _TextFieldState extends State with AutomaticKeepAliveClientMixi InteractiveInkFeature _createInkFeature(TapDownDetails details) { final MaterialInkController inkController = Material.of(context); - final RenderBox referenceBox = InputDecorator.containerOf(_editableTextKey.currentContext); + final BuildContext editableContext = _editableTextKey.currentContext; + final RenderBox referenceBox = InputDecorator.containerOf(editableContext) ?? editableContext.findRenderObject(); final Offset position = referenceBox.globalToLocal(details.globalPosition); final Color color = Theme.of(context).splashColor; diff --git a/packages/flutter/test/material/text_field_focus_test.dart b/packages/flutter/test/material/text_field_focus_test.dart index 70b7d59a92..8d4ee76375 100644 --- a/packages/flutter/test/material/text_field_focus_test.dart +++ b/packages/flutter/test/material/text_field_focus_test.dart @@ -206,4 +206,25 @@ void main() { await tester.pump(); // in case the AutomaticKeepAlive widget thinks it needs a cleanup frame expect(find.byType(TextField), findsOneWidget); }); + + testWidgets('TextField with decoration:null', (WidgetTester tester) async { + // Regression test for https://github.com/flutter/flutter/issues/16880 + + await tester.pumpWidget( + new MaterialApp( + home: const Material( + child: const Center( + child: const TextField( + decoration: null + ), + ), + ), + ), + ); + + expect(tester.testTextInput.isVisible, isFalse); + await tester.tap(find.byType(TextField)); + await tester.idle(); + expect(tester.testTextInput.isVisible, isTrue); + }); }