每当我在容器外轻敲时,我都试图让容器消失
"Use Visibility widget and put your containers into a stack
bool isVisible = true;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: stackedContainers()
);
}
Stack stackedContainers() {
return new Stack(
children: <Widget>[
myContainer(),
GestureDetector(
child: background(),
onTap: () {
setState(() {
isVisible = false;
});
},
)
],
);
}
Container myContainer() {
return Container(
child: Visibility(
visible: isVisible,
//.....
Check this package: https:\/\/pub.dev\/packages\/tap_canvas<\/a>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.