[英]How to make a ListView or PageView with Circle Items in Flutter and resizing the current Circle bigger?
像這樣: https : //i.gyazo.com/2d60f65a1801eaaa58bcb1e795f7edec.png帶圓圈。 是否也可以做這樣的事情https://gyazo.com/f58e4c5db30013a832b70a839fdc1c03 ?
//declare these
PageController _pageController = PageController(viewportFraction: 0.5);
int selectedPage = 0;
List yourList =[];
//in initState method
_pageController.addListener(() {
setState(() {
selectedPage = controller.page;
});
});
//inside body
PageView(
controller: _pageController,
itemBuilder: (context, index) {
if (index == selectedPage) {
Container(
alignment: Alignment.center,
height:300.0,
width:300.0,
child: CircleAvatar(
backgroundImage: yourList[index],
//modify as you want
)
)
}
else {
Container(
alignment: Alignment.bottom,
height:100.0,
width:100.0,
child: CircleAvatar(
backgroundImage: yourList[index],
//modify as you want
)
}
},
itemCount: yourList.length,
),
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.