Flutter: No Material widget found. TextField widgets require a Material widget ancestor
A Material-design widget (TextField, ListTile, InkWell, Chip) was placed outside a Scaffold, Material or Card, so it has no Material ancestor to draw ink effects on.
No Material widget foundTextField widgets require a Material widget ancestorNo Material widget found. InkWell widgets require a Material widget ancestorListTile widgets require a Material widget ancestorMaterial widget ancestor required Meaning
The usual cause is calling runApp with a widget that is not wrapped in MaterialApp/Scaffold, or building a custom route/overlay with no Material in its tree. Wrap the subtree in Material(...) or Scaffold(...).
Common causes
- runApp(MyWidget()) without MaterialApp
- Dialog/Overlay content outside the app's Material
- Custom page using Container as the root
- TextField placed in a plain Container route
- Widget test pumping a widget without MaterialApp
⚡ Quick fix
- Wrap the app in
MaterialApp(home: Scaffold(...)) - Wrap the subtree in
Material(type: MaterialType.transparency) - In tests use
MaterialApp(home: Scaffold(body: widget))
Detailed fix by platform
Flutter
- Test fix:
await tester.pumpWidget(MaterialApp(home: Scaffold(body: MyWidget())));
How to diagnose
- Root — MaterialApp present?
- Subtree — Inside Scaffold/Material?
- Test — Pump wrapped?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- A RenderFlex overflowed Flutter: A RenderFlex overflowed by x pixels on the right/bottom
- Android license status unknown / licenses not accepted flutter doctor: Android license status unknown. Run `flutter doctor --android-licenses` to accept the SDK licenses
- BoxConstraints forces an infinite width Flutter: BoxConstraints forces an infinite width. These invalid constraints were provided to RenderStack's layout() function (TextField in a Row)
Most viewed in Flutter / Dart
- setState() called after dispose() Flutter: setState() called after dispose(): _MyState#1a2b3 (lifecycle state: defunct, not mounted)
- Null check operator used on a null value Dart/Flutter: Null check operator used on a null value
- Unsupported class file major version (Gradle / Java) Android Gradle: Execution failed — Unsupported class file major version 65 / Android Gradle plugin requires Java 17 to run
Other ways to find it
Where this error sits
Origin: On your device. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 4 Nov 2026