Replies: 5 comments 3 replies
-
|
I've recently discovered this package and I really like it. Looks promising, congrats @fujidaiti! I think the overscroll behavior could get some tweaking, especially the iOS 15 style. When the screen gets pulled up, I don't think it's a matter of giving the background a color, instead the physics could "attach" to the bottom to prevent showing the parent screen. Also, Apple's implementation of overscroll at the top is much more limited. It doesn't get passed the top safe area. |
Beta Was this translation helpful? Give feedback.
-
|
Here's what Ive done so far, and it seems to work, although it feels horribly wrong and hacky. Fake it till you make it.... I wrapped my |
Beta Was this translation helpful? Give feedback.
-
|
Hi @mark8044, Unfortunately, there is no standard API for creating a cover or something like a "skirt" at the bottom of a sheet to hide the content behind it.
I think this could be a workaround. Another option is to use This approach should work regardless of the maximum height of the sheet. import 'package:flutter/material.dart';
import 'package:smooth_sheets/smooth_sheets.dart';
void main() {
runApp(const _SheetWithSkirtExample());
}
class _SheetWithSkirtExample extends StatelessWidget {
const _SheetWithSkirtExample();
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Builder(
builder: (context) {
return Scaffold(
body: Center(
child: ElevatedButton(
onPressed: () {
_ModalSheet.show(context);
},
child: const Text('Show Sheet'),
),
),
);
},
),
);
}
}
class _ModalSheet extends StatelessWidget {
const _ModalSheet();
static void show(BuildContext context) {
Navigator.push(
context,
ModalSheetRoute(
swipeDismissible: true,
builder: (_) => const _ModalSheet(),
),
);
}
@override
Widget build(BuildContext context) {
// Primary layer, the main content (red).
final primaryLayer = SheetContentScaffold(
backgroundColor: Colors.red,
body: ListView.builder(
itemCount: 30,
itemBuilder: (context, index) {
return ListTile(
title: Text('Item $index'),
);
},
),
);
// Secondary layer (green). This layer has a greater height than
// the primary layer, so that it can hide the background content
// even if the sheet is dragged beyond the screen boundaries.
final secondaryLayer = OverflowBox(
// Align the top edges of the primary and secondary layers.
alignment: Alignment.topCenter,
minHeight: 1000, // Specify a greater value than the primary layer's height
maxHeight: 1000,
child: Container(
width: double.infinity,
height: double.infinity,
color: Colors.green,
),
);
return SafeArea(
bottom: false,
child: ScrollableSheet(
// Stack the scaffold on top of the OverflowBox.
child: Stack(
children: [
secondaryLayer,
primaryLayer,
],
),
),
);
}
}RocketSim_Recording_iPhone_15_6.1_2024-06-05_03.59.19.mp4 |
Beta Was this translation helpful? Give feedback.
-
|
Hi @habibasseiss,
Thanks for the suggestion! I agree with this idea and so I will add an option to // Not working in the current version
DraggableSheet(
physics: StretchingSheetPhysics(
// This disables the stretching effect when overdragging upward
direction: StretchingBehaviorDIrection.downward,
),
); |
Beta Was this translation helpful? Give feedback.
-
|
As of v0.11.0, we can now use Sheet(
decoration: MaterialSheetDecoration(
size: SheetSize.stretch,
...,
),
); |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
First, Im liking what I see with this package. It seems to be moving the ball forward in the world of sheets and its appreciated.
In the basic examples (and in my own implementation) when the user pulls the sheet up, you can see the content behind the sheet which is quite ugly. For example, I am using ScrollableSheet:
Is there an easy (or proper) way to give the whole sheet a background color so that when being pulled up it will not reveal what is underneath.
The AI generator example video shows this effect:
Beta Was this translation helpful? Give feedback.
All reactions