forked from tchigher/sliding-sheet
-
Notifications
You must be signed in to change notification settings - Fork 6
Closed
Description
Description
The snapping behavior becomes inconsistent and unreliable when using the SlidingSheet widget with an initialSnap value other than 1.0.
| initialSnap: 1.0 | initialSnap: 0.3 (or any) |
|---|---|
![]() |
![]() |
Steps to Reproduce:
- Create a
SlidingSheetwidget with two or more snap positions defined. - Set the
initialSnapparameter to a value other than 1.0 (e.g., 0.5). - Run the app and try to drag the sheet to different snap positions.
- see the snapping behaviour is now broken.
Expected Behavior:
The sheet should snap correctly to the defined snap positions regardless of the initialSnap value.
Actual Behavior:
The sheet fails to snap properly to the defined positions when the initialSnap value is not 1.0. It may get stuck between positions or fail to reach certain snap points.
Additional Information:
- Flutter version:
3.13.9 - wtf_sliding_sheet:
1.1.2
Sheet setup
SlidingSheet(
controller: controller,
openDuration: const Duration(milliseconds: 500),
snapSpec: SnapSpec(
snap: true,
initialSnap: .3,
positioning: SnapPositioning.relativeToSheetHeight,
snappings: <double>[.3, 1],
),
color: Colors.white70,
elevation: 10,
cornerRadius: 16,
cornerRadiusOnFullscreen: 16.0,
closeOnBackdropTap: true,
closeOnBackButtonPressed: true,
addTopViewPaddingOnFullscreen: false,
isBackdropInteractable: false,
parallaxSpec: const ParallaxSpec(
enabled: true,
amount: 0.35,
endExtent: 0.5,
),
liftOnScrollHeaderElevation: 12.0,
liftOnScrollFooterElevation: 0.0,
builder: (BuildContext context, SheetState state) {
return Container(
height: 900,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: const <Widget>[
Text('This is the content of the sheet'),
Text('This is the content of the sheet'),
Text('This is the content of the sheet'),
Text('This is the content of the sheet'),
],
),
),
);
},
)Full Code sample
import 'package:flutter/material.dart';
import 'package:wtf_sliding_sheet/wtf_sliding_sheet.dart';
class HomePage extends StatefulWidget {
const HomePage({Key? key}) : super(key: key);
@override
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
final SheetController controller = SheetController();
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(children: <Widget>[
Container(
color: Colors.blueGrey,
child: Center(
child: Text('Home Widget'),
),
),
Align(
alignment: Alignment.bottomCenter,
child: SafeArea(
child: SlidingSheet(
controller: controller,
openDuration: const Duration(milliseconds: 500),
snapSpec: SnapSpec(
snap: true,
initialSnap: .3,
positioning: SnapPositioning.relativeToSheetHeight,
snappings: <double>[.3, 1],
),
color: Colors.white70,
elevation: 10,
cornerRadius: 16,
cornerRadiusOnFullscreen: 16.0,
closeOnBackdropTap: true,
closeOnBackButtonPressed: true,
addTopViewPaddingOnFullscreen: false,
isBackdropInteractable: false,
parallaxSpec: const ParallaxSpec(
enabled: true,
amount: 0.35,
endExtent: 0.5,
),
liftOnScrollHeaderElevation: 12.0,
liftOnScrollFooterElevation: 0.0,
builder: (BuildContext context, SheetState state) {
return Container(
height: 900,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: const <Widget>[
Text('This is the content of the sheet'),
Text('This is the content of the sheet'),
Text('This is the content of the sheet'),
Text('This is the content of the sheet'),
],
),
),
);
},
),
))
]),
);
}
}Metadata
Metadata
Assignees
Labels
No labels

