Future<void> _showDialog(BuildContext context) async {
return showDialog<void>(
context: context,
builder: (BuildContext context) {
return Center(
child: Container(
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(12)),
margin: const EdgeInsets.all(16),
padding: const EdgeInsets.all(12),
child: ListView.builder(
itemCount: codeCountryList.length,
shrinkWrap: true,
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
_indexFlag.value = index;
Navigator.pop(context);
},
child: Padding(
padding: const EdgeInsets.only(bottom: 20),
child: Container(
padding: const EdgeInsets.all(10),
child: Row(
children: [
Image.asset(
codeCountryList[index].image,
height: 30,
),
const SizedBox(width: 20),
Text(codeCountryList[index].country,
style: StyleTextUtils.textCode),
const SizedBox(width: 20),
Text(codeCountryList[index].prefix,
style: StyleTextUtils.textCode),
],
),
),
),
);
},
),
),
);
},
);
}

how to get rid of it?
>Solution :
try to wrap it in the Material()..
return showDialog<void>(
context: context,
builder: (BuildContext context) {
return Material(
child: Center(....