buildEffect method
Widget
buildEffect({
- required Widget child,
- required int index,
- required double position,
- double? itemWidth,
- double? itemHeight,
- bool? isScrolling,
- required AnimationScrollDirection direction,
override
Implementation
@override
Widget buildEffect(
{required Widget child,
required int index,
required double position,
double? itemWidth,
double? itemHeight,
bool? isScrolling,
required AnimationScrollDirection direction}) {
double delta = index - position;
if (isStatic(delta, type, direction, snap, isScrolling)) {
return child;
}
delta = delta.abs();
double opacity = 1.0 - delta * this.opacity;
return Opacity(
opacity: opacity < 0
? 0
: opacity > 1
? 1
: opacity,
child: child,
);
}