Skip to content

Commit

Permalink
Merge pull request #2 from Zabadam/master
Browse files Browse the repository at this point in the history
Null-safety support; Animation & Visibility logic simplification
  • Loading branch information
rickypid authored May 1, 2021
2 parents e3980a0 + 5e0de22 commit 42dcab1
Show file tree
Hide file tree
Showing 12 changed files with 333 additions and 474 deletions.
17 changes: 15 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## [0.1.0-alpha] - 2021-04-30
# Flutter Scroll Shadow
## [0.1.0-alpha.2] - 2021-04-30
#### [@Zabadam](https://github.com/zabadam)
- Added `Curve` parameter and made `duration` a full `Duration`.

## [0.1.0-alpha.1] - 2021-04-30
#### [@Zabadam](https://github.com/zabadam)
- Split package into `/src` files.
- Null safety support.
- Default `duration` increased to `300` ms (and property name shortened).
- Major simplification of visibility logic.
- Removal of `AnimationController`s and `Tween`s in favor of `AnimatedOpacity`s.
- `loc`: 231 -> 185, with added comments 👍

* Initial Open Source release.
## [0.1.0-alpha] - 2021-04-30
- Initial release.
57 changes: 25 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
# flutter_scroll_shadow
#### flutter_scroll_shadow
# Scroll Shadow

