class _DemoPageState extends State<DemoPage> { final int currentIndex = 0; @override Widget build(BuildContext context) { return IndexedStack( //所以指定谁,就显示谁,这里0表示第一个child,所以显示CircleAvatar index: currentIndex, children: [ CircleAvatar( backgroundColor: Colors.green, radius: 50.0, ), Container( decoration: BoxDecoration( color: Colors.black12, ), child: Text( 'IndexedStack', style: TextStyle( fontSize: 20.0, fontWeight: FontWeight.bold, color: Colors.white), ), ) ], ); } }
部分素材资源来源网站,本站提供免费下载,如有侵权请联系站长马上删除!