Skip to content

Form sample crashes with "No Material widget found" #38881

@nbros

Description

@nbros

I tried the sample from:
https://api.flutter.dev/flutter/widgets/Form-class.html

The TextFormField in this sample triggers an error in the Flutter framework:

I/flutter (15706): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (15706): The following assertion was thrown building TextField(controller:
I/flutter (15706): TextEditingController#7d7e5(TextEditingValue(text: ┤├, selection: TextSelection(baseOffset: -1,
I/flutter (15706): extentOffset: -1, affinity: TextAffinity.downstream, isDirectional: false), composing:
I/flutter (15706): TextRange(start: -1, end: -1))), enabled: true, decoration: InputDecoration(alignLabelWithHint:
I/flutter (15706): false), dirty, state: _TextFieldState#02305):
I/flutter (15706): No Material widget found.
I/flutter (15706): TextField widgets require a Material widget ancestor.
I/flutter (15706): In material design, most widgets are conceptually "printed" on a sheet of material. In Flutter's
I/flutter (15706): material library, that material is represented by the Material widget. It is the Material widget
I/flutter (15706): that renders ink splashes, for instance. Because of this, many material library widgets require that
I/flutter (15706): there be a Material widget in the tree above them.
I/flutter (15706): To introduce a Material widget, you can either directly include one, or use a widget that contains
I/flutter (15706): Material itself, such as a Card, Dialog, Drawer, or Scaffold.
I/flutter (15706): The specific widget that could not find a Material ancestor was:
I/flutter (15706):   TextField(controller: TextEditingController#7d7e5(TextEditingValue(text: ┤├, selection:
I/flutter (15706): TextSelection(baseOffset: -1, extentOffset: -1, affinity: TextAffinity.downstream, isDirectional:
I/flutter (15706): false), composing: TextRange(start: -1, end: -1))), enabled: true, decoration:
I/flutter (15706): InputDecoration(alignLabelWithHint: false))
I/flutter (15706): The ancestors of this widget were:
I/flutter (15706):   TextFormField
I/flutter (15706):   Column(direction: vertical, mainAxisAlignment: start, crossAxisAlignment: start)
I/flutter (15706):   _FormScope
I/flutter (15706):   WillPopScope
I/flutter (15706):   Form-[LabeledGlobalKey<FormState>#55011]
I/flutter (15706):   MyStatefulWidget
I/flutter (15706):   Semantics(container: false, properties: SemanticsProperties, label: null, value: null, hint: null,
I/flutter (15706): hintOverrides: null)
I/flutter (15706):   Builder
I/flutter (15706):   RepaintBoundary-[GlobalKey#c3349]
I/flutter (15706):   IgnorePointer(ignoring: false)
I/flutter (15706):   FadeTransition(opacity: AnimationController#33a1f(⏭ 1.000; paused; for
I/flutter (15706): MaterialPageRoute<dynamic>(/))➩ProxyAnimation➩CurveTween(curve: Cubic(0.42, 0.00, 1.00, 1.00))➩1.0)
I/flutter (15706):   FractionalTranslation
I/flutter (15706):   SlideTransition(animation: AnimationController#33a1f(⏭ 1.000; paused; for
I/flutter (15706): MaterialPageRoute<dynamic>(/))➩ProxyAnimation➩CurveTween(curve: Cubic(0.40, 0.00, 0.20,
I/flutter (15706): 1.00))➩Tween<Offset>(Offset(0.0, 0.3) → Offset(0.0, 0.0))➩Offset(0.0, 0.0))
I/flutter (15706):   _FadeUpwardsPageTransition
I/flutter (15706):   AnimatedBuilder(animation: Listenable.merge([AnimationController#33a1f(⏭ 1.000; paused; for
I/flutter (15706): MaterialPageRoute<dynamic>(/))➩ProxyAnimation,
I/flutter (15706): kAlwaysDismissedAnimation➩ProxyAnimation➩ProxyAnimation]))
I/flutter (15706):   RepaintBoundary
I/flutter (15706):   _FocusMarker
I/flutter (15706):   Semantics(container: false, properties: SemanticsProperties, label: null, value: null, hint: null,
I/flutter (15706): hintOverrides: null)
I/flutter (15706):   FocusScope(node: FocusScopeNode#0bc35)
I/flutter (15706):   PageStorage
I/flutter (15706):   Offstage(offstage: false)
I/flutter (15706):   _ModalScopeStatus(active)
I/flutter (15706):   _ModalScope<dynamic>-[LabeledGlobalKey<_ModalScopeState<dynamic>>#94d9f]
I/flutter (15706):   _OverlayEntry-[LabeledGlobalKey<_OverlayEntryState>#40f24]
I/flutter (15706):   Stack(alignment: AlignmentDirectional.topStart, fit: expand, overflow: clip)
I/flutter (15706):   _Theatre
I/flutter (15706):   Overlay-[LabeledGlobalKey<OverlayState>#adc1c]
I/flutter (15706):   _FocusMarker
I/flutter (15706):   Semantics(container: false, properties: SemanticsProperties, label: null, value: null, hint: null,
I/flutter (15706): hintOverrides: null)
I/flutter (15706):   FocusScope(AUTOFOCUS, node: FocusScopeNode#903ba)
I/flutter (15706):   AbsorbPointer(absorbing: false)
I/flutter (15706):   Listener(listeners: [down, up, cancel], behavior: deferToChild)
I/flutter (15706):   Navigator-[GlobalObjectKey<NavigatorState> _WidgetsAppState#89300]
I/flutter (15706):   IconTheme(IconThemeData#2abdc(color: Color(0xdd000000)))
I/flutter (15706):   IconTheme(IconThemeData#6140b(color: MaterialColor(primary value: Color(0xff2196f3))))
I/flutter (15706):   _InheritedCupertinoTheme
I/flutter (15706):   CupertinoTheme
I/flutter (15706):   _InheritedTheme
I/flutter (15706):   Theme(ThemeData#8a43c(buttonTheme: ButtonThemeData#7ffbc(buttonColor: Color(0xffe0e0e0),
I/flutter (15706): focusColor: Color(0x1f000000), hoverColor: Color(0x0a000000), colorScheme:
I/flutter (15706): ColorScheme#23964(primary: MaterialColor(primary value: Color(0xff2196f3)), primaryVariant:
I/flutter (15706): Color(0xff1976d2), secondary: Color(0xff2196f3), secondaryVariant: Color(0xff1976d2), background:
I/flutter (15706): Color(0xff90caf9), error: Color(0xffd32f2f), onSecondary: Color(0xffffffff), onBackground:
I/flutter (15706): Color(0xffffffff)), materialTapTargetSize: MaterialTapTargetSize.padded), textTheme:
I/flutter (15706): TextTheme#0bd0d, primaryTextTheme: TextTheme#b9877(display4: TextStyle(debugLabel: whiteMountainView
I/flutter (15706): display4, inherit: true, color: Color(0xb3ffffff), family: Roboto, decoration: TextDecoration.none),
I/flutter (15706): display3: TextStyle(debugLabel: whiteMountainView display3, inherit: true, color: Color(0xb3ffffff),
I/flutter (15706): family: Roboto, decoration: TextDecoration.none), display2: TextStyle(debugLabel: whiteMountainView
I/flutter (15706): display2, inherit: true, color: Color(0xb3ffffff), family: Roboto, decoration: TextDecoration.none),
I/flutter (15706): display1: TextStyle(debugLabel: whiteMountainView display1, inherit: true, color: Color(0xb3ffffff),
I/flutter (15706): family: Roboto, decoration: TextDecoration.none), headline: TextStyle(debugLabel: whiteMountainView
I/flutter (15706): headline, inherit: true, color: Color(0xffffffff), family: Roboto, decoration: TextDecoration.none),
I/flutter (15706): title: TextStyle(debugLabel: whiteMountainView title, inherit: true, color: Color(0xffffffff),
I/flutter (15706): family: Roboto, decoration: TextDecoration.none), subhead: TextStyle(debugLabel: whiteMountainView
I/flutter (15706): subhead, inherit: true, color: Color(0xffffffff), family: Roboto, decoration: TextDecoration.none),
I/flutter (15706): body2: TextStyle(debugLabel: whiteMountainView body2, inherit: true, color: Color(0xffffffff),
I/flutter (15706): family: Roboto, decoration: TextDecoration.none), body1: TextStyle(debugLabel: whiteMountainView
I/flutter (15706): body1, inherit: true, color: Color(0xffffffff), family: Roboto, decoration: TextDecoration.none),
I/flutter (15706): caption: TextStyle(debugLabel: whiteMountainView caption, inherit: true, color: Color(0xb3ffffff),
I/flutter (15706): family: Roboto, decoration: TextDecoration.none), button: TextStyle(debugLabel: whiteMountainView
I/flutter (15706): button, inherit: true, color: Color(0xffffffff), family: Roboto, decoration: TextDecoration.none),
I/flutter (15706): subtitle): TextStyle(debugLabel: whiteMountainView subtitle, inherit: true, color:
I/flutter (15706): Color(0xffffffff), family: Roboto, decoration: TextDecoration.none), overline: TextStyle(debugLabel:
I/flutter (15706): whiteMountainView overline, inherit: true, color: Color(0xffffffff), family: Roboto, decoration:
I/flutter (15706): TextDecoration.none)), accentTextTheme: TextTheme#b9877(display4: TextStyle(debugLabel:
I/flutter (15706): whiteMountainView display4, inherit: true, color: Color(0xb3ffffff), family: Roboto, decoration:
I/flutter (15706): TextDecoration.none), display3: TextStyle(debugLabel: whiteMountainView display3, inherit: true,
I/flutter (15706): color: Color(0xb3ffffff), family: Roboto, decoration: TextDecoration.none), display2:
I/flutter (15706): TextStyle(debugLabel: whiteMountainView display2, inherit: true, color: Color(0xb3ffffff), family:
I/flutter (15706): Roboto, decoration: TextDecoration.none), display1: TextStyle(debugLabel: whiteMountainView
I/flutter (15706): display1, inherit: true, color: Color(0xb3ffffff), family: Roboto, decoration: TextDecoration.none),
I/flutter (15706): headline: TextStyle(debugLabel: whiteMountainView headline, inherit: true, color: Color(0xffffffff),
I/flutter (15706): family: Roboto, decoration: TextDecoration.none), title: TextStyle(debugLabel: whiteMountainView
I/flutter (15706): title, inherit: true, color: Color(0xffffffff), family: Roboto, decoration: TextDecoration.none),
I/flutter (15706): subhead: TextStyle(debugLabel: whiteMountainView subhead, inherit: true, color: Color(0xffffffff),
I/flutter (15706): family: Roboto, decoration: TextDecoration.none), body2: TextStyle(debugLabel: whiteMountainView
I/flutter (15706): body2, inherit: true, color: Color(0xffffffff), family: Roboto, decoration: TextDecoration.none),
I/flutter (15706): body1: TextStyle(debugLabel: whiteMountainView body1, inherit: true, color: Color(0xffffffff),
I/flutter (15706): family: Roboto, decoration: TextDecoration.none), caption: TextStyle(debugLabel: whiteMountainView
I/flutter (15706): caption, inherit: true, color: Color(0xb3ffffff), family: Roboto, decoration: TextDecoration.none),
I/flutter (15706): button: TextStyle(debugLabel: whiteMountainView button, inherit: true, color: Color(0xffffffff),
I/flutter (15706): family: Roboto, decoration: TextDecoration.none), subtitle): TextStyle(debugLabel: whiteMountainView
I/flutter (15706): subtitle, inherit: true, color: Color(0xffffffff), family: Roboto, decoration: TextDecoration.none),
I/flutter (15706): overline: TextStyle(debugLabel: whiteMountainView overline, inherit: true, color: Color(0xffffffff),
I/flutter (15706): family: Roboto, decoration: TextDecoration.none)), inputDecorationTheme: InputDecorationTheme#21974,
I/flutter (15706): iconTheme: IconThemeData#2abdc(color: Color(0xdd000000)), primaryIconTheme:
I/flutter (15706): IconThemeData#15fa8(color: Color(0xffffffff)), accentIconTheme: IconThemeData#15fa8(color:
I/flutter (15706): Color(0xffffffff)), sliderTheme: SliderThemeData#1ddfc, tabBarTheme: TabBarTheme#50f35, cardTheme:
I/flutter (15706): CardTheme#b4e63, chipTheme: ChipThemeData#1f810, materialTapTargetSize:
I/flutter (15706): MaterialTapTargetSize.padded, pageTransitionsTheme: PageTransitionsTheme#aba6e))
I/flutter (15706):   AnimatedTheme(duration: 200ms)
I/flutter (15706):   Builder
I/flutter (15706):   DefaultTextStyle(debugLabel: fallback style; consider putting your text in a Material, inherit:
I/flutter (15706): true, color: Color(0xd0ff0000), family: monospace, size: 48.0, weight: 900, decoration: double
I/flutter (15706): Color(0xffffff00) TextDecoration.underline, softWrap: wrapping at box width, overflow: clip)
I/flutter (15706):   CustomPaint
I/flutter (15706):   Banner("DEBUG", textDirection: ltr, location: topEnd, Color(0xa0b71c1c), text inherit: true, text
I/flutter (15706): color: Color(0xffffffff), text size: 10.2, text weight: 900, text height: 1.0x)
I/flutter (15706):   CheckedModeBanner("DEBUG")
I/flutter (15706):   Title(title: "Flutter Code Sample", color: MaterialColor(primary value: Color(0xff2196f3)))
I/flutter (15706):   Directionality(textDirection: ltr)
I/flutter (15706):   _LocalizationsScope-[GlobalKey#f71b8]
I/flutter (15706):   Semantics(container: false, properties: SemanticsProperties, label: null, value: null, hint: null,
I/flutter (15706): textDirection: ltr, hintOverrides: null)
I/flutter (15706):   Localizations(locale: en_US, delegates: [DefaultMaterialLocalizations.delegate(en_US),
I/flutter (15706): DefaultCupertinoLocalizations.delegate(en_US), DefaultWidgetsLocalizations.delegate(en_US)])
I/flutter (15706):   MediaQuery(MediaQueryData(size: Size(411.4, 683.4), devicePixelRatio: 2.6, textScaleFactor: 1.0,
I/flutter (15706): platformBrightness: Brightness.light, padding: EdgeInsets(0.0, 24.0, 0.0, 0.0), viewPadding:
I/flutter (15706): EdgeInsets(0.0, 24.0, 0.0, 0.0), viewInsets: EdgeInsets.zero, alwaysUse24HourFormat: false,
I/flutter (15706): accessibleNavigation: false, disableAnimations: false, invertColors: false, boldText: false))
I/flutter (15706):   DefaultFocusTraversal
I/flutter (15706):   WidgetsApp-[GlobalObjectKey _MaterialAppState#ccbfb]
I/flutter (15706):   ScrollConfiguration(behavior: _MaterialScrollBehavior)
I/flutter (15706):   MaterialApp
I/flutter (15706):   MyApp
I/flutter (15706):   [root]
I/flutter (15706):
I/flutter (15706): When the exception was thrown, this was the stack:
�[38;5;244mI/flutter (15706): #0      debugCheckHasMaterial.<anonymous closure>�[39;49m
�[38;5;244mI/flutter (15706): #1      debugCheckHasMaterial�[39;49m
�[38;5;244mI/flutter (15706): #2      _TextFieldState.build�[39;49m
�[38;5;244mI/flutter (15706): #3      StatefulElement.build�[39;49m
�[38;5;244mI/flutter (15706): #4      ComponentElement.performRebuild�[39;49m
�[38;5;244mI/flutter (15706): #5      Element.rebuild�[39;49m
�[38;5;244mI/flutter (15706): #6      StatefulElement.update�[39;49m
�[38;5;244mI/flutter (15706): #7      Element.updateChild�[39;49m
�[38;5;244mI/flutter (15706): #8      ComponentElement.performRebuild�[39;49m
�[38;5;244mI/flutter (15706): #9      Element.rebuild�[39;49m
�[38;5;244mI/flutter (15706): #10     StatefulElement.update�[39;49m
�[38;5;244mI/flutter (15706): #11     Element.updateChild�[39;49m
�[38;5;244mI/flutter (15706): #12     RenderObjectElement.updateChildren�[39;49m
�[38;5;244mI/flutter (15706): #13     MultiChildRenderObjectElement.update�[39;49m
�[38;5;244mI/flutter (15706): #14     Element.updateChild�[39;49m
�[38;5;244mI/flutter (15706): #15     ComponentElement.performRebuild�[39;49m
�[38;5;244mI/flutter (15706): #16     Element.rebuild�[39;49m
�[38;5;244mI/flutter (15706): #17     ProxyElement.update�[39;49m
�[38;5;244mI/flutter (15706): #18     Element.updateChild�[39;49m
�[38;5;244mI/flutter (15706): #19     ComponentElement.performRebuild�[39;49m
�[38;5;244mI/flutter (15706): #20     Element.rebuild�[39;49m
�[38;5;244mI/flutter (15706): #21     StatefulElement.update�[39;49m
�[38;5;244mI/flutter (15706): #22     Element.updateChild�[39;49m
�[38;5;244mI/flutter (15706): #23     ComponentElement.performRebuild�[39;49m
�[38;5;244mI/flutter (15706): #24     Element.rebuild�[39;49m
�[38;5;244mI/flutter (15706): #25     StatefulElement.update�[39;49m
�[38;5;244mI/flutter (15706): #26     Element.updateChild�[39;49m
Reloaded 0 of 455 libraries in 277ms.
�[38;5;244mI/flutter (15706): #27     ComponentElement.performRebuild�[39;49m
�[38;5;244mI/flutter (15706): #28     Element.rebuild�[39;49m
�[38;5;244mI/flutter (15706): #29     StatefulElement.update�[39;49m
�[38;5;244mI/flutter (15706): #30     Element.updateChild�[39;49m
�[38;5;244mI/flutter (15706): #31     SingleChildRenderObjectElement.update�[39;49m
�[38;5;244mI/flutter (15706): #32     Element.updateChild�[39;49m
�[38;5;244mI/flutter (15706): #33     ComponentElement.performRebuild�[39;49m
�[38;5;244mI/flutter (15706): #34     Element.rebuild�[39;49m
�[38;5;244mI/flutter (15706): #35     StatelessElement.update�[39;49m
�[38;5;244mI/flutter (15706): #36     Element.updateChild�[39;49m
�[38;5;244mI/flutter (15706): #37     SingleChildRenderObjectElement.update�[39;49m
�[38;5;244mI/flutter (15706): #38     Element.updateChild�[39;49m
�[38;5;244mI/flutter (15706): #39     SingleChildRenderObjectElement.update�[39;49m
�[38;5;244mI/flutter (15706): #40     Element.updateChild�[39;49m
�[38;5;244mI/flutter (15706): #41     SingleChildRenderObjectElement.update�[39;49m
�[38;5;244mI/flutter (15706): #42     Element.updateChild�[39;49m
�[38;5;244mI/flutter (15706): #43     SingleChildRenderObjectElement.update�[39;49m
�[38;5;244mI/flutter (15706): #44     Element.updateChild�[39;49m
�[38;5;244mI/flutter (15706): #45     ComponentElement.performRebuild�[39;49m
�[38;5;244mI/flutter (15706): #46     Element.rebuild�[39;49m
�[38;5;244mI/flutter (15706): #47     StatefulElement.update�[39;49m
�[38;5;244mI/flutter (15706): #48     Element.updateChild�[39;49m
�[38;5;244mI/flutter (15706): #49     ComponentElement.performRebuild�[39;49m
�[38;5;244mI/flutter (15706): #50     Element.rebuild�[39;49m
�[38;5;244mI/flutter (15706): #51     StatelessElement.update�[39;49m
�[38;5;244mI/flutter (15706): #52     Element.updateChild�[39;49m
�[38;5;244mI/flutter (15706): #53     ComponentElement.performRebuild�[39;49m
�[38;5;244mI/flutter (15706): #54     Element.rebuild�[39;49m
�[38;5;244mI/flutter (15706): #55     StatefulElement.update�[39;49m
�[38;5;244mI/flutter (15706): #56     Element.updateChild�[39;49m
�[38;5;244mI/flutter (15706): #57     SingleChildRenderObjectElement.update�[39;49m
�[38;5;244mI/flutter (15706): #58     Element.updateChild�[39;49m
�[38;5;244mI/flutter (15706): #59     ComponentElement.performRebuild�[39;49m
�[38;5;244mI/flutter (15706): #60     Element.rebuild�[39;49m
�[38;5;244mI/flutter (15706): #61     ProxyElement.update�[39;49m
�[38;5;244mI/flutter (15706): #62     _InheritedNotifierElement.update�[39;49m
�[38;5;244mI/flutter (15706): #63     Element.updateChild�[39;49m
�[38;5;244mI/flutter (15706): #64     SingleChildRenderObjectElement.update�[39;49m
�[38;5;244mI/flutter (15706): #65     Element.updateChild�[39;49m
�[38;5;244mI/flutter (15706): #66     ComponentElement.performRebuild�[39;49m
�[38;5;244mI/flutter (15706): #67     Element.rebuild�[39;49m
�[38;5;244mI/flutter (15706): #68     StatefulElement.update�[39;49m
�[38;5;244mI/flutter (15706): #69     Element.updateChild�[39;49m
�[38;5;244mI/flutter (15706): #70     ComponentElement.performRebuild�[39;49m
�[38;5;244mI/flutter (15706): #71     Element.rebuild�[39;49m
�[38;5;244mI/flutter (15706): #72     StatelessElement.update�[39;49m
�[38;5;244mI/flutter (15706): #73     Element.updateChild�[39;49m
�[38;5;244mI/flutter (15706): #74     SingleChildRenderObjectElement.update�[39;49m
�[38;5;244mI/flutter (15706): #75     Element.updateChild�[39;49m
�[38;5;244mI/flutter (15706): #76     ComponentElement.performRebuild�[39;49m
�[38;5;244mI/flutter (15706): #77     Element.rebuild�[39;49m
�[38;5;244mI/flutter (15706): #78     ProxyElement.update�[39;49m
�[38;5;244mI/flutter (15706): #79     Element.updateChild�[39;49m
�[38;5;244mI/flutter (15706): #80     ComponentElement.performRebuild�[39;49m
�[38;5;244mI/flutter (15706): #81     Element.rebuild�[39;49m
�[38;5;244mI/flutter (15706): #82     BuildOwner.buildScope�[39;49m
�[38;5;244mI/flutter (15706): #83     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame�[39;49m
�[38;5;244mI/flutter (15706): #84     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback�[39;49m
�[38;5;244mI/flutter (15706): #85     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback�[39;49m
�[38;5;244mI/flutter (15706): #86     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame�[39;49m
�[38;5;244mI/flutter (15706): #87     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.scheduleWarmUpFrame.<anonymous closure>�[39;49m
�[38;5;244mI/flutter (15706): #89     _Timer._runTimers  (dart:isolate-patch/timer_impl.dart:382:19)�[39;49m
�[38;5;244mI/flutter (15706): #90     _Timer._handleMessage  (dart:isolate-patch/timer_impl.dart:416:5)�[39;49m
�[38;5;244mI/flutter (15706): #91     _RawReceivePortImpl._handleMessage  (dart:isolate-patch/isolate_patch.dart:172:12)�[39;49m
I/flutter (15706): (elided one frame from package dart:async-patch)
I/flutter (15706): ════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter (15706): Another exception was thrown: A RenderFlex overflowed by 99397 pixels on the bottom.

Metadata

Metadata

Assignees

Labels

d: api docsIssues with https://api.flutter.dev/f: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions