-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathProgressBarWidget.dart
158 lines (155 loc) · 5.42 KB
/
ProgressBarWidget.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app/common/CommonShowModel.dart';
///author: yang yi
///email: yangyirunning@163.com
class ProgressBarWidget extends StatefulWidget {
@override
ProgressBarState createState() {
// TODO: implement createState
return ProgressBarState();
}
}
class ProgressBarState extends State<ProgressBarWidget> {
double initProgressValue = 0.2;
double initCircularProgressValue = 0.2;
@override
Widget build(BuildContext context) {
// TODO: implement build
final arg = ModalRoute.of(context).settings.arguments;
return Scaffold(
appBar: getAppBar(arg),
body: SingleChildScrollView(
child: Center(
child: Column(
children: <Widget>[
SizedBox(height: 30),
Text("矩形的模糊的进度条"),
LinearProgressIndicator(
valueColor: AlwaysStoppedAnimation(Colors.blue),
backgroundColor: Colors.grey,
value: null,
),
SizedBox(
height: 30,
),
Text("矩形的精确的进度条"),
LinearProgressIndicator(
value: initProgressValue,
valueColor: AlwaysStoppedAnimation(Colors.blue),
backgroundColor: Colors.grey,
),
RaisedButton(
child: Text("点击更新进度条"),
textColor: Colors.white,
color: Colors.blue,
highlightColor: Colors.blue[700],
colorBrightness: Brightness.dark,
splashColor: Colors.grey,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)),
//正常状态下的阴影
elevation: 2.0,
//按下时的阴影
highlightElevation: 8.0,
// 禁用时的阴影
disabledElevation: 0.0,
onPressed: () {
setState(() {
if (initProgressValue == 1) {
initProgressValue = 0;
}
initProgressValue += 0.2;
});
},
),
SizedBox(
height: 30,
),
Text("圆形的模糊的进度条"),
SizedBox(
height: 10,
),
CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation(Colors.blue),
value: null,
backgroundColor: Colors.grey,
strokeWidth: 10,
),
SizedBox(
height: 30,
),
Text("圆形的精确进度条"),
SizedBox(
height: 10,
),
CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation(Colors.blue),
value: initCircularProgressValue,
backgroundColor: Colors.grey,
strokeWidth: 5,
),
SizedBox(
height: 10,
),
RaisedButton(
child: Text("点击更新进度条"),
textColor: Colors.white,
color: Colors.blue,
highlightColor: Colors.blue[700],
colorBrightness: Brightness.dark,
splashColor: Colors.grey,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)),
//正常状态下的阴影
elevation: 2.0,
//按下时的阴影
highlightElevation: 8.0,
// 禁用时的阴影
disabledElevation: 0.0,
onPressed: () {
setState(() {
if (initCircularProgressValue == 1) {
initCircularProgressValue = 0;
}
initCircularProgressValue += 0.2;
});
},
),
SizedBox(
height: 30,
),
Text("自定义大小的矩形进度条"),
SizedBox(
height: 10,
),
SizedBox(
width: 300,
height: 3,
child: LinearProgressIndicator(
valueColor: AlwaysStoppedAnimation(Colors.blue),
backgroundColor: Colors.grey,
value: null,
),
),
SizedBox(
height: 30,
),
Text("自定义大小的圆形进度条"),
SizedBox(
height: 10,
),
SizedBox(
width: 80,
height: 80,
child: CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation(Colors.blue),
value: null,
backgroundColor: Colors.grey,
))
],
),
),
));
}
}