Offstage(
offstage: 布尔值, 当为true时,将隐藏组件且不保留空间位置
child: 组件,
)
代码示例:
class _HomeState extends State<Home> {
@override
Widget build(BuildContext context) {
return Container(
child: ListView(
children: <Widget>[
Offstage(
offstage: true,
child: Text('ahh'),
),
Text('bb')
],
),
);
}
}