Skip to content

Crashes on Flutter 3.47.0 #237

Description

@jonmountjoy

Pinput doesn't work on Flutter 3.47.0, if you use the new material_ui/cupertino_ui packages.

In particular, it crashes with a "No Material widget found":

#0      debugCheckHasMaterial.<anonymous closure> (package:flutter/src/material/debug.dart:40:7)
#1      debugCheckHasMaterial (package:flutter/src/material/debug.dart:67:4)
#2      _PinputState.build (package:pinput/src/pinput_state.dart:289:12)

The problem is this line in pinput_state.dart

assert(debugCheckHasMaterial(context));

I believe that the problem is that debugCheckHasMaterial looks for a Material class in the ancestors, but the Material class in material_ui is a different class.

To Reproduce

  1. Install Flutter 3.47.0
  2. Go the example folder of pinput
  3. Modify the pubspec.yaml to force the latest version of flutter:
  sdk: ^3.13.0
  flutter: '>=3.46.0'
  1. Run the upgrader dart fix --apply --code=migrate_design_widgets
  2. Run the example app - it will work.
  3. Modify the example app, and replace import 'package:flutter/material.dart'; with import 'package:material_ui/material_ui.dart';
  4. The app will no longer work.

To avoid

I can do something nasty to avoid the problem - which is to wrap the Pinput in the "old" Material class:

import 'package:material_ui/material_ui.dart';
import 'package:flutter/material.dart' as hack;

Widget myPut() {
  return hack.Material(child: Pinput(....));
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions