snapping_sheet 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • new69

Snapping sheet #

A package that provides a highly customizable sheet widget that snaps to different vertical positions

Using only placeholders ListView

You can run the examples by cloning the following repository and run the app from the example folder.

Quick start #

Begin by following the install instruction.

You can add the snapping sheet to you app by adding the following code

    import 'package:flutter/material.dart';
    import 'package:snapping_sheet/snapping_sheet.dart';

    class SnapSheetExample extends StatelessWidget {
        @override
        Widget build(BuildContext context) {
            return Scaffold(
            body: SnappingSheet(
                    sheetBelow: Container(
                        color: Colors.red
                    ),
                    grabbing: Container(
                        color: Colors.blue,
                    ),
                ),
            );
        }
    }

Snap positions #

To change the snap positions for the sheet, change the snapPositions parameter witch takes in a list of SnapPosition.

    SnappingSheet(
        snapPositions: [
            SnapPosition(
                positionPixel: 25.0, 
                snappingCurve: Curves.elasticOut, 
                snappingDuration: Duration(milliseconds: 750)
            ),
            SnapPosition(
                positionFactor: 0.5, 
                snappingCurve: Curves.ease, 
                snappingDuration: Duration(milliseconds: 500)
            ),
        ],
    )

Other options #

NameDescription
childThe widget behind the sheet.
sheetBelowThe widget that is the remaining space between the bottom to the bottom of the grabbing widget.
sheetAboveThe widget that is the remaining space between the top to the top of the grabbing widget
grabbingThe widget fixed between the sheetBelow and sheetAbove.
grabbingHeightThe height of the grabbing widget.
sheetBelowMarginThe margin for the sheetBelow widget. Can be negative values.
sheetAboveMarginThe margin for the sheetAbove widget. Can be negative values.
snapPositionsThe different snap positions for the sheet
initSnapPositionThe init snap position, do not need to exist in the napPositions list
snappingSheetControllerControl the sheet and get current snap position
onMoveCallback when the sheet is moving.
onSnapBeginCallback when a snap begins, happens when the user stops dragging the sheet.
onSnapEndCallback when a snap is completed.

[1.0.0] - 07/10/2019

  • Breaking changes, renamed parameters such as

    • sheet -> sheetBelow
    • remaining -> sheetAbove
    • grabing -> grabbing
    • grabingHeight -> grabbingHeight
    • remainingMargin -> sheetAboveMargin
    • snapSheetController -> snappingSheetController
  • The option to add negative and positive margin to the sheetBelow widget

  • The sheetBelow and sheetAbove widgets are now optional

[0.1.0] - 07/10/2019

  • Improve the snap system for the sheet. Now the sheet only snaps to above snap positions if dragging upwards and snap positions below if dragging downwards
  • Made the background widget (child) optional

[0.0.2] - 04/10/2019

  • Updated the pubspec description

[0.0.1] - 04/10/2019

  • The initial release

example/README.md

snapping_sheet example #

An example project how the snapping_sheet package can be used

Use this package as a library

1. Depend on it

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


dependencies:
  snapping_sheet: ^1.0.0

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:snapping_sheet/snapping_sheet.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
39
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]
69
Learn more about scoring.

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

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

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