snapping_sheet icon indicating copy to clipboard operation
snapping_sheet copied to clipboard

Allow constraining sheet content to the maximum expanded sheet size

Open hacker1024 opened this issue 4 years ago • 5 comments

This PR adds a constrainToVisibleArea field to SheetSizeFill. When this field is set to false, the SnappingSheetContent with the behaviour will constrain its child to the constrains of the sheet in its completely expanded form.

This allows non-scrolling content to slide up, as the sheet will truly slide up instead of expand.

hacker1024 avatar Apr 10 '21 14:04 hacker1024

Any thoughts on this?

hacker1024 avatar Jul 02 '21 04:07 hacker1024

@hacker1024 Hi, sorry for the late reply. I usually use SheetSizeFill and the Stack widget as a child to make the sheet content behave as when constrainToVisibleArea is set to false in your PR. For example:

sheetBelow: SnappingSheetContent(
  child: Stack(
    alignment: Alignment.topCenter,
    children: [
      Container(
        height: 200,
        color: Colors.red,
      )
    ],
  ),
),

However, your PR would make it easier for developers to create this behavior without needing to fiddle with the Stack Widget. If you feel up to it, could you add support for the new horizontal positions? I guess the only thing that needed to be edited is the following section:

      alignment: location == SheetLocation.above
          ? Alignment.bottomCenter
          : Alignment.topCenter,

AdamJonsson avatar Jul 06 '21 18:07 AdamJonsson

I'm not too familiar with the new horizontal features. What needs to change?

hacker1024 avatar Jul 07 '21 05:07 hacker1024

@AdamJonsson?

hacker1024 avatar Aug 10 '21 10:08 hacker1024

I solve this with the positionFactor. this is the code
SnappingPosition.factor( positionFactor: 0.95, grabbingContentOffset: GrabbingContentOffset.top),

Junama avatar Dec 09 '21 23:12 Junama