正如你们读到的标题并没有以某种方式更新。它只是在我进行热重载并且我不希望这样做时发生。我期待当用手指向左或向右滑动图像时,点指示器必须跟随。请提前帮助和感谢。这是我的轮播代码和点指示器:
final urlImages1 = [
'https://i.imgur.com/Y3UejT0.jpg',
'https://i.imgur.com/KNFL3qd.jpg',
'https://i.imgur.com/fxAH9HY.jpg',
'https://i.imgur.com/9GkgdKx.jpg',
];
int currentIndex = 0;
child: Column(
children: [
CarouselSlider.builder(
itemCount:
urlImages1.length,
itemBuilder: (context,
index, realIndex) {
final urlImage01 =
urlImages1[index];
return buildImage(
urlImage01,
index);
},
options:
CarouselOptions(
height: 300,
enlargeStrategy:
CenterPageEnlargeStrategy
.height,
enlargeCenterPage:
true,
onPageChanged:
(index,
reason) {
setState(() {
currentIndex =
index;
});
}),
),
SizedBox(
height: 10,
),
dotIndicator(),
],
),
Widget dotIndicator() => AnimatedSmoothIndicator(
activeIndex: currentIndex,
count: urlImages1.length,
effect: JumpingDotEffect(
dotHeight: 10,
dotWidth: 10,
dotColor: Colors.grey,
activeDotColor: Colors.green),
);
编辑:简而言之,当我滑动图像时,此图像下的点不会移动。只有热重载。