snapping_sheet 1.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 89

Snapping sheet #

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

Using a ListView in
sheetBelow
Example using only
placeholders
Using a ListView in
sheetAbove

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 snapPositions 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.
lockOverflowDragPrevents the grabbing sheet to be dragged above the highest snapPosition or below the lowest snapPosition.

[1.1.1] - 12/11/2019

  • Fix a dragging bug where the grabbing widget is stuck when lockOverflowDrag was set to true

[1.1.0] - 29/10/2019

  • Added the option to make sheetBelow and sheetAbove widget draggable.
  • Added the option to lock overflow drag.
  • Added new example of using a top sheet.
  • Fix minor bugs with the snapping system.

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

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

  • Dart: 2.7.0
  • pana: 0.13.4
  • Flutter: 1.12.13+hotfix.5

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.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test