Bonjour,
J’utilise un CarouselSlider qui affiche une image et un GridView. Lors de la première boucle du Carousel tout s’affiche bien. Mais quand elle revient sur le premier slide la GridView ne s’affiche plus correctement. Et pareil pour les autres slides et quand on change à la main aussi.
Quelqu’un a déjà rencontré ce problème ?
CarouselSlider ? C’est quoi ? À voir avec un Sliver ?
Hello @kur0tatsu, je ne comprend pas bien le résultat que tu souhaites avoir …
Pourrais tu nous fournir ton code et nous expliquer ton but final afin d’avoir plus d’informations sur ton problème.
Bonjour, désolé pour le retour tardif.
Column(
children: [
Container(
color: Colors.transparent,
padding: const EdgeInsets.only(
top: .0,
bottom: .0,
),
child: CarouselSlider.builder(
key: carouselAccueilKey,
itemCount: widgetList.length,
options: CarouselOptions(
pageViewKey: const PageStorageKey<String>('carousel_slider'),
height: _carouselHeight,
autoPlay: _autoPlay,
autoPlayCurve: Curves.easeOut,
autoPlayInterval: Duration(seconds: _autoPlayInterval),
enlargeCenterPage: false,
viewportFraction: 1.0,
onPageChanged: (int index, CarouselPageChangedReason reason) =>
setState(() => _keyIndicationPosition.currentState!.onSelectPosition(index)),
),
itemBuilder: (BuildContext context, int index, int realIndex) =>
Builder(builder: (context) => widgetList[index])),
),
Container(
child: widgetList.isEmpty
? const SizedBox.shrink()
: IndicatorPosition(
key: _keyIndicationPosition,
widgetList: widgetList,
initialPosition: _initPosition,
indicatorSize: 8.0,
verticalMargin: 10.0,
horizontalMargin: 4.0),
),
],
);
Voila le code que j’utilise dans un StatefulWidget. Et j’aimerais persister les card dans la widgestList. Quand le carousel revient à l’index de départ les widgets ne sont plus affichés dans le carousel
Hello @kur0tatsu ,
D’ou tu sors ton widget IndicatorPosition
et de quel type est ta _keyIndicationPosition
du coup ?
Je connais pas du tout ce widget et je trouve pas de doc dessus.
A première vue ton code me semble correct mais sur cette partie… je peux rien vérifier 