File tree Expand file tree Collapse file tree 12 files changed +130
-106
lines changed Expand file tree Collapse file tree 12 files changed +130
-106
lines changed Original file line number Diff line number Diff line change @@ -44,10 +44,12 @@ class CheckMarkIndicator extends StatefulWidget {
44
44
final Widget child;
45
45
final CheckMarkStyle style;
46
46
final AsyncCallback onRefresh;
47
+ final IndicatorController ? controller;
47
48
48
49
const CheckMarkIndicator ({
49
50
super .key,
50
51
required this .child,
52
+ this .controller,
51
53
this .style = CheckMarkStyle .defaultStyle,
52
54
required this .onRefresh,
53
55
});
@@ -82,6 +84,7 @@ class _CheckMarkIndicatorState extends State<CheckMarkIndicator>
82
84
@override
83
85
Widget build (BuildContext context) {
84
86
return CustomMaterialIndicator (
87
+ controller: widget.controller,
85
88
onRefresh: _handleRefresh,
86
89
durations: const RefreshIndicatorDurations (
87
90
completeDuration: Duration (seconds: 2 ),
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ class EnvelopRefreshIndicator extends StatelessWidget {
7
7
final bool trailingScrollIndicatorVisible;
8
8
final RefreshCallback onRefresh;
9
9
final Color ? accent;
10
+ final IndicatorController ? controller;
10
11
11
12
static const _circleSize = 70.0 ;
12
13
@@ -22,12 +23,14 @@ class EnvelopRefreshIndicator extends StatelessWidget {
22
23
this .leadingScrollIndicatorVisible = false ,
23
24
this .trailingScrollIndicatorVisible = false ,
24
25
this .accent,
26
+ this .controller,
25
27
});
26
28
27
29
@override
28
30
Widget build (BuildContext context) {
29
31
final theme = Theme .of (context);
30
32
return CustomRefreshIndicator (
33
+ controller: controller,
31
34
leadingScrollIndicatorVisible: leadingScrollIndicatorVisible,
32
35
trailingScrollIndicatorVisible: trailingScrollIndicatorVisible,
33
36
builder: (context, child, controller) =>
Original file line number Diff line number Diff line change @@ -15,10 +15,12 @@ class ParallaxConfig {
15
15
16
16
class IceCreamIndicator extends StatefulWidget {
17
17
final Widget child;
18
+ final IndicatorController ? controller;
18
19
19
20
const IceCreamIndicator ({
20
21
super .key,
21
22
required this .child,
23
+ this .controller,
22
24
});
23
25
24
26
@override
@@ -99,6 +101,7 @@ class _IceCreamIndicatorState extends State<IceCreamIndicator>
99
101
@override
100
102
Widget build (BuildContext context) {
101
103
return CustomRefreshIndicator (
104
+ controller: widget.controller,
102
105
offsetToArmed: _indicatorSize,
103
106
onRefresh: () => Future .delayed (const Duration (seconds: 4 )),
104
107
autoRebuild: false ,
Original file line number Diff line number Diff line change @@ -35,9 +35,12 @@ class _Cloud {
35
35
36
36
class PlaneIndicator extends StatefulWidget {
37
37
final Widget child;
38
+ final IndicatorController ? controller;
39
+
38
40
const PlaneIndicator ({
39
41
super .key,
40
42
required this .child,
43
+ this .controller,
41
44
});
42
45
43
46
@override
@@ -188,6 +191,7 @@ class _PlaneIndicatorState extends State<PlaneIndicator>
188
191
);
189
192
return ClipRect (
190
193
child: CustomRefreshIndicator (
194
+ controller: widget.controller,
191
195
offsetToArmed: _offsetToArmed,
192
196
autoRebuild: false ,
193
197
durations: const RefreshIndicatorDurations (
Original file line number Diff line number Diff line change @@ -38,6 +38,9 @@ class _BallIndicatorScreenState extends State<BallIndicatorScreen> {
38
38
await Future .delayed (const Duration (seconds: 5 ));
39
39
},
40
40
child: ExampleList (
41
+ physics: AlwaysScrollableScrollPhysics (
42
+ parent: ClampingWithOverscrollPhysics (state: _controller),
43
+ ),
41
44
leading: Column (
42
45
children: [
43
46
const ListHelpBox (
Original file line number Diff line number Diff line change
1
+ import 'package:custom_refresh_indicator/custom_refresh_indicator.dart' ;
1
2
import 'package:example/indicators/check_mark_indicator.dart' ;
2
3
import 'package:example/widgets/example_app_bar.dart' ;
3
4
import 'package:example/widgets/example_list.dart' ;
@@ -12,6 +13,7 @@ class CheckMarkIndicatorScreen extends StatefulWidget {
12
13
}
13
14
14
15
class _CheckMarkIndicatorScreenState extends State <CheckMarkIndicatorScreen > {
16
+ final _controller = IndicatorController ();
15
17
bool _useError = false ;
16
18
@override
17
19
Widget build (BuildContext context) {
@@ -21,13 +23,17 @@ class _CheckMarkIndicatorScreenState extends State<CheckMarkIndicatorScreen> {
21
23
),
22
24
body: SafeArea (
23
25
child: CheckMarkIndicator (
26
+ controller: _controller,
24
27
onRefresh: () async {
25
28
await Future .delayed (const Duration (seconds: 2 ));
26
29
if (_useError) {
27
30
throw Exception ("Fake exception" );
28
31
}
29
32
},
30
33
child: ExampleList (
34
+ physics: AlwaysScrollableScrollPhysics (
35
+ parent: ClampingWithOverscrollPhysics (state: _controller),
36
+ ),
31
37
leading: Column (
32
38
children: [
33
39
const ListHelpBox (
Original file line number Diff line number Diff line change
1
+ import 'package:custom_refresh_indicator/custom_refresh_indicator.dart' ;
1
2
import 'package:example/indicators/envelope_indicator.dart' ;
2
3
import 'package:example/widgets/example_app_bar.dart' ;
3
4
import 'package:example/widgets/example_list.dart' ;
4
5
import 'package:flutter/material.dart' ;
5
6
6
- class EnvelopIndicatorScreen extends StatelessWidget {
7
+ class EnvelopIndicatorScreen extends StatefulWidget {
7
8
const EnvelopIndicatorScreen ({super .key});
8
9
10
+ @override
11
+ State <EnvelopIndicatorScreen > createState () => _EnvelopIndicatorScreenState ();
12
+ }
13
+
14
+ class _EnvelopIndicatorScreenState extends State <EnvelopIndicatorScreen > {
15
+ final _controller = IndicatorController ();
16
+
9
17
@override
10
18
Widget build (BuildContext context) {
11
19
return Scaffold (
12
20
appBar: const ExampleAppBar (
13
21
title: "Envelope indicator" ,
14
22
),
15
23
body: EnvelopRefreshIndicator (
24
+ controller: _controller,
16
25
onRefresh: () => Future <void >.delayed (const Duration (seconds: 2 )),
17
- child: const ExampleList (),
26
+ child: ExampleList (
27
+ physics: AlwaysScrollableScrollPhysics (
28
+ parent: ClampingWithOverscrollPhysics (state: _controller),
29
+ ),
30
+ ),
18
31
),
19
32
);
20
33
}
34
+
35
+ @override
36
+ void dispose () {
37
+ _controller.dispose ();
38
+ super .dispose ();
39
+ }
21
40
}
Original file line number Diff line number Diff line change
1
+ import 'package:custom_refresh_indicator/custom_refresh_indicator.dart' ;
1
2
import 'package:example/indicators/ice_cream_indicator.dart' ;
2
3
import 'package:example/widgets/example_app_bar.dart' ;
3
4
import 'package:example/widgets/example_list.dart' ;
@@ -12,15 +13,28 @@ class IceCreamIndicatorScreen extends StatefulWidget {
12
13
}
13
14
14
15
class _IceCreamIndicatorScreenState extends State <IceCreamIndicatorScreen > {
16
+ final _controller = IndicatorController ();
17
+
15
18
@override
16
19
Widget build (BuildContext context) {
17
- return const Scaffold (
18
- appBar: ExampleAppBar (),
20
+ return Scaffold (
21
+ appBar: const ExampleAppBar (),
19
22
body: SafeArea (
20
23
child: IceCreamIndicator (
21
- child: ExampleList (),
24
+ controller: _controller,
25
+ child: ExampleList (
26
+ physics: AlwaysScrollableScrollPhysics (
27
+ parent: ClampingWithOverscrollPhysics (state: _controller),
28
+ ),
29
+ ),
22
30
),
23
31
),
24
32
);
25
33
}
34
+
35
+ @override
36
+ void dispose () {
37
+ _controller.dispose ();
38
+ super .dispose ();
39
+ }
26
40
}
Original file line number Diff line number Diff line change
1
+ import 'package:custom_refresh_indicator/custom_refresh_indicator.dart' ;
1
2
import 'package:example/indicators/plane_indicator.dart' ;
2
3
import 'package:example/widgets/example_app_bar.dart' ;
3
4
import 'package:example/widgets/example_list.dart' ;
@@ -11,13 +12,25 @@ class PlaneIndicatorScreen extends StatefulWidget {
11
12
}
12
13
13
14
class _PlaneIndicatorScreenState extends State <PlaneIndicatorScreen > {
15
+ final _controller = IndicatorController ();
14
16
@override
15
17
Widget build (BuildContext context) {
16
- return const Scaffold (
17
- appBar: ExampleAppBar (),
18
+ return Scaffold (
19
+ appBar: const ExampleAppBar (),
18
20
body: PlaneIndicator (
19
- child: ExampleList (),
21
+ controller: _controller,
22
+ child: ExampleList (
23
+ physics: AlwaysScrollableScrollPhysics (
24
+ parent: ClampingWithOverscrollPhysics (state: _controller),
25
+ ),
26
+ ),
20
27
),
21
28
);
22
29
}
30
+
31
+ @override
32
+ void dispose () {
33
+ _controller.dispose ();
34
+ super .dispose ();
35
+ }
23
36
}
Original file line number Diff line number Diff line change
1
+ import 'package:custom_refresh_indicator/custom_refresh_indicator.dart' ;
1
2
import 'package:example/widgets/example_app_bar.dart' ;
2
3
import 'package:example/widgets/example_list.dart' ;
3
4
import 'package:flutter/material.dart' ;
@@ -12,16 +13,28 @@ class WarpIndicatorScreen extends StatefulWidget {
12
13
}
13
14
14
15
class _WarpIndicatorScreenState extends State <WarpIndicatorScreen > {
16
+ final _controller = IndicatorController ();
15
17
@override
16
18
Widget build (BuildContext context) {
17
19
return Scaffold (
18
20
appBar: const ExampleAppBar (),
19
21
body: SafeArea (
20
22
child: WarpIndicator (
23
+ controller: _controller,
21
24
onRefresh: () => Future .delayed (const Duration (seconds: 2 )),
22
- child: const ExampleList (),
25
+ child: ExampleList (
26
+ physics: AlwaysScrollableScrollPhysics (
27
+ parent: ClampingWithOverscrollPhysics (state: _controller),
28
+ ),
29
+ ),
23
30
),
24
31
),
25
32
);
26
33
}
34
+
35
+ @override
36
+ void dispose () {
37
+ _controller.dispose ();
38
+ super .dispose ();
39
+ }
27
40
}
You can’t perform that action at this time.
0 commit comments