How to make Navigator.pop(context) work in GestureDetector?
I think the problem with SingleChildScrollView, but I don’t understand how to fix it.
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: greyGood,
body: SizedBox(
width: double.infinity,
height: double.infinity,
child: Stack(
children: [
SizedBox(
height: 350,
width: double.infinity,
child: Image.asset(
widget.photo,
fit: BoxFit.cover,
),
),
SafeArea(
child: Padding(
padding: const EdgeInsets.only(left: 10),
child: IconButton(
icon: Icon(Icons.arrow_back_ios_new_rounded),
onPressed: () {
Navigator.of(context).pop;
},
),
),
),
Positioned(
top: 0,
left: 0,
right: 0,
bottom: 0,
child: SingleChildScrollView(
child: Column(
I tried use
setState(() {
Navigator.pop(context);
});
and tried to replace with
IconButton(
icon: Icon(Icons.arrow_back_ios_new_rounded),
onPressed: () {
Navigator.pop(context);
},
),
but it isn’t worked for me
>Solution :
Move SafeArea widget after Positioned in list. The problem is that the Positioned is over SafeArea and gestures was not recognized.
Also instead of pop;, you have to use pop();