Last updated:
0 purchases
scroll shadow container
scroll_shadow_container #
A widget that wraps scrollable container and draws neat little shadows until top or bottom of container is not reached.
Usage #
To use this package, add scroll_shadow_container as a dependency in your pubspec.yaml file.
dependencies:
scroll_shadow_container:
copied to clipboard
And import the package in your code.
import 'package:scroll_shadow_container/scroll_shadow_container.dart';
copied to clipboard
Example #
You can specify shadow elevation via elevation property which does not very accurately mocks Material's elevation.
ScrollShadowContainer(
elevation: MaterialElevation.the2dp,
child: ListView(
children: List.generate(10, (i) {
return ListTile(
leading: CircleAvatar(child: Text((i + 1).toString())),
title: Text('List item title'),
subtitle: Text('List item subtitle'),
);
}),
),
)
copied to clipboard
Or you can use ScrollShadowContainer.custom constructor to supply your own BoxShadow:
ScrollShadowContainer.custom(
boxShadow: BoxShadow(blurRadius: 5, spreadRadius: 5),
child: /* ... */
)
copied to clipboard
You can also obtain BoxDecorations used by this package using following code.
Container(
decoration: MaterialShadow.asBoxDecoration(elevation: MaterialElevation.the4dp),
)
copied to clipboard
I only tried to replicate Material's shadows so they're not actually identical but close. Only 1 to 8 elevation values available.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.