Skip to content

Commit 77004ca

Browse files
authored
Merge pull request #21 from AHED200/scroll_controller
Add ScrollController property
2 parents ec8c4b6 + 909c524 commit 77004ca

File tree

1 file changed

+32
-28
lines changed

1 file changed

+32
-28
lines changed

lib/draggable_home.dart

+32-28
Original file line numberDiff line numberDiff line change
@@ -82,35 +82,38 @@ class DraggableHome extends StatefulWidget {
8282

8383
final ScrollPhysics? physics;
8484

85+
final ScrollController? scrollController;
86+
8587
/// This will create DraggableHome.
86-
const DraggableHome(
87-
{Key? key,
88-
this.leading,
89-
required this.title,
90-
this.centerTitle = true,
91-
this.actions,
92-
this.alwaysShowLeadingAndAction = false,
93-
this.alwaysShowTitle = false,
94-
this.headerExpandedHeight = 0.35,
95-
required this.headerWidget,
96-
this.headerBottomBar,
97-
this.backgroundColor,
98-
this.appBarColor,
99-
this.curvedBodyRadius = 20,
100-
required this.body,
101-
this.drawer,
102-
this.fullyStretchable = false,
103-
this.stretchTriggerOffset = 200,
104-
this.expandedBody,
105-
this.stretchMaxHeight = 0.9,
106-
this.bottomSheet,
107-
this.bottomNavigationBarHeight = kBottomNavigationBarHeight,
108-
this.bottomNavigationBar,
109-
this.floatingActionButton,
110-
this.floatingActionButtonLocation,
111-
this.floatingActionButtonAnimator,
112-
this.physics})
113-
: assert(headerExpandedHeight > 0.0 &&
88+
const DraggableHome({
89+
Key? key,
90+
this.leading,
91+
required this.title,
92+
this.centerTitle = true,
93+
this.actions,
94+
this.alwaysShowLeadingAndAction = false,
95+
this.alwaysShowTitle = false,
96+
this.headerExpandedHeight = 0.35,
97+
required this.headerWidget,
98+
this.headerBottomBar,
99+
this.backgroundColor,
100+
this.appBarColor,
101+
this.curvedBodyRadius = 20,
102+
required this.body,
103+
this.drawer,
104+
this.fullyStretchable = false,
105+
this.stretchTriggerOffset = 200,
106+
this.expandedBody,
107+
this.stretchMaxHeight = 0.9,
108+
this.bottomSheet,
109+
this.bottomNavigationBarHeight = kBottomNavigationBarHeight,
110+
this.bottomNavigationBar,
111+
this.floatingActionButton,
112+
this.floatingActionButtonLocation,
113+
this.floatingActionButtonAnimator,
114+
this.physics,
115+
this.scrollController,
116+
}) : assert(headerExpandedHeight > 0.0 &&
114117
headerExpandedHeight < stretchMaxHeight),
115118
assert(
116119
(stretchMaxHeight > headerExpandedHeight) && (stretchMaxHeight < .95),
@@ -186,6 +189,7 @@ class _DraggableHomeState extends State<DraggableHome> {
186189
) {
187190
return CustomScrollView(
188191
physics: widget.physics ?? const BouncingScrollPhysics(),
192+
controller: widget.scrollController,
189193
slivers: [
190194
StreamBuilder<List<bool>>(
191195
stream: CombineLatestStream.list<bool>([

0 commit comments

Comments
 (0)