Skip to content

Commit fe6e341

Browse files
committed
added scrollController
1 parent 77004ca commit fe6e341

File tree

8 files changed

+144
-76
lines changed

8 files changed

+144
-76
lines changed

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"cmake.sourceDirectory": "${workspaceFolder}/example/windows"
3+
}

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change log
22

3+
## 1.0.5
4+
5+
- added scrollController to get the current scroll position of the body
6+
37
## 1.0.4
48

59
- add physics to modify the ScrollPhysics to implement some cases of UI when developers need (by default still is BouncingScrollPhysics)

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ There are several options that allow for more control:
6262
|`alwaysShowLeadingAndAction`| This makes Leading and Action always visible. Default value is false. |
6363
|`headerBottomBar`| AppBar or toolBar like widget just above the body. |
6464
| `backgroundColor` | The color of the Material widget that underlies the entire DraggableHome body. |
65+
| `physics` | The physics property determines how the scroll view responds to user input, such as how it continues to animate after the user stops dragging the scroll view. |
66+
| `scrollController` | Used to control the position to which this scroll view is scrolled |
6567
| `curvedBodyRadius` | Creates a border top-left and top-right radius of body, Default radius of the body is 20.0. For no radius simply set the value to **0**.|
6668
| `fullyStretchable` | Allows toggling of fully expand draggability of the DraggableHome. Set this to true to allow the user to fully expand the header. |
6769
| `stretchTriggerOffset` | The offset of overscroll required to fully expand the header.|

example/lib/main.dart

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ class HomePage extends StatelessWidget {
3939
}
4040

