Reputation: 196
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
Upvotes: 1
Views: 680
Reputation: 12575
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
),
),
],
),
),
);
},
);
Upvotes: 1