1

I'm making a dialog, which has a text field to get input from user, by using CupertinoAlertDialog. However, it keeps saying No Mater Widget Found. I searched and tried with some solution from the Internet but it didn't work. Here is my code

showCupertinoDialog(
   context: context,
   builder: (context) {
    return CupertinoAlertDialog(
     content: Scaffold(
     body: TextField(
     controller: cubit.textEditingController,
     ),
    ),
   );
 }
);

I have tried to replace Material with Card, Scaffold and Container but it didn't work as well.

Please help me

Hoangdz
  • 152
  • 1
  • 14

1 Answers1

1

Please Wrap your cupertinoAlertDialog inside ShowDialog as it has Material Widget property.

showDialog<bool>(
              context: context,
              builder: (context) {
                return CupertinoAlertDialog(
                  title: Text('Cupertino dialog'),
                  content: Card(
                    elevation: 10.0,
                    child: Column(
                      children: <Widget>[
                        TextField(
                          decoration: InputDecoration(
                              labelText: "Name",
                              filled: true,
                              fillColor: Colors.grey
                          ),
                        ),
                      ],
                    ),
                  ),
                );
              },
            );
Rohit Sainik
  • 452
  • 6
  • 15
Jahidul Islam
  • 11,435
  • 3
  • 17
  • 38