snapping sheet
a package that provides a highly customizable sheet widget that snaps to different vertical positions.
example using only placeholders | example using 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
name | description |
---|---|
child | the widget behind the sheet. |
sheetbelow | the widget that is the remaining space between the bottom to the bottom of the grabbing widget. |
sheetabove | the widget that is the remaining space between the top to the top of the grabbing widget |
grabbing | the widget fixed between the sheetbelow and sheetabove. |
grabbingheight | the height of the grabbing widget. |
sheetbelowmargin | the margin for the sheetbelow widget. can be negative values. |
sheetabovemargin | the margin for the sheetabove widget. can be negative values. |
snappositions | the different snap positions for the sheet |
initsnapposition | the init snap position, do not need to exist in the snappositions list |
snappingsheetcontroller | control the sheet and get current snap position |
onmove | callback when the sheet is moving. |
onsnapbegin | callback when a snap begins, happens when the user stops dragging the sheet. |
onsnapend | callback when a snap is completed. |
Comments are closed.