flutter-bottom-sheet icon indicating copy to clipboard operation
flutter-bottom-sheet copied to clipboard

Support for Slivers with Multiple Box Children

Open NM4ik opened this issue 1 year ago • 0 comments

Checklist

  • [x] Have you added an explanation of what your changes do and why you'd like us to include them?
  • [ ] Is there an existing issue for this PR?
    • link issue here (use keywords like fix, close, resolve etc. if necessary)
  • [x] Have the files been linted and formatted?
  • [x] Have the docs been updated to match the changes in the PR?
  • [ ] Have the tests been updated to match the changes in the PR?
  • [x] Attached videos/screenshots demonstrating the fix/feature.
  • [x] Have you run the tests locally to confirm they pass?

New Features

Adding the ability to use slivers that support or have multiple children instead of a list of children, such as SliverGrid, SliverList, SliverFixedExtentList.

What new capabilities does this PR add?

  1. Changing the return value of FlexibleDraggableScrollableWidgetBodyBuilder from SliverChildDelegate to SliverMultiBoxAdaptorWidget
  2. Adding EdgeInsets? bodyPadding for adjusting the outer padding of the bodyBuilder.
    /// [bodyPadding] padding for content's builder.
    

Code example:

bodyPadding: const EdgeInsets.all(30),
bodyBuilder: (_, offset) {
  return SliverGrid(
    delegate: SliverChildBuilderDelegate(
      childCount: 10,
      (context, index) {
        return Container(color: Colors.blue);
      },
    ),
    gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
      crossAxisCount: 2,
      mainAxisSpacing: 10,
      crossAxisSpacing: 10,
      childAspectRatio: 1,
    ),
  );
},

Media examples:

What docs changes are needed to explain this?

I added comments for bodyPadding. Updated readme.md and example for "Sticky BottomSheet"

Thank you for your attention!

NM4ik avatar Jul 19 '24 09:07 NM4ik