snapping_sheet 2.0.1

Flutter Android iOS web

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

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: SnappingSheetContent(
                        child: Container(
                            color: Colors.red,
                        ),
                        heightBehavior: SnappingSheetHeight.fit()),
                    ),
                    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)
            ),
        ],
    )

Sheet content #

SnappingSheetContentDescription
childThe widget inside the sheet.
marginThe margin for the sheet, can be negative
draggableIf the sheet should listen for drag events.
heightBehaviorHow the sheet height should behave when the size is changing

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.
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.
44
likes
110
pub points
88%
popularity

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

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

adamsmajl@gmail.com

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on snapping_sheet