I Trying to create a custom dialog. In dialog Close button is above of container:
Now I am trying to close dialog when user Tapped on this close icon:
Widget build(BuildContext context) {
return Dialog(
insetPadding: EdgeInsets.symmetric(vertical: 0.0, horizontal: 30.0),
child: Container(
width: 300,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Stack(
overflow: Overflow.visible,
children: [
Visibility(
visible: true,
child: Positioned(
top: -15,
left: 0,
child: GestureDetector(
onTap: () {
print("Clicked");
},
child: CircleWidget()),
),
),
SingleChildScrollView(
child: Column(
But onTap not triggered ! I think it's lay down under some widget!!!
If GestureDetector be parent of Positioned
on widget shape is messed.like this:
Although onTap not work like above .What is your idea?
As I guess before, a widget covered GestureDetector so I changed the position of This code :
Visibility(
visible: widget.showCloseButton(),
child: Positioned(
top: -15,
left: 0,
with :
SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
Now GestureDetector works like a charm :-)
complete code:
Widget build(BuildContext context) {
return Dialog(
insetPadding: EdgeInsets.symmetric(vertical: 0.0, horizontal: 30.0),
child: Container(
width: 300,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Stack(
overflow: Overflow.visible,
children: [
SingleChildScrollView(
child: Column(.....
Visibility(
visible: true,
child: Positioned(
top: -15,
left: 0,
child: GestureDetector(
onTap: () {
print("Clicked");
},
child: CircleWidget()),
),
),