[![Pub Package](https://img.shields.io/pub/v/flutter_scroll_shadow.svg?style=flat-square)](https://pub.dartlang.org/packages/flutter_scroll_shadow) [![Package Issue](https://img.shields.io/github/issues/rickypid/flutter_scroll_shadow)](https://github.com/rickypid/flutter_scroll_shadow/issues)
![Package License](https://img.shields.io/github/license/rickypid/flutter_scroll_shadow)

Scroll shadow widget for Flutter. This widget add on scroll widget a shadow, work on widget with ScrollController with vertical or horizontal orientation.
`ScrollShadow` is a widget for Flutter that adds shadows to a scrollable child.

Supports `ScrollController` and vertical or horizontal orientation.

| ![Image](https://github.com/rickypid/flutter_scroll_shadow/blob/master/doc/.media/example.gif?raw=true) |
| :------------: |
| **ScrollShadow** |

## Features
* Adds shadows over a scrollable child while not at its max extents
* Supports vertical and horizontal `Axis`
* Customizable animation duration
* Determine how wide or tall shadows render

* Add on scroll widget a shadow
* Vertical and Horizontal axis
* Animation time customizable
* Shadow size customizable
 

## Usage

Make sure to check out [examples](https://github.com/rickypid/flutter_scroll_shadow/tree/master/exmple).
Make sure to check out the [examples on GitHub](https://github.com/rickypid/flutter_scroll_shadow/tree/master/exmple).

### Installation

Add the following line to `pubspec.yaml`:

```yaml
dependencies:
flutter_scroll_shadow: ^0.1.0-alpha
flutter_scroll_shadow: ^0.1.0-alpha.1
```
### Basic setup
*The complete example is available [here](https://github.com/rickypid/flutter_scroll_shadow/blob/master/example/lib/main.dart).*
*Complete example [available here](https://github.com/rickypid/flutter_scroll_shadow/blob/master/example/lib/main.dart).*
```dart
ScrollShadow(
Expand All @@ -42,24 +42,17 @@ ScrollShadow(
);
```

### Advanced options

#### Property

* `scrollDirection` Axis, is a direction of scroll, Default: Axis.vertical
* `ScrollController` (Optional) necessary if child scroll used an external controller or scrollDirection = Axis.horizontal
* `color` is a color of shadow, Default: Colors.grey
* `size` is a size of shadow, Default: 15
* `child` The child contained by the ScrollShadow.
* `animationDuration` in milliseconds, it's duration time of animation duration on shadow visible status change

### Example

| ![Image](https://github.com/rickypid/flutter_scroll_shadow/blob/master/doc/.media/example_vertical.png?raw=true) | ![Image](https://github.com/rickypid/flutter_scroll_shadow/blob/master/doc/.media/example_horizontal.png?raw=true) |
| :------------: | :------------: |
| **Vertical axis** | **Horizontal axis** |



### Properties
* `scrollDirection`: Scroll direction corresponding to child; default: `Axis.vertical`
* `controller`: Optional for vertically scrolling content, but required if the child is `Axis.horizontal`
* `color`: for the shadows; default: `Colors.grey`
* `size`: The width or height of shadows, depending on `Axis`; default: `15.0`
* `child`: Scrollable child contained by the `ScrollShadow`
* `duration`: Milliseconds, as an `int,` for animation of shadow visibility changes; default: `300`

 

## Example
![Image](https://github.com/rickypid/flutter_scroll_shadow/blob/master/doc/.media/example_vertical.png?raw=true) | ![Image](https://github.com/rickypid/flutter_scroll_shadow/blob/master/doc/.media/example_horizontal.png?raw=true)
:-:| :-:
**Vertically-scrolling child** | **Horizontally-scrolling child**
62 changes: 52 additions & 10 deletions example/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,58 @@
# flutter_scroll_shadow_example
#### flutter_scroll_shadow
# Scroll Shadow

Flutter simple example, single value bar graph viewer with indicators
[![Pub Package](https://img.shields.io/pub/v/flutter_scroll_shadow.svg?style=flat-square)](https://pub.dartlang.org/packages/flutter_scroll_shadow) [![Package Issue](https://img.shields.io/github/issues/rickypid/flutter_scroll_shadow)](https://github.com/rickypid/flutter_scroll_shadow/issues)
![Package License](https://img.shields.io/github/license/rickypid/flutter_scroll_shadow)

## Getting Started
`ScrollShadow` is a widget for Flutter that adds shadows to a scrollable child.

This project is a starting point for a Flutter application.
Supports `ScrollController` and vertical or horizontal orientation.

A few resources to get you started if this is your first Flutter project:
| ![Image](https://github.com/rickypid/flutter_scroll_shadow/blob/master/doc/.media/example.gif?raw=true) |
| :------------: |
| **ScrollShadow** |

- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
## Features
* Adds shadows over a scrollable child while not at its max extents
* Supports vertical and horizontal `Axis`
* Customizable animation duration
* Determine how wide or tall shadows render

For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
 

## Usage
Make sure to check out the [examples on GitHub](https://github.com/rickypid/flutter_scroll_shadow/tree/master/exmple).

### Installation
Add the following line to `pubspec.yaml`:
```yaml
dependencies:
flutter_scroll_shadow: ^0.1.0-alpha.1
```
### Basic setup
*Complete example [available here](https://github.com/rickypid/flutter_scroll_shadow/blob/master/example/lib/main.dart).*
```dart
ScrollShadow(
color: Colors.grey,
child: ListView(
children: List.generate(20, (index) => ListTile(title: Text('Element $index'),)),
),
);
```

### Properties
* `scrollDirection`: Scroll direction corresponding to child; default: `Axis.vertical`
* `controller`: Optional for vertically scrolling content, but required if the child is `Axis.horizontal`
* `color`: for the shadows; default: `Colors.grey`
* `size`: The width or height of shadows, depending on `Axis`; default: `15.0`
* `child`: Scrollable child contained by the `ScrollShadow`
* `duration`: Milliseconds, as an `int,` for animation of shadow visibility changes; default: `300`

 

## Example
![Image](https://github.com/rickypid/flutter_scroll_shadow/blob/master/doc/.media/example_vertical.png?raw=true) | ![Image](https://github.com/rickypid/flutter_scroll_shadow/blob/master/doc/.media/example_horizontal.png?raw=true)
:-:| :-:
**Vertically-scrolling child** | **Horizontally-scrolling child**
71 changes: 32 additions & 39 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,79 +1,72 @@
import 'package:flutter/material.dart';
import 'package:flutter_scroll_shadow/flutter_scroll_shadow.dart';

void main() {
runApp(MyApp());
}
void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'ScrollShadow',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'ScrollShadow'),
title: 'ScrollShadow Example',
theme: ThemeData(primarySwatch: Colors.blue),
home: const MyHomePage(),
);
}
}

class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;

@override
const MyHomePage({Key? key}) : super(key: key);
_MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
ScrollController controllerHorizontal = new ScrollController();

@override
void initState() {
super.initState();
}
ScrollController horizontalController = ScrollController();

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
title: const Text(
' Vertical | Horizontal'),
centerTitle: true,
),
body: Container(
child: Row(
children: [
//Vertical scroll
// Vertically-scrolling child
Expanded(
child: ScrollShadow(
color: Colors.grey,
child: ListView(
children: List.generate(
20,
(index) => ListTile(
title: Text('Element $index'),
))),
children: List.generate(
20,
(index) => ListTile(title: Text('Element $index')),
),
),
),
),
//Horizontal scroll

// Horizontally-scrolling child
Expanded(
child: ScrollShadow(
scrollDirection: Axis.horizontal,
controller: controllerHorizontal,
controller: horizontalController,
color: Colors.grey,
child: ListView(
scrollDirection: Axis.horizontal,
controller: controllerHorizontal,
//Required with horizontal scroll direction
children: List.generate(
20,
(index) => Container(
width: 100,
child: RotatedBox(
quarterTurns: 1,
child: Text('Element $index')),
))),
scrollDirection: Axis.horizontal,
// ScrollController is required for Axis.horizontal
controller: horizontalController,
children: List.generate(
20,
(index) => Container(
width: 100,
child: RotatedBox(
quarterTurns: 1,
child: Text('Element $index'),
),
),
),
),
),
),
],
Expand Down
15 changes: 4 additions & 11 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
fake_async:
dependency: transitive
description:
Expand All @@ -63,12 +56,12 @@ packages:
source: sdk
version: "0.0.0"
flutter_scroll_shadow:
dependency: "direct main"
dependency: "direct dev"
description:
path: ".."
relative: true
source: path
version: "0.1.0-alpha"
version: "0.1.0-alpha.2"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down Expand Up @@ -106,7 +99,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.8.0"
stack_trace:
dependency: transitive
description:
Expand Down Expand Up @@ -157,5 +150,5 @@ packages:
source: hosted
version: "2.1.0"
sdks:
dart: ">=2.12.0-0.0 <3.0.0"
dart: ">=2.12.0 <3.0.0"
flutter: ">=1.17.0"
Loading

0 comments on commit 42dcab1

Please sign in to comment.