From 909c524df2ba2924ca3d14d633f8be3eb1b008b7 Mon Sep 17 00:00:00 2001 From: AHED200 Date: Mon, 18 Sep 2023 20:18:41 +0300 Subject: [PATCH] Add ScrollController property --- lib/draggable_home.dart | 60 ++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/lib/draggable_home.dart b/lib/draggable_home.dart index 581b9aa..233ac81 100644 --- a/lib/draggable_home.dart +++ b/lib/draggable_home.dart @@ -82,35 +82,38 @@ class DraggableHome extends StatefulWidget { final ScrollPhysics? physics; + final ScrollController? scrollController; + /// This will create DraggableHome. - const DraggableHome( - {Key? key, - this.leading, - required this.title, - this.centerTitle = true, - this.actions, - this.alwaysShowLeadingAndAction = false, - this.alwaysShowTitle = false, - this.headerExpandedHeight = 0.35, - required this.headerWidget, - this.headerBottomBar, - this.backgroundColor, - this.appBarColor, - this.curvedBodyRadius = 20, - required this.body, - this.drawer, - this.fullyStretchable = false, - this.stretchTriggerOffset = 200, - this.expandedBody, - this.stretchMaxHeight = 0.9, - this.bottomSheet, - this.bottomNavigationBarHeight = kBottomNavigationBarHeight, - this.bottomNavigationBar, - this.floatingActionButton, - this.floatingActionButtonLocation, - this.floatingActionButtonAnimator, - this.physics}) - : assert(headerExpandedHeight > 0.0 && + const DraggableHome({ + Key? key, + this.leading, + required this.title, + this.centerTitle = true, + this.actions, + this.alwaysShowLeadingAndAction = false, + this.alwaysShowTitle = false, + this.headerExpandedHeight = 0.35, + required this.headerWidget, + this.headerBottomBar, + this.backgroundColor, + this.appBarColor, + this.curvedBodyRadius = 20, + required this.body, + this.drawer, + this.fullyStretchable = false, + this.stretchTriggerOffset = 200, + this.expandedBody, + this.stretchMaxHeight = 0.9, + this.bottomSheet, + this.bottomNavigationBarHeight = kBottomNavigationBarHeight, + this.bottomNavigationBar, + this.floatingActionButton, + this.floatingActionButtonLocation, + this.floatingActionButtonAnimator, + this.physics, + this.scrollController, + }) : assert(headerExpandedHeight > 0.0 && headerExpandedHeight < stretchMaxHeight), assert( (stretchMaxHeight > headerExpandedHeight) && (stretchMaxHeight < .95), @@ -186,6 +189,7 @@ class _DraggableHomeState extends State { ) { return CustomScrollView( physics: widget.physics ?? const BouncingScrollPhysics(), + controller: widget.scrollController, slivers: [ StreamBuilder>( stream: CombineLatestStream.list([