change drag bar and animation position
parent
3c80049192
commit
8cbc82182e
|
|
@ -403,6 +403,10 @@ class _AssetViewerState extends ConsumerState<AssetViewer> {
|
|||
if (dragInProgress) {
|
||||
blockGestures = true;
|
||||
}
|
||||
// Jump to a lower position before starting close animation to prevent glitch
|
||||
if (bottomSheetController.isAttached) {
|
||||
bottomSheetController.jumpTo(0.45);
|
||||
}
|
||||
sheetCloseController?.close();
|
||||
}
|
||||
|
||||
|
|
@ -480,7 +484,10 @@ class _AssetViewerState extends ConsumerState<AssetViewer> {
|
|||
previousExtent = _kBottomSheetMinimumExtent;
|
||||
sheetCloseController = showBottomSheet(
|
||||
context: ctx,
|
||||
sheetAnimationStyle: const AnimationStyle(duration: Durations.short4, reverseDuration: Durations.short2),
|
||||
sheetAnimationStyle: const AnimationStyle(
|
||||
duration: Durations.short4,
|
||||
reverseDuration: Duration(milliseconds: 200),
|
||||
),
|
||||
constraints: const BoxConstraints(maxWidth: double.infinity),
|
||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(20.0))),
|
||||
backgroundColor: ctx.colorScheme.surfaceContainerLowest,
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ class _BaseDraggableScrollableSheetState extends ConsumerState<BaseBottomSheet>
|
|||
child: CustomScrollView(
|
||||
controller: scrollController,
|
||||
slivers: [
|
||||
const SliverPersistentHeader(delegate: _DragHandleDelegate(), pinned: true),
|
||||
const SliverToBoxAdapter(child: _DragHandle()),
|
||||
if (widget.actions.isNotEmpty)
|
||||
SliverToBoxAdapter(
|
||||
child: Column(
|
||||
|
|
@ -108,31 +108,13 @@ class _BaseDraggableScrollableSheetState extends ConsumerState<BaseBottomSheet>
|
|||
}
|
||||
}
|
||||
|
||||
class _DragHandleDelegate extends SliverPersistentHeaderDelegate {
|
||||
const _DragHandleDelegate();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) {
|
||||
return const _DragHandle();
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldRebuild(_DragHandleDelegate oldDelegate) => false;
|
||||
|
||||
@override
|
||||
double get minExtent => 50.0;
|
||||
|
||||
@override
|
||||
double get maxExtent => 50.0;
|
||||
}
|
||||
|
||||
class _DragHandle extends StatelessWidget {
|
||||
const _DragHandle();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
height: 50,
|
||||
height: 32,
|
||||
child: Center(
|
||||
child: SizedBox(
|
||||
width: 32,
|
||||
|
|
|
|||
Loading…
Reference in New Issue