horizontal method

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

Implementation

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

        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.horizontal(intervalAni, index, page, child),
            ),
          ),
        );
      }),
    );
  });
}