Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ScrollController property #21

Merged
merged 1 commit into from
Sep 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 32 additions & 28 deletions lib/draggable_home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -186,6 +189,7 @@ class _DraggableHomeState extends State<DraggableHome> {
) {
return CustomScrollView(
physics: widget.physics ?? const BouncingScrollPhysics(),
controller: widget.scrollController,
slivers: [
StreamBuilder<List<bool>>(
stream: CombineLatestStream.list<bool>([
Expand Down
Loading