appinioGmbH / flutter_packages

Dart and Flutter plugins/packages used and maintained by @appinioGmbH
193 stars 224 forks source link

[appinio_swiper] Public access to currentIndex #156

Closed Nico04 closed 11 months ago

Nico04 commented 1 year ago

For advanced animation purpose, I need to get the current index (the index of the card currently on top). I have found a workaround using a GlobalKey :

final _swiperKey = GlobalKey<State<AppinioSwiper>>();
int? get _currentGroupIndex => (_swiperKey.currentState as dynamic)?.currentIndex;

It actually works great, but it would be much better to have access to this currentIndex directly in the cardsBuilder callback ? Or if you don't like that idea, at least to make the _AppinioSwiperState class public so I can remove the dynamic casting ?

bilalhamud commented 11 months ago

Fixed with version 2.1.0