ScrollShadow constructor

const ScrollShadow({
  1. required Widget? child,
  2. double? topRightPadding,
  3. double? topLeftPadding,
  4. Radius? topRadius,
  5. double? bottomRightPadding,
  6. double? bottomLeftPadding,
  7. Radius? bottomRadius,
  8. ShadowVisibility topShadowVisibility = ShadowVisibility.whenScrolled,
  9. ShadowVisibility bottomShadowVisibility = ShadowVisibility.whenScrolled,
  10. Color topShadowColor = Colors.black,
  11. Color bottomShadowColor = Colors.black,
  12. Color topShadowDividerColor = const Color(0xD0000000),
  13. Color bottomShadowDividerColor = const Color(0xD0000000),
  14. double? elevation,
  15. bool ifHidesShadowForNegativeScroll = false,
  16. Key? key,
})

A widget that adds shadows to the top and bottom edges of a scrollable area to visually indicate overflow content.

The ScrollShadow is designed to dynamically display shadows at the edges of a scrollable widget based on the scroll state and content size. Shadows help provide a visual cue that more content is available in a particular direction.

The visibility, padding, color, and other aspects of the shadows can be customized independently for the top and bottom edges.

Example Usage

ScrollShadow(
  topShadowVisibility: ShadowVisibility.whenScrolled,
  bottomShadowVisibility: ShadowVisibility.alwaysOn,
  topShadowColor: Colors.black45,
  bottomShadowColor: Colors.black45,
  child: ListView.builder(
    itemCount: 50,
    itemBuilder: (context, index) => ListTile(title: Text('Item $index')),
  ),
);

Implementation

const ScrollShadow({
  required this.child,
  double? topRightPadding,
  double? topLeftPadding,
  Radius? topRadius,
  double? bottomRightPadding,
  double? bottomLeftPadding,
  Radius? bottomRadius,
  this.topShadowVisibility = ShadowVisibility.whenScrolled,
  this.bottomShadowVisibility = ShadowVisibility.whenScrolled,
  this.topShadowColor = Colors.black,
  this.bottomShadowColor = Colors.black,
  this.topShadowDividerColor = const Color(0xD0000000),
  this.bottomShadowDividerColor = const Color(0xD0000000),
  this.elevation,
  this.ifHidesShadowForNegativeScroll = false,
  super.key,
})  : topRightPadding = topRightPadding ?? defaultRightPadding,
      topLeftPadding = topLeftPadding ?? defaultLeftPadding,
      topRadius = topRadius ?? defaultRadius,
      bottomRightPadding = bottomRightPadding ?? defaultRightPadding,
      bottomLeftPadding = bottomLeftPadding ?? defaultLeftPadding,
      bottomRadius = bottomRadius ?? defaultRadius;