0
I needed as soon as the user accessed a particular application screen to open a alertDialog. But I can’t make it happen. I’ve tried opening with initState but it still won’t open.
I have this modal, it works if triggered by a button.
Future<void> clienteEndereco() async {
return showDialog<void>(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Center(
child: Text(
'Complete seu cadastro',
style: TextStyle(fontWeight: FontWeight.w800),
)),
content: SingleChildScrollView(
child: ListBody(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(bottom: 30.0),
child: Text(
"Para usar todos os benefícios do Clube Mercosul complete seu cadastro",
style: TextStyle(fontWeight: FontWeight.w500),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Expanded(
flex: 1,
child: InkWell(
onTap: () {
Navigator.of(context).pop();
},
child: Text(
"Cancelar",
style: TextStyle(
fontSize: 18,
color: blueColor,
fontWeight: FontWeight.w800),
)),
),
Expanded(
flex: 1,
child: InkWell(
onTap: () {
},
child: Text(
"Completar meu cadastro",
style: TextStyle(
fontSize: 18,
color: blueColor,
fontWeight: FontWeight.w800),
)),
),
],
),
],
),
),
);
},
);
}
I’ve tried calling him a builder but not so much.
_HomePageState() {
clienteEndereco();//alerta
}