scroll_shadow_container 1.0.1

scroll_shadow_container #

pub package

A widget that wraps scrollable container and draws neat little shadows until top or bottom of container is not reached.

shadows

Usage #

To use this package, add scroll_shadow_container as a dependency in your pubspec.yaml file.

dependencies:
  scroll_shadow_container:

And import the package in your code.

import 'package:scroll_shadow_container/scroll_shadow_container.dart';

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'),
      );
    }),
  ),
)

Or you can use ScrollShadowContainer.custom constructor to supply your own BoxShadow:

ScrollShadowContainer.custom(
  boxShadow: BoxShadow(blurRadius: 5, spreadRadius: 5),
  child: /* ... */
)

You can also obtain BoxDecorations used by this package using following code.

Container(
  decoration: MaterialShadow.asBoxDecoration(elevation: MaterialElevation.the4dp),
)

I only tried to replicate Material's shadows so they're not actually identical but close. Only 1 to 8 elevation values available.

[1.0.0] - 10.05.2019

  • Initial release

[1.0.1] - 10.05.2019

  • Added examples to example/README.md

example/README.md

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'),
      );
    }),
  ),
)

Or you can use ScrollShadowContainer.custom constructor to supply your own BoxShadow:

ScrollShadowContainer.custom(
  boxShadow: BoxShadow(blurRadius: 5, spreadRadius: 5),
  child: /* ... */
)

You can also obtain BoxDecorations used by this package using following code.

Container(
  decoration: MaterialShadow.asBoxDecoration(elevation: MaterialElevation.the4dp),
)

I only tried to replicate Material's shadows so they're not actually identical but close. Only 1 to 8 elevation values available.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  scroll_shadow_container: ^1.0.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:scroll_shadow_container/scroll_shadow_container.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
33
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
66
Learn more about scoring.

We analyzed this package on Sep 13, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.0
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.2

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/scroll_shadow_container.dart.

Run flutter format to format lib/scroll_shadow_container.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test