TextField inside CupertinoAlertDialog
230
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
),
),
],
),
),
);
},
);
Author by
Hoangdz
Updated on November 27, 2022Comments
-
Hoangdz over 1 year
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 codeshowCupertinoDialog( context: context, builder: (context) { return CupertinoAlertDialog( content: Scaffold( body: TextField( controller: cubit.textEditingController, ), ), ); } );
I have tried to replace
Material
withCard
,Scaffold
andContainer
but it didn't work as well.Please help me
-
Jahidul Islam almost 3 yearsplease add your code, not image
-
Hoangdz almost 3 yearsYes, I added it
-
Swaminathan V almost 3 yearsYou are trying this in iOS or Android ?
-
Hoangdz almost 3 yearsI'm trying this in Android
-
Hoangdz almost 3 yearsSorry Jahidul Islam, I don't get your point about passing context where I call the function. Isn't it context : context in my code?
-
Nassar almost 3 yearsCould you provide the full class code please to be able to help you?
-
-
Rohit Sainik almost 3 yearsplease mark the solution as correct if it works for you @Hoangdz