我需要像在图像中那样实现图像轮播。我已经在我的代码中完成了没有圆形头像部分的图像轮播实现。当点击圆形部分时,必须更改图像
Stack(
children: [
Container(
width: width * 1,
height: height * 1,
child: PageView.builder(
controller: _controller,
scrollDirection: Axis.horizontal,
itemCount: photos.length,
itemBuilder: (context, photoIndex) {
return _buildImageState(photoIndex, width, height);
}),
),
SelectedPhoto(photoIndex: photoIndex,numberOfDots: photos.length,)
],
),
);
}
Widget _buildImageState(int photoIndex, double width, double height) {
return Container(
decoration: BoxDecoration(
color: Colors.transparent,
image: DecorationImage(
image: AssetImage(photos[photoIndex]),
fit: BoxFit.fill,
),
),
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [Colors.transparent, Colors.white],
stops: [
0.5,
0.75,
]
)
)),
);
}
}