-
Notifications
You must be signed in to change notification settings - Fork 6
/
refresh_indicator.dart
142 lines (136 loc) · 4.44 KB
/
refresh_indicator.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
//Flutter Custom Refresh Indicator
// This package provides CustomRefreshIndicator widget that make it easy to implement your own custom refresh indicator.
//It listens for scroll events from scroll widget passed to child argument and parsing it to data easy for custom refresh indicator implementation.
//Indicator data is provided by IndicatorController (third argument of builder method). Long story short... thats it!
import 'package:example/screens/presentation_screen.dart';
import 'package:flutter/material.dart';
import 'indicators/simple_indicator.dart';
import 'screens/example_indicator_screen.dart';
import 'screens/ice_cream_indicator_screen.dart';
import 'screens/plane_indicator_screen.dart';
import 'screens/check_mark_indicator_screen.dart';
import 'screens/warp_indicator_screen.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'CustomRefreshIndicator demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MainScreen(),
routes: {
'/example': (context) => ExampleIndicatorScreen(),
'/plane': (context) => PlaneIndicatorScreen(),
'/ice_cream': (context) => IceCreamIndicatorScreen(),
'/presentation': (context) => PresentationScreen(),
'/check-mark': (context) => CheckMarkIndicatorScreen(),
'/warp': (context) => WarpIndicatorScreen(),
},
);
}
}
class MainScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Examples"),
),
body: SafeArea(
child: ListView(
padding: const EdgeInsets.all(15),
children: <Widget>[
ElevatedButton(
child: Container(
height: 50,
alignment: Alignment.center,
child: Text("Presentation"),
),
onPressed: () => Navigator.pushNamed(
context,
'/presentation',
),
),
const SizedBox(height: 15),
ElevatedButton(
child: Container(
height: 50,
alignment: Alignment.center,
child: Text("Simple"),
),
onPressed: () => Navigator.pushNamed(
context,
'/example',
arguments: simpleIndicator,
),
),
const SizedBox(height: 15),
ElevatedButton(
child: Container(
height: 50,
alignment: Alignment.center,
child: Text("Simple with list opacity"),
),
onPressed: () => Navigator.pushNamed(
context,
'/example',
arguments: simpleIndicatorWithOpacity,
),
),
const SizedBox(height: 15),
ElevatedButton(
child: Container(
height: 50,
alignment: Alignment.center,
child: Text("Plane"),
),
onPressed: () => Navigator.pushNamed(
context,
'/plane',
),
),
const SizedBox(height: 15),
ElevatedButton(
child: Container(
height: 50,
alignment: Alignment.center,
child: Text("Ice cream"),
),
onPressed: () => Navigator.pushNamed(
context,
'/ice_cream',
),
),
const SizedBox(height: 15),
ElevatedButton(
child: Container(
height: 50,
alignment: Alignment.center,
child: Text("Check mark"),
),
onPressed: () => Navigator.pushNamed(
context,
'/check-mark',
),
),
const SizedBox(height: 15),
ElevatedButton(
child: Container(
height: 50,
alignment: Alignment.center,
child: Text("Warp indicator"),
),
onPressed: () => Navigator.pushNamed(
context,
'/warp',
arguments: simpleIndicator,
),
),
],
),
),
);
}
}