Answers for "onclose of modal reload screen flutter"

0

onclose of modal reload screen flutter

Every Navigator push metod is async - you can wait till it poped

showModalBottomSheet under the hood pushes route to navigator, so you can 
rebuild your parent after bottomSheet closed this way

// somewhere in statefull parent
onTap:() async {
  await showModalBottomSheet();
  setState((){});
}
Posted by: Guest on August-05-2021
0

onclose of dialog reload screen flutter

Return true in pop Navigator from the dialog when want to refresh the screen

FlatButton(
    onPressed: () => Navigator.of(context).pop(true),
    child: Text("Close")),
    ...
    ...
)  

Refresh screen when getting true in result

final result = await showDialog<bool>(
  context: context,
  builder: (context) => MyDialog(),
);

if (result) {
	// refresh screen
    setState(() {});
}
Posted by: Guest on August-05-2021

Browse Popular Code Answers by Language