withTopAndBottomFade method

Widget withTopAndBottomFade({
  1. required BuildContext context,
  2. Color? fadeColor,
  3. double startFade = 0.97,
  4. AlignmentGeometry? begin,
  5. AlignmentGeometry? end,
  6. List<double>? stops,
  7. Rect shaderRect(
    1. Rect
    )?,
  8. BlendMode? blendMode,
})

Implementation

Widget withTopAndBottomFade({
  required BuildContext context,
  Color? fadeColor,
  double startFade = 0.97,
  AlignmentGeometry? begin,
  AlignmentGeometry? end,
  List<double>? stops,
  Rect Function(Rect)? shaderRect,
  BlendMode? blendMode,
}) {
  var overlayColor = fadeColor ?? Theme.of(context).colorScheme.surface;
  return FadeContainer(
    child: this,
    fadeColors: [
      overlayColor,
      context.transparent,
      context.transparent,
      overlayColor
    ],
    begin: begin ?? Alignment.topCenter,
    end: end ?? Alignment.bottomCenter,
    stops: stops ?? [
      0,
      (1 - startFade),
      startFade,
      1.0,
    ],
    shaderRect: shaderRect ?? (rect) => rect,
    blendMode: blendMode ?? BlendMode.srcATop,
  );
}