Skip to content

Commit e9fab3c

Browse files
committed
Deprecate leadingGlowVisible and trailingGlowVisible arguments
1 parent 74ca65f commit e9fab3c

File tree

7 files changed

+32
-17
lines changed

7 files changed

+32
-17
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 1.1.0
1+
## 1.1.0-dev.1
22

33
- Fixes:
44
- Handle errors thrown from the `onRefresh` method.
@@ -13,6 +13,7 @@
1313
- The `IndicatorStateHelper` class is now deprecated in favor of `onStateChange` function and `IndicatorStateChange` class.
1414
- Initial support for programmatically-controlled indicators has been added. Added the `show`,` hide` and `refresh` methods to the` CustomRefreshIndicatorState` class. It can be accessed via GlobalKey. Take a look at an [programmatically-controlled screen example](/example/lib/screens/programmatically_controlled_indicator_screen.dart).
1515
- Use the `flutter_lints` package for analysis.
16+
- Deprecate `leadingGlowVisible` and `trailingGlowVisible` in favor of `leadingScrollIndicatorVisible` and `trailingScrollIndicatorVisible` arguments.
1617

1718
## 1.0.0
1819

example/lib/indicators/warp_indicator.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ class _WarpIndicatorState extends State<WarpIndicator>
120120
key: widget.indicatorKey,
121121
controller: widget.controller,
122122
offsetToArmed: _indicatorSize,
123-
leadingGlowVisible: false,
124-
trailingGlowVisible: false,
123+
leadingScrollIndicatorVisible: false,
124+
trailingScrollIndicatorVisible: false,
125125
onRefresh: widget.onRefresh,
126126
onStateChanged: (change) {
127127
if (change.didChange(to: IndicatorState.loading)) {

example/lib/screens/example_indicator_screen.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ class ExampleIndicatorScreen extends StatelessWidget {
1616
appBar: const ExampleAppBar(),
1717
body: SafeArea(
1818
child: CustomRefreshIndicator(
19-
leadingGlowVisible: false,
19+
leadingScrollIndicatorVisible: false,
20+
trailingScrollIndicatorVisible: false,
2021
offsetToArmed: 200.0,
21-
trailingGlowVisible: false,
2222
builder: customIndicator.builder,
2323
onRefresh: () => Future.delayed(const Duration(seconds: 2)),
2424
child: const ExampleList(),

example/lib/screens/presentation_screen.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ class _PresentationScreenState extends State<PresentationScreen> {
2727
loadingToIdleDuration: const Duration(seconds: 1),
2828
armedToLoadingDuration: const Duration(seconds: 1),
2929
draggingToIdleDuration: const Duration(seconds: 1),
30-
leadingGlowVisible: false,
31-
trailingGlowVisible: false,
30+
leadingScrollIndicatorVisible: false,
31+
trailingScrollIndicatorVisible: false,
3232
offsetToArmed: 100.0,
3333
controller: _controller,
3434
onRefresh: () => Future.delayed(const Duration(seconds: 2)),

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ packages:
4949
path: ".."
5050
relative: true
5151
source: path
52-
version: "1.1.0"
52+
version: "1.1.0-dev.1"
5353
fake_async:
5454
dependency: transitive
5555
description:

lib/src/custom_refresh_indicator.dart

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ class CustomRefreshIndicator extends StatefulWidget {
3838
final ScrollNotificationPredicate notificationPredicate;
3939

4040
/// Whether to display leading glow
41-
final bool leadingGlowVisible;
41+
final bool leadingScrollIndicatorVisible;
4242

4343
/// Whether to display trailing glow
44-
final bool trailingGlowVisible;
44+
final bool trailingScrollIndicatorVisible;
4545

4646
/// Number of pixels that user should drag to change [IndicatorState] from idle to armed.
4747
final double? offsetToArmed;
@@ -98,13 +98,21 @@ class CustomRefreshIndicator extends StatefulWidget {
9898
this.armedToLoadingDuration = const Duration(milliseconds: 200),
9999
this.loadingToIdleDuration = const Duration(milliseconds: 100),
100100
this.completeStateDuration,
101-
this.leadingGlowVisible = false,
102-
this.trailingGlowVisible = true,
101+
@Deprecated('Deprecated in favor of leadingScrollIndicatorVisible argument.')
102+
bool leadingGlowVisible = false,
103+
@Deprecated('Deprecated in favor of trailingScrollIndicatorVisible argument.')
104+
bool trailingGlowVisible = true,
105+
bool? leadingScrollIndicatorVisible,
106+
bool? trailingScrollIndicatorVisible,
103107
}) : assert(
104108
extentPercentageToArmed == null || offsetToArmed == null,
105109
'Providing `extentPercentageToArmed` argument take no effect when `offsetToArmed` is provided. '
106110
'Remove redundant argument.',
107111
),
112+
leadingScrollIndicatorVisible =
113+
leadingScrollIndicatorVisible ?? leadingGlowVisible,
114+
trailingScrollIndicatorVisible =
115+
trailingScrollIndicatorVisible ?? trailingGlowVisible,
108116
super(key: key);
109117

110118
@override
@@ -171,12 +179,18 @@ class CustomRefreshIndicatorState extends State<CustomRefreshIndicator>
171179
void _updateCustomRefreshIndicatorValue() =>
172180
_customRefreshIndicatorController.setValue(_animationController.value);
173181

174-
bool _handleGlowNotification(OverscrollIndicatorNotification notification) {
182+
bool _handleScrollIndicatorNotification(
183+
OverscrollIndicatorNotification notification,
184+
) {
175185
if (notification.depth != 0) return false;
176186
if (notification.leading) {
177-
if (!widget.leadingGlowVisible) notification.disallowIndicator();
187+
if (!widget.leadingScrollIndicatorVisible) {
188+
notification.disallowIndicator();
189+
}
178190
} else {
179-
if (!widget.trailingGlowVisible) notification.disallowIndicator();
191+
if (!widget.trailingScrollIndicatorVisible) {
192+
notification.disallowIndicator();
193+
}
180194
}
181195
return true;
182196
}
@@ -418,7 +432,7 @@ class CustomRefreshIndicatorState extends State<CustomRefreshIndicator>
418432
NotificationListener<ScrollNotification>(
419433
onNotification: _handleScrollNotification,
420434
child: NotificationListener<OverscrollIndicatorNotification>(
421-
onNotification: _handleGlowNotification,
435+
onNotification: _handleScrollIndicatorNotification,
422436
child: widget.child,
423437
),
424438
),

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: custom_refresh_indicator
22
description: Flutter Widget that make it easy to implement custom refresh indicator.
3-
version: 1.1.0
3+
version: 1.1.0-dev.1
44
repository: https://github.com/gonuit/flutter-custom-refresh-indicator
55
issue_tracker: https://github.com/gonuit/flutter-custom-refresh-indicator/issues
66
homepage: https://github.com/gonuit/flutter-custom-refresh-indicator

0 commit comments

Comments
 (0)