flutter_swiper icon indicating copy to clipboard operation
flutter_swiper copied to clipboard

IntegerDivisionByZeroException

Open julianfrancodev opened this issue 4 years ago • 2 comments

Hello there i have this iusse

`The following IntegerDivisionByZeroException was thrown building AnimatedBuilder(animation: AnimationController#46bc2(▶ 0.500; paused), dirty, state: _AnimatedState#4eba6): IntegerDivisionByZeroException

The relevant error-causing widget was: Swiper file:///home/julian/AndroidStudioProjects/flutter_03/lib/src/widgets/card_swiper_widget.dart:16:14 When the exception was thrown, this was the stack: #0 int.% (dart:core-patch/integers.dart:34:7) #1 _CustomLayoutStateBase._buildAnimation (package:flutter_swiper/src/custom_layout.dart:95:29) #2 AnimatedBuilder.build (package:flutter/src/widgets/transitions.dart:1180:19) #3 _AnimatedState.build (package:flutter/src/widgets/transitions.dart:179:48) #4 StatefulElement.build (package:flutter/src/widgets/framework.dart:4663:28) `

Using Swiper widget into my card_swiper_widget.dart widget

this is the swiper code

` Swiper( itemBuilder: (BuildContext context, int index) {

      return ClipRRect(
          borderRadius: BorderRadius.circular(20),
          child: FadeInImage(
            placeholder: AssetImage('assets/images/jar-loading.gif'),
            image: NetworkImage(data[index].getPosterImg()),
            fit: BoxFit.cover,
          )
      );
    },
    itemCount: data.length,
    itemHeight: _screenSizen.height * 0.5,
    itemWidth: _screenSizen.width * 0.7,
    layout: SwiperLayout.STACK,

  ),`

julianfrancodev avatar Sep 11 '20 22:09 julianfrancodev

anyone can resolve this problem ?

ExiaGo avatar Apr 03 '21 11:04 ExiaGo

I think the problem is initialization, my resolvent is give the swiper one initialization item, if we do not need this default item, we can clear() before we get the data from service.

ExiaGo avatar Apr 05 '21 08:04 ExiaGo