ScrollShadow constructor
const
ScrollShadow({
- required Widget? child,
- double? topRightPadding,
- double? topLeftPadding,
- Radius? topRadius,
- double? bottomRightPadding,
- double? bottomLeftPadding,
- Radius? bottomRadius,
- ShadowVisibility topShadowVisibility = ShadowVisibility.whenScrolled,
- ShadowVisibility bottomShadowVisibility = ShadowVisibility.whenScrolled,
- Color topShadowColor = Colors.black,
- Color bottomShadowColor = Colors.black,
- Color topShadowDividerColor = const Color(0xD0000000),
- Color bottomShadowDividerColor = const Color(0xD0000000),
- double? elevation,
- bool ifHidesShadowForNegativeScroll = false,
- 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;