jamesblasco / modal_bottom_sheet

Flutter | Create advanced modal bottom sheets. Material, Cupertino or your own style
https://pub.dev/packages/modal_bottom_sheet
MIT License
1.83k stars 461 forks source link

Resizable "sheet" uses minResizableExtent as max height. #410

Open apackin opened 1 week ago

apackin commented 1 week ago

Description

The only way to get a resizeable sheet to extend larger than minResizableExtent is by passing in a larger initialExtent. Once the sheet is resized smaller than minResizableExtent, it can no longer be extended back to a larger size, even if they one is included as maxExtent or initialExtent.

Steps to Reproduce

  1. Create a resizable bottom sheet with the following properties:
    • maxExtent/initialExtent greater than minResizableExtent (e.g., maxExtent and initialExtent of 800 with minResizableExtent of 500).
    • Define maxExtent to a value greater than initialExtent (e.g., 800).
  2. Resize the sheet down to or below the minResizableExtent.
  3. Try to resize the sheet back up to the maxExtent.

Expected Behavior

The bottom sheet should allow expanding to the maxExtent after being resized down below the minResizableExtent.

Actual Behavior

The bottom sheet gets stuck at the minResizableExtent and does not expand back to the maxExtent.

Code Sample

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

class PingFriendProfileViewSheet extends StatelessWidget {  
  const PingFriendProfileViewSheet({  
    required this.userId,  
    required this.initialExtent,  
    required this.minExtent,  
    required this.maxExtent,  
    super.key,  
    this.pop,  
    this.sheetController,  
  });

  final String userId;  
  final VoidCallback? pop;  
  final SheetController? sheetController;  
  final double initialExtent;  
  final double minExtent;  
  final double maxExtent;

  @override  
  Widget build(BuildContext context) {  
    return Sheet(  
      controller: sheetController,  
      minExtent: 200,  
      maxExtent: 800,  
      initialExtent: 800,  
      backgroundColor: Colors.transparent,  
      physics: const SnapSheetPhysics(  
        stops: [200, 500, 800],  
        relative: false,  
      ),  
      resizable: true,  
      minResizableExtent: 500,  
      child: const Column(  
        children: [  
          Expanded(  
            child: ColoredBox(  
              color: Colors.orange,  
              child: Text(  
                'Expanded should be able to grow back to maxExtent',  
              ),  
            ),  
          ),  
        ],  
      ),  
    );  
  }  
}

Video Demonstration

https://github.com/jamesblasco/modal_bottom_sheet/assets/10517945/a84f7321-ad8e-47b3-ad46-22eda60c2d54

Also not that jank while scrolling in sizes larger than minResizableExtent

Environment Information