Skip to content

SignInWidget no longer renders using new standalone material_ui: "No Material widget found", "No MaterialLocalizations found" #5695

Open

Description

@jamesncl

Describe the bug

When using Flutter 3.47's new material_ui package structure, SignInWidget from serverpod_auth_idp_flutter no longer renders, with the following error:

══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following assertion was thrown building TextField(controller:
TextEditingController#81f05(TextEditingValue(text: ┤├, selection: TextSelection.invalid, composing:
TextRange(start: -1, end: -1))), enabled: true, decoration: InputDecoration(labelText: "Email",
contentPadding: EdgeInsets(12.0, 14.0, 12.0, 14.0), border: OutlineInputBorder()), keyboardType:
TextInputType(name: TextInputType.emailAddress, signed: null, decimal: null), dirty, dependencies:
[MediaQuery, UnmanagedRestorationScope], state: _TextFieldState#f7467):
No Material widget found.
TextField widgets require a Material widget ancestor within the closest LookupBoundary.
In Material Design, most widgets are conceptually "printed" on a sheet of material. In Flutter's
material library, that material is represented by the Material widget. It is the Material widget
that renders ink splashes, for instance. Because of this, many material library widgets require that
there be a Material widget in the tree above them.
To introduce a Material widget, you can either directly include one, or use a widget that contains
Material itself, such as a Card, Dialog, Drawer, or Scaffold.
The specific widget that could not find a Material ancestor was:
TextField
The ancestors of this widget were:
...
CustomTextField
EmailTextField
Column
Expanded
Column
...

The relevant error-causing widget was:
TextField
TextField:file:///Users/me/.pub-cache/hosted/pub.dev/serverpod_auth_idp_flutter-3.4.13/lib/src/common/widgets/text_field.dart:44:12

You can work around this by importing package:flutter/material.dart instead of package:material_ui/material_ui.dart in the dart file where SignInWidget is used. However you then encounter a futher error:

No MaterialLocalizations found.
TextField widgets require MaterialLocalizations to be provided by a Localizations widget ancestor.

You can work around this by using the temporary MaterialUiCompatibilityBridge workaround documented in material_ui, however this is already deprecated and will be removed at some point in the future:

MaterialApp(
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: const Color(0xFF6750A4)),
      ),
      builder: (BuildContext context, Widget? child) {
        return MaterialUiCompatibilityBridge(child: child!);
      },
      home: const HomeScreen(),
    )

To reproduce

Expected behavior

I would expect to be able to use SignInWidget with the latest version of flutter without resorting to workarounds

Library version

3.4.13

Platform information

flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.47.3, on macOS 26.6 25G72 darwin-arm64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 36.1.0)
[✓] Xcode - develop for iOS and macOS (Xcode 26.6)
[✓] Chrome - develop for the web
[✓] Connected device (2 available)
! Error: Browsing on the local area network for Test user’s iPhone. Ensure the device is unlocked and attached with a cable or
associated with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources

• No issues found!

Additional context

Image

How experienced are you with this library?

Intermediate - Familiar with the basics or have used it in a few projects

Are you interested in working on a PR for this?

  • I want to work on this

Activity

  1. added
    bug
    on Sep 10, 2026
  2. marcelomendoncasoares commented on Sep 10, 2026

    @marcelomendoncasoares
    Collaborator

    Hi @jamesncl! Unfortunately this can't be fixed on 3.4.x because material_ui is only available from Dart >=3.12 and 3.4.x still supports Dart >=3.10. This is fixed, however, on the latest 4.0.0 pre-release (currently RC.2), so you won't need the workaround after 4.0.0 is officially released next week! If you're starting a project right now, it is worth starting from the RC.2 since the official release is only a couple days away.

  3. moved this from Inbox 📫 to Done 🚀 in Serverpod Frameworkson Sep 10, 2026
  4. vchrisb commented on Sep 29, 2026

    @vchrisb
    Contributor

    @marcelomendoncasoares in serverpod 4.0.3 all widgets still use import 'package:flutter/material.dart'; and hence not the standalone material_ui package.
    Do I maybe misread your comment?

  5. marcelomendoncasoares commented on Sep 29, 2026

    @marcelomendoncasoares
    Collaborator

    Do I maybe misread your comment?

    @vchrisb Sorry, it was my confusion closing the issue. What was fixed then was the possibility of using material_ui on the template because we bumped Dart to ^3.12 on Serverpod 4.0.0-rc.2 precisely to allow this. However, the change to the widgets was still to be done, and ended up not landing. I'll reopen the issue for us to find a non-breaking way of fixing it.

  6. added
    area: authentication
    on Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: authenticationbug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions