horizontalFlip method

  1. @override
Widget horizontalFlip(
  1. double aniValue,
  2. int index,
  3. double page,
  4. Widget child,
)
override

Implementation

@override
Widget horizontalFlip(double aniValue, int index, double page, Widget child) {
  return LayoutBuilder(builder: (context, constraints) {
    return Column(
      children: List.generate(shutterSize, (indexSub) {
        double intervalAni = 0;

        // if (page > index) {
        //   intervalAni = Interval(indexSub / shutterSize, (indexSub + 1) / shutterSize).transform(aniValue.abs());
        //   // return SizedBox.shrink();
        // } else {
        //   intervalAni = Interval((shutterSize - indexSub - 1) / shutterSize, (shutterSize - indexSub) / shutterSize)
        //       .transform(aniValue.abs());
        // }
        if (page > index) {
          intervalAni = Interval(indexSub * delay, 1-(shutterSize - indexSub) * delay).transform(aniValue.abs());
          // return SizedBox.shrink();
        } else {
          int sub = shutterSize - indexSub;
          intervalAni = Interval(sub * delay, 1-(shutterSize - sub) * delay)
              .transform(aniValue.abs());
        }

        return ClipRect(
          child: Align(
            heightFactor: 1 / shutterSize,
            alignment: FractionalOffset(0, indexSub / (shutterSize - 1)),
            child:
                SizedBox(height: constraints.maxHeight, child: super.horizontalFlip(intervalAni, index, page, child)),
          ),
        );
      }),
    );
  });
}