I am displaying a network image in the app and I need to display a button when the user taps on the screen. until then it should stay hidden. How can I do it?
return Scaffold(
body: GestureDetector(
onTap: (){
},
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage(widget.img_url),
fit: BoxFit.contain
)
),
),
),
);
CodePudding user response:
Add a GestureDetector around your Container, in onTap function set a bool value to true what means show the button:
GestureDetector(child: Container(...), onTap: () { _show = true; })
And put your button somewhere like this:
_show ? RaisedButton() : null