Flutter 我的名单赢了';t在它之后更新事件';s指数
好吧,我对颤振还很陌生,我为此做了很多尝试,但我认为我没有用正确的想法解决这个问题。 所以我在这里问,当我在旋转木马中更改页面时,如何更改列表中的索引。 我切换到StatefulWidget只是为了使用setState(),但它没有改变任何东西,我想我可能需要使用某种通知程序,但我几乎从未使用过它们,所以我不知道如何在这里实现它们Flutter 我的名单赢了';t在它之后更新事件';s指数,flutter,dart,Flutter,Dart,好吧,我对颤振还很陌生,我为此做了很多尝试,但我认为我没有用正确的想法解决这个问题。 所以我在这里问,当我在旋转木马中更改页面时,如何更改列表中的索引。 我切换到StatefulWidget只是为了使用setState(),但它没有改变任何东西,我想我可能需要使用某种通知程序,但我几乎从未使用过它们,所以我不知道如何在这里实现它们 Column ( children: [ CarouselSlider( items: myBoards, option
Column (
children: [
CarouselSlider(
items: myBoards,
options: CarouselOptions(
enableInfiniteScroll: false,
height: 80,
viewportFraction: 0.8,
initialPage: 0,
reverse: false,
enlargeCenterPage: true,
onPageChanged: (index, reason) {
setState(() {
_currentIndex = index;
});
},
scrollDirection: Axis.horizontal,
)
),
Container(
width: MediaQuery.of(context).size.width * 0.90,
child: CropListView(Controller: Controller,documents: documents, index: _currentIndex),
),
],
);
您是否验证了onPageChanged正在被调用,并且索引与以前的值不同?是的,我验证了,一切正常只是listView没有更新