No Material widget found

No Material widget found. TextField widgets require a Material widget ancestor.

Quick Answer

A Material Design widget is used without a Material ancestor like Scaffold or Material.

Why This Happens

In Flutter, many Material Design widgets (TextField, ListTile, etc.) require a Material widget ancestor for ink effects and theming. If you use these widgets outside of a Scaffold or without wrapping them in a Material widget, this error is thrown.

The Problem

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: TextField(), // No Scaffold or Material ancestor
    );
  }
}

The Fix

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Padding(
          padding: EdgeInsets.all(16),
          child: TextField(),
        ),
      ),
    );
  }
}

Step-by-Step Fix

  1. 1

    Identify the error

    Look at the error message: No Material widget found. This means a Material Design widget lacks a required ancestor.

  2. 2

    Find the cause

    Check if the widget is placed outside of a Scaffold or Material widget in the widget tree.

  3. 3

    Apply the fix

    Wrap the widget in a Scaffold or a Material widget to provide the required Material ancestor.

Bugsly catches this automatically

Bugsly's AI analyzes this error pattern in real-time, explains what went wrong in plain English, and suggests the exact fix — before your users even report it.

Try Bugsly free