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 {
4444 final Widget child;
4545 final CheckMarkStyle style;
4646 final AsyncCallback onRefresh;
47+ final IndicatorController ? controller;
4748
4849 const CheckMarkIndicator ({
4950 super .key,
5051 required this .child,
52+ this .controller,
5153 this .style = CheckMarkStyle .defaultStyle,
5254 required this .onRefresh,
5355 });
@@ -82,6 +84,7 @@ class _CheckMarkIndicatorState extends State<CheckMarkIndicator>
8284 @override
8385 Widget build (BuildContext context) {
8486 return CustomMaterialIndicator (
87+ controller: widget.controller,
8588 onRefresh: _handleRefresh,
8689 durations: const RefreshIndicatorDurations (
8790 completeDuration: Duration (seconds: 2 ),
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ class EnvelopRefreshIndicator extends StatelessWidget {
77 final bool trailingScrollIndicatorVisible;
88 final RefreshCallback onRefresh;
99 final Color ? accent;
10+ final IndicatorController ? controller;
1011
1112 static const _circleSize = 70.0 ;
1213
@@ -22,12 +23,14 @@ class EnvelopRefreshIndicator extends StatelessWidget {
2223 this .leadingScrollIndicatorVisible = false ,
2324 this .trailingScrollIndicatorVisible = false ,
2425 this .accent,
26+ this .controller,
2527 });
2628
2729 @override
2830 Widget build (BuildContext context) {
2931 final theme = Theme .of (context);
3032 return CustomRefreshIndicator (
33+ controller: controller,
3134 leadingScrollIndicatorVisible: leadingScrollIndicatorVisible,
3235 trailingScrollIndicatorVisible: trailingScrollIndicatorVisible,
3336 builder: (context, child, controller) =>
Original file line number Diff line number Diff line change @@ -15,10 +15,12 @@ class ParallaxConfig {
1515
1616class IceCreamIndicator extends StatefulWidget {
1717 final Widget child;
18+ final IndicatorController ? controller;
1819
1920 const IceCreamIndicator ({
2021 super .key,
2122 required this .child,
23+ this .controller,
2224 });
2325
2426 @override
@@ -99,6 +101,7 @@ class _IceCreamIndicatorState extends State<IceCreamIndicator>
99101 @override
100102 Widget build (BuildContext context) {
101103 return CustomRefreshIndicator (
104+ controller: widget.controller,
102105 offsetToArmed: _indicatorSize,
103106 onRefresh: () => Future .delayed (const Duration (seconds: 4 )),
104107 autoRebuild: false ,
Original file line number Diff line number Diff line change @@ -35,9 +35,12 @@ class _Cloud {
3535
3636class PlaneIndicator extends StatefulWidget {
3737 final Widget child;
38+ final IndicatorController ? controller;
39+
3840 const PlaneIndicator ({
3941 super .key,
4042 required this .child,
43+ this .controller,
4144 });
4245
4346 @override
@@ -188,6 +191,7 @@ class _PlaneIndicatorState extends State<PlaneIndicator>
188191 );
189192 return ClipRect (
190193 child: CustomRefreshIndicator (
194+ controller: widget.controller,
191195 offsetToArmed: _offsetToArmed,
192196 autoRebuild: false ,
193197 durations: const RefreshIndicatorDurations (
Original file line number Diff line number Diff line change @@ -38,6 +38,9 @@ class _BallIndicatorScreenState extends State<BallIndicatorScreen> {
3838 await Future .delayed (const Duration (seconds: 5 ));
3939 },
4040 child: ExampleList (
41+ physics: AlwaysScrollableScrollPhysics (
42+ parent: ClampingWithOverscrollPhysics (state: _controller),
43+ ),
4144 leading: Column (
4245 children: [
4346 const ListHelpBox (
Original file line number Diff line number Diff line change 1+ import 'package:custom_refresh_indicator/custom_refresh_indicator.dart' ;
12import 'package:example/indicators/check_mark_indicator.dart' ;
23import 'package:example/widgets/example_app_bar.dart' ;
34import 'package:example/widgets/example_list.dart' ;
@@ -12,6 +13,7 @@ class CheckMarkIndicatorScreen extends StatefulWidget {
1213}
1314
1415class _CheckMarkIndicatorScreenState extends State <CheckMarkIndicatorScreen > {
16+ final _controller = IndicatorController ();
1517 bool _useError = false ;
1618 @override
1719 Widget build (BuildContext context) {
@@ -21,13 +23,17 @@ class _CheckMarkIndicatorScreenState extends State<CheckMarkIndicatorScreen> {
2123 ),
2224 body: SafeArea (
2325 child: CheckMarkIndicator (
26+ controller: _controller,
2427 onRefresh: () async {
2528 await Future .delayed (const Duration (seconds: 2 ));
2629 if (_useError) {
2730 throw Exception ("Fake exception" );
2831 }
2932 },
3033 child: ExampleList (
34+ physics: AlwaysScrollableScrollPhysics (
35+ parent: ClampingWithOverscrollPhysics (state: _controller),
36+ ),
3137 leading: Column (
3238 children: [
3339 const ListHelpBox (
Original file line number Diff line number Diff line change 1+ import 'package:custom_refresh_indicator/custom_refresh_indicator.dart' ;
12import 'package:example/indicators/envelope_indicator.dart' ;
23import 'package:example/widgets/example_app_bar.dart' ;
34import 'package:example/widgets/example_list.dart' ;
45import 'package:flutter/material.dart' ;
56
6- class EnvelopIndicatorScreen extends StatelessWidget {
7+ class EnvelopIndicatorScreen extends StatefulWidget {
78 const EnvelopIndicatorScreen ({super .key});
89
10+ @override
11+ State <EnvelopIndicatorScreen > createState () => _EnvelopIndicatorScreenState ();
12+ }
13+
14+ class _EnvelopIndicatorScreenState extends State <EnvelopIndicatorScreen > {
15+ final _controller = IndicatorController ();
16+
917 @override
1018 Widget build (BuildContext context) {
1119 return Scaffold (
1220 appBar: const ExampleAppBar (
1321 title: "Envelope indicator" ,
1422 ),
1523 body: EnvelopRefreshIndicator (
24+ controller: _controller,
1625 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+ ),
1831 ),
1932 );
2033 }
34+
35+ @override
36+ void dispose () {
37+ _controller.dispose ();
38+ super .dispose ();
39+ }
2140}
Original file line number Diff line number Diff line change 1+ import 'package:custom_refresh_indicator/custom_refresh_indicator.dart' ;
12import 'package:example/indicators/ice_cream_indicator.dart' ;
23import 'package:example/widgets/example_app_bar.dart' ;
34import 'package:example/widgets/example_list.dart' ;
@@ -12,15 +13,28 @@ class IceCreamIndicatorScreen extends StatefulWidget {
1213}
1314
1415class _IceCreamIndicatorScreenState extends State <IceCreamIndicatorScreen > {
16+ final _controller = IndicatorController ();
17+
1518 @override
1619 Widget build (BuildContext context) {
17- return const Scaffold (
18- appBar: ExampleAppBar (),
20+ return Scaffold (
21+ appBar: const ExampleAppBar (),
1922 body: SafeArea (
2023 child: IceCreamIndicator (
21- child: ExampleList (),
24+ controller: _controller,
25+ child: ExampleList (
26+ physics: AlwaysScrollableScrollPhysics (
27+ parent: ClampingWithOverscrollPhysics (state: _controller),
28+ ),
29+ ),
2230 ),
2331 ),
2432 );
2533 }
34+
35+ @override
36+ void dispose () {
37+ _controller.dispose ();
38+ super .dispose ();
39+ }
2640}
Original file line number Diff line number Diff line change 1+ import 'package:custom_refresh_indicator/custom_refresh_indicator.dart' ;
12import 'package:example/indicators/plane_indicator.dart' ;
23import 'package:example/widgets/example_app_bar.dart' ;
34import 'package:example/widgets/example_list.dart' ;
@@ -11,13 +12,25 @@ class PlaneIndicatorScreen extends StatefulWidget {
1112}
1213
1314class _PlaneIndicatorScreenState extends State <PlaneIndicatorScreen > {
15+ final _controller = IndicatorController ();
1416 @override
1517 Widget build (BuildContext context) {
16- return const Scaffold (
17- appBar: ExampleAppBar (),
18+ return Scaffold (
19+ appBar: const ExampleAppBar (),
1820 body: PlaneIndicator (
19- child: ExampleList (),
21+ controller: _controller,
22+ child: ExampleList (
23+ physics: AlwaysScrollableScrollPhysics (
24+ parent: ClampingWithOverscrollPhysics (state: _controller),
25+ ),
26+ ),
2027 ),
2128 );
2229 }
30+
31+ @override
32+ void dispose () {
33+ _controller.dispose ();
34+ super .dispose ();
35+ }
2336}
Original file line number Diff line number Diff line change 1+ import 'package:custom_refresh_indicator/custom_refresh_indicator.dart' ;
12import 'package:example/widgets/example_app_bar.dart' ;
23import 'package:example/widgets/example_list.dart' ;
34import 'package:flutter/material.dart' ;
@@ -12,16 +13,28 @@ class WarpIndicatorScreen extends StatefulWidget {
1213}
1314
1415class _WarpIndicatorScreenState extends State <WarpIndicatorScreen > {
16+ final _controller = IndicatorController ();
1517 @override
1618 Widget build (BuildContext context) {
1719 return Scaffold (
1820 appBar: const ExampleAppBar (),
1921 body: SafeArea (
2022 child: WarpIndicator (
23+ controller: _controller,
2124 onRefresh: () => Future .delayed (const Duration (seconds: 2 )),
22- child: const ExampleList (),
25+ child: ExampleList (
26+ physics: AlwaysScrollableScrollPhysics (
27+ parent: ClampingWithOverscrollPhysics (state: _controller),
28+ ),
29+ ),
2330 ),
2431 ),
2532 );
2633 }
34+
35+ @override
36+ void dispose () {
37+ _controller.dispose ();
38+ super .dispose ();
39+ }
2740}
You can’t perform that action at this time.
0 commit comments