4141
Row headerBottomBarWidget() {
42-
return Row(
42+
return const Row(
4343
mainAxisSize: MainAxisSize.max,
4444
mainAxisAlignment: MainAxisAlignment.end,
4545
crossAxisAlignment: CrossAxisAlignment.center,
46-
children: const [
46+
children: [
4747
Icon(
4848
Icons.settings,
4949
color: Colors.white,
@@ -60,7 +60,7 @@ class HomePage extends StatelessWidget {
6060
"Title",
6161
style: Theme.of(context)
6262
.textTheme
63-
.headline2!
63+
.displayMedium!
6464
.copyWith(color: Colors.white70),
6565
),
6666
),
@@ -80,7 +80,7 @@ class HomePage extends StatelessWidget {
8080
child: Text("$index"),
8181
),
8282
title: const Text("Title"),
83-
subtitle: const Text("Subtitile"),
83+
subtitle: const Text("Subtitle"),
8484
),
8585
),
8686
);

example/pubspec.lock

+65-36
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,48 @@ packages:
55
dependency: transitive
66
description:
77
name: async
8-
url: "https://pub.dartlang.org"
8+
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
9+
url: "https://pub.dev"
910
source: hosted
10-
version: "2.9.0"
11+
version: "2.11.0"
1112
boolean_selector:
1213
dependency: transitive
1314
description:
1415
name: boolean_selector
15-
url: "https://pub.dartlang.org"
16+
sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
17+
url: "https://pub.dev"
1618
source: hosted
17-
version: "2.1.0"
19+
version: "2.1.1"
1820
characters:
1921
dependency: transitive
2022
description:
2123
name: characters
22-
url: "https://pub.dartlang.org"
24+
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
25+
url: "https://pub.dev"
2326
source: hosted
24-
version: "1.2.1"
27+
version: "1.3.0"
2528
clock:
2629
dependency: transitive
2730
description:
2831
name: clock
29-
url: "https://pub.dartlang.org"
32+
sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
33+
url: "https://pub.dev"
3034
source: hosted
3135
version: "1.1.1"
3236
collection:
3337
dependency: transitive
3438
description:
3539
name: collection
36-
url: "https://pub.dartlang.org"
40+
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
41+
url: "https://pub.dev"
3742
source: hosted
38-
version: "1.16.0"
43+
version: "1.17.2"
3944
cupertino_icons:
4045
dependency: "direct main"
4146
description:
4247
name: cupertino_icons
43-
url: "https://pub.dartlang.org"
48+
sha256: "486b7bc707424572cdf7bd7e812a0c146de3fd47ecadf070254cc60383f21dd8"
49+
url: "https://pub.dev"
4450
source: hosted
4551
version: "1.0.3"
4652
draggable_home:
@@ -54,7 +60,8 @@ packages:
5460
dependency: transitive
5561
description:
5662
name: fake_async
57-
url: "https://pub.dartlang.org"
63+
sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
64+
url: "https://pub.dev"
5865
source: hosted
5966
version: "1.3.1"
6067
flutter:
@@ -66,7 +73,8 @@ packages:
6673
dependency: "direct dev"
6774
description:
6875
name: flutter_lints
69-
url: "https://pub.dartlang.org"
76+
sha256: b543301ad291598523947dc534aaddc5aaad597b709d2426d3a0e0d44c5cb493
77+
url: "https://pub.dev"
7078
source: hosted
7179
version: "1.0.4"
7280
flutter_test:
@@ -78,42 +86,48 @@ packages:
7886
dependency: transitive
7987
description:
8088
name: lints
81-
url: "https://pub.dartlang.org"
89+
sha256: a2c3d198cb5ea2e179926622d433331d8b58374ab8f29cdda6e863bd62fd369c
90+
url: "https://pub.dev"
8291
source: hosted
8392
version: "1.0.1"
8493
matcher:
8594
dependency: transitive
8695
description:
8796
name: matcher
88-
url: "https://pub.dartlang.org"
97+
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
98+
url: "https://pub.dev"
8999
source: hosted
90-
version: "0.12.12"
100+
version: "0.12.16"
91101
material_color_utilities:
92102
dependency: transitive
93103
description:
94104
name: material_color_utilities
95-
url: "https://pub.dartlang.org"
105+
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
106+
url: "https://pub.dev"
96107
source: hosted
97-
version: "0.1.5"
108+
version: "0.5.0"
98109
meta:
99110
dependency: transitive
100111
description:
101112
name: meta
102-
url: "https://pub.dartlang.org"
113+
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
114+
url: "https://pub.dev"
103115
source: hosted
104-
version: "1.8.0"
116+
version: "1.9.1"
105117
path:
106118
dependency: transitive
107119
description:
108120
name: path
109-
url: "https://pub.dartlang.org"
121+
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
122+
url: "https://pub.dev"
110123
source: hosted
111-
version: "1.8.2"
124+
version: "1.8.3"
112125
rxdart:
113126
dependency: transitive
114127
description:
115128
name: rxdart
116-
url: "https://pub.dartlang.org"
129+
sha256: "3f7cb435edd213ee1daea38026f2bd1cd5768f3f1b0fae0f6cd1c5380a091f90"
130+
url: "https://pub.dev"
117131
source: hosted
118132
version: "0.27.0"
119133
sky_engine:
@@ -125,51 +139,66 @@ packages:
125139
dependency: transitive
126140
description:
127141
name: source_span
128-
url: "https://pub.dartlang.org"
142+
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
143+
url: "https://pub.dev"
129144
source: hosted
130-
version: "1.9.0"
145+
version: "1.10.0"
131146
stack_trace:
132147
dependency: transitive
133148
description:
134149
name: stack_trace
135-
url: "https://pub.dartlang.org"
150+
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
151+
url: "https://pub.dev"
136152
source: hosted
137-
version: "1.10.0"
153+
version: "1.11.0"
138154
stream_channel:
139155
dependency: transitive
140156
description:
141157
name: stream_channel
142-
url: "https://pub.dartlang.org"
158+
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
159+
url: "https://pub.dev"
143160
source: hosted
144-
version: "2.1.0"
161+
version: "2.1.1"
145162
string_scanner:
146163
dependency: transitive
147164
description:
148165
name: string_scanner
149-
url: "https://pub.dartlang.org"
166+
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
167+
url: "https://pub.dev"
150168
source: hosted
151-
version: "1.1.1"
169+
version: "1.2.0"
152170
term_glyph:
153171
dependency: transitive
154172
description:
155173
name: term_glyph
156-
url: "https://pub.dartlang.org"
174+
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
175+
url: "https://pub.dev"
157176
source: hosted
158177
version: "1.2.1"
159178
test_api:
160179
dependency: transitive
161180
description:
162181
name: test_api
163-
url: "https://pub.dartlang.org"
182+
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
183+
url: "https://pub.dev"
164184
source: hosted
165-
version: "0.4.12"
185+
version: "0.6.0"
166186
vector_math:
167187
dependency: transitive
168188
description:
169189
name: vector_math
170-
url: "https://pub.dartlang.org"
190+
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
191+
url: "https://pub.dev"
192+
source: hosted
193+
version: "2.1.4"
194+
web:
195+
dependency: transitive
196+
description:
197+
name: web
198+
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
199+
url: "https://pub.dev"
171200
source: hosted
172-
version: "2.1.2"
201+
version: "0.1.4-beta"
173202
sdks:
174-
dart: ">=2.17.0-0 <3.0.0"
203+
dart: ">=3.1.0-185.0.dev <4.0.0"
175204
flutter: ">=1.17.0"

lib/draggable_home.dart

+2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,10 @@ class DraggableHome extends StatefulWidget {
8080
/// floatingActionButtonAnimator: Provider of animations to move the FloatingActionButton between FloatingActionButtonLocations.
8181
final FloatingActionButtonAnimator? floatingActionButtonAnimator;
8282

83+
/// physics: How the scroll view should respond to user input. For example, determines how the scroll view continues to animate after the user stops dragging the scroll view.
8384
final ScrollPhysics? physics;
8485

86+
/// scrollController: An object that can be used to control the position to which this scroll view is scrolled.
8587
final ScrollController? scrollController;
8688

8789
/// This will create DraggableHome.

0 commit comments

Comments
 (0)