Skip to content

Commit 9ec2b6b

Browse files
committed
Update: README
1 parent d1685e5 commit 9ec2b6b

File tree

6 files changed

+323
-1
lines changed

6 files changed

+323
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Package/Plugin|Description|Link
5050
---|:--:|---:
5151
[airoute](https://github.com/pdliuw/airoute)|Airoute:Solve the frequent problems caused by context in development, and break through the limitation of the scope of use of built-in routing|[![pub package](https://img.shields.io/pub/v/airoute.svg)](https://pub.dev/packages/airoute)
5252
[ai_barcode](https://github.com/pdliuw/ai_barcode)|AiBarcode:Scan and create barcode plugins that support customizable areas and styles|[![pub package](https://img.shields.io/pub/v/ai_barcode.svg)](https://pub.dev/packages/ai_barcode)
53+
[ai_progress](https://github.com/pdliuw/ai_progress)|support: 'Circular、Linear、Arc、Step、Dashboard'multiple style progress |[![pub package](https://img.shields.io/pub/v/ai_progress.svg)](https://pub.dev/packages/ai_progress)
5354
[ai_awesome_message](https://github.com/pdliuw/ai_awesome_message)|AiAwesomeMessage:Replaces Toast and SnackBar and can be used across multiple messaging libraries|[![pub package](https://img.shields.io/pub/v/ai_awesome_message.svg)](https://pub.dev/packages/ai_awesome_message)
5455

5556
Package/Plugin|Description|Link

README_CH.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ Package/Plugin|Description|Link
4747
---|:--:|---:
4848
[airoute](https://github.com/pdliuw/airoute)|爱路由:解决开发中由于context引起的经常性问题,突破了自带路由的使用范围的限制|[![pub package](https://img.shields.io/pub/v/airoute.svg)](https://pub.dev/packages/airoute)
4949
[ai_barcode](https://github.com/pdliuw/ai_barcode)|爱条码:支持可自定义区域及样式的可扫描、创建的的条码插件|[![pub package](https://img.shields.io/pub/v/ai_barcode.svg)](https://pub.dev/packages/ai_barcode)
50+
[ai_progress](https://github.com/pdliuw/ai_progress)|支持: '圆环、线性、扇形、步进、仪表盘'多种样式的进度组件|[![pub package](https://img.shields.io/pub/v/ai_progress.svg)](https://pub.dev/packages/ai_progress)
5051
[ai_awesome_message](https://github.com/pdliuw/ai_awesome_message)|消息提示:可替代Toast和SnackBar并可跨多端使用的消息库|[![pub package](https://img.shields.io/pub/v/ai_awesome_message.svg)](https://pub.dev/packages/ai_awesome_message)
5152

5253
Package/Plugin|Description|Link

README_CH_v2.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ Package/Plugin|Description|Link
4747
---|:--:|---:
4848
[airoute](https://github.com/pdliuw/airoute)|爱路由:解决开发中由于context引起的经常性问题,突破了自带路由的使用范围的限制|[![pub package](https://img.shields.io/pub/v/airoute.svg)](https://pub.dev/packages/airoute)
4949
[ai_barcode](https://github.com/pdliuw/ai_barcode)|爱条码:支持可自定义区域及样式的可扫描、创建的的条码插件|[![pub package](https://img.shields.io/pub/v/ai_barcode.svg)](https://pub.dev/packages/ai_barcode)
50+
[ai_progress](https://github.com/pdliuw/ai_progress)|支持: '圆环、线性、扇形、步进、仪表盘'多种样式的进度组件|[![pub package](https://img.shields.io/pub/v/ai_progress.svg)](https://pub.dev/packages/ai_progress)
5051
[ai_awesome_message](https://github.com/pdliuw/ai_awesome_message)|消息提示:可替代Toast和SnackBar并可跨多端使用的消息库|[![pub package](https://img.shields.io/pub/v/ai_awesome_message.svg)](https://pub.dev/packages/ai_awesome_message)
5152

5253
Package/Plugin|Description|Link

README_v2.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Package/Plugin|Description|Link
5050
---|:--:|---:
5151
[airoute](https://github.com/pdliuw/airoute)|Airoute:Solve the frequent problems caused by context in development, and break through the limitation of the scope of use of built-in routing|[![pub package](https://img.shields.io/pub/v/airoute.svg)](https://pub.dev/packages/airoute)
5252
[ai_barcode](https://github.com/pdliuw/ai_barcode)|AiBarcode:Scan and create barcode plugins that support customizable areas and styles|[![pub package](https://img.shields.io/pub/v/ai_barcode.svg)](https://pub.dev/packages/ai_barcode)
53+
[ai_progress](https://github.com/pdliuw/ai_progress)|support: 'Circular、Linear、Arc、Step、Dashboard'multiple style progress |[![pub package](https://img.shields.io/pub/v/ai_progress.svg)](https://pub.dev/packages/ai_progress)
5354
[ai_awesome_message](https://github.com/pdliuw/ai_awesome_message)|AiAwesomeMessage:Replaces Toast and SnackBar and can be used across multiple messaging libraries|[![pub package](https://img.shields.io/pub/v/ai_awesome_message.svg)](https://pub.dev/packages/ai_awesome_message)
5455

5556
Package/Plugin|Description|Link

lib/sample/progress/main_progress_page.dart

Lines changed: 316 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
1+
import 'package:ai_progress/ai_progress.dart';
2+
import 'package:flutter/cupertino.dart';
13
import 'package:flutter/material.dart';
24

35
///
46
/// MainProgressPage
57
class MainProgressPage extends StatefulWidget {
68
@override
79
State<StatefulWidget> createState() {
8-
return _MainProgressState();
10+
return _ExampleState();
11+
}
12+
}
13+
14+
class _ExampleState extends State<MainProgressPage> {
15+
@override
16+
Widget build(BuildContext context) {
17+
return ExampleHomePage._(
18+
title: "Progress",
19+
);
920
}
1021
}
1122

@@ -49,6 +60,15 @@ class _MainProgressState extends State<MainProgressPage>
4960
body: Column(
5061
children: <Widget>[
5162
Spacer(),
63+
RaisedButton.icon(
64+
onPressed: () {},
65+
icon: Container(
66+
width: 24,
67+
height: 24,
68+
padding: EdgeInsets.all(0),
69+
child: CircularProgressIndicator(),
70+
),
71+
label: Text("loading button")),
5272
Slider(
5373
min: MIN,
5474
max: MAX,
@@ -64,6 +84,7 @@ class _MainProgressState extends State<MainProgressPage>
6484
});
6585
},
6686
),
87+
Spacer(),
6788
Stack(
6889
alignment: Alignment.center,
6990
children: <Widget>[
@@ -107,3 +128,297 @@ class _MainProgressState extends State<MainProgressPage>
107128
);
108129
}
109130
}
131+
132+
class ExampleHomePage extends StatefulWidget {
133+
ExampleHomePage._({Key key, this.title}) : super(key: key);
134+
135+
final String title;
136+
137+
@override
138+
_MyHomePageState createState() => _MyHomePageState();
139+
}
140+
141+
class _MyHomePageState extends State<ExampleHomePage>
142+
with SingleTickerProviderStateMixin {
143+
int _counter = 0;
144+
145+
static const double MAX = 10.0;
146+
static const double MIN = 1.0;
147+
static int _divisions = 99;
148+
149+
double _progressValue = 1;
150+
double _slideValue = MAX;
151+
152+
AnimationController _controller;
153+
Animation<Color> _colorTween;
154+
155+
@override
156+
void initState() {
157+
super.initState();
158+
_controller = AnimationController(vsync: this);
159+
_colorTween = _controller.drive(ColorTween(
160+
begin: Colors.grey,
161+
end: Colors.green,
162+
));
163+
_controller.value = _progressValue;
164+
}
165+
166+
@override
167+
void dispose() {
168+
super.dispose();
169+
_controller.dispose();
170+
Paint paint = Paint();
171+
172+
paint..isAntiAlias = true;
173+
}
174+
175+
Map<int, Widget> _segmentChildren = {
176+
1: Text("1"),
177+
2: Text("2"),
178+
3: Text("3"),
179+
4: Text("4"),
180+
5: Text("5"),
181+
6: Text("6"),
182+
7: Text("7"),
183+
8: Text("8"),
184+
9: Text("9"),
185+
10: Text("10"),
186+
};
187+
int _segmentValue = 1;
188+
189+
@override
190+
Widget build(BuildContext context) {
191+
return Scaffold(
192+
appBar: AppBar(
193+
title: Text(widget.title),
194+
),
195+
body: SingleChildScrollView(
196+
child: Column(
197+
children: [
198+
Row(
199+
children: [
200+
Expanded(
201+
child: CupertinoSegmentedControl(
202+
padding: EdgeInsets.all(5),
203+
children: _segmentChildren,
204+
onValueChanged: (int index) {
205+
setState(() {
206+
_segmentValue = index;
207+
_controller.value = index * 10 / 100;
208+
});
209+
},
210+
groupValue: _segmentValue,
211+
),
212+
),
213+
],
214+
),
215+
Align(
216+
child: Text("$_segmentValue"),
217+
),
218+
Slider(
219+
min: MIN,
220+
max: MAX,
221+
value: _segmentValue.toDouble(),
222+
onChanged: (double newValue) {
223+
setState(() {
224+
_segmentValue = newValue.toInt();
225+
_controller.value = newValue;
226+
});
227+
},
228+
),
229+
Row(
230+
children: [
231+
Spacer(),
232+
Stack(
233+
alignment: Alignment.center,
234+
children: <Widget>[
235+
Container(
236+
width: 150,
237+
height: 150,
238+
padding: EdgeInsets.all(5),
239+
child: CircularProgressIndicator(
240+
value: _segmentValue / 10,
241+
strokeWidth: 10.0,
242+
valueColor: _colorTween,
243+
),
244+
),
245+
Text("${_segmentValue / 10 * 100}%"),
246+
],
247+
),
248+
Spacer(),
249+
Stack(
250+
alignment: Alignment.center,
251+
children: <Widget>[
252+
Container(
253+
width: 150,
254+
height: 150,
255+
padding: EdgeInsets.all(5),
256+
child: AirDashboardStateProgressIndicator(
257+
size: Size(150, 150),
258+
value: _segmentValue / 10 * 100, //1~100
259+
valueColor:
260+
ColorTween(begin: Colors.grey, end: Colors.blue)
261+
.transform(_segmentValue / 10),
262+
pathStrokeWidth: 10,
263+
valueStrokeWidth: 10,
264+
gapDegree: 60,
265+
roundCap: true,
266+
),
267+
),
268+
Text("${_segmentValue / 10 * 100}%"),
269+
],
270+
),
271+
Spacer(),
272+
],
273+
),
274+
//圆环、扇形样式的进度
275+
Row(
276+
children: [
277+
Spacer(),
278+
Stack(
279+
alignment: Alignment.center,
280+
children: <Widget>[
281+
Container(
282+
width: 150,
283+
height: 150,
284+
padding: EdgeInsets.all(5),
285+
child: AirCircularStateProgressIndicator(
286+
size: Size(150, 150),
287+
value: _segmentValue / 10 * 100, //1~100
288+
pathColor: Colors.white,
289+
valueColor:
290+
ColorTween(begin: Colors.grey, end: Colors.blue)
291+
.transform(_segmentValue / 10),
292+
pathStrokeWidth: 10.0,
293+
valueStrokeWidth: 10.0,
294+
useCenter: false,
295+
filled: false,
296+
roundCap: true,
297+
),
298+
),
299+
Text("${_segmentValue / 10 * 100}%"),
300+
],
301+
),
302+
Spacer(),
303+
Stack(
304+
alignment: Alignment.center,
305+
children: <Widget>[
306+
Container(
307+
width: 150,
308+
height: 150,
309+
padding: EdgeInsets.all(5),
310+
child: AirCircularStateProgressIndicator(
311+
size: Size(150, 150),
312+
value: _segmentValue / 10 * 100, //1~100
313+
pathColor: Colors.white,
314+
valueColor:
315+
ColorTween(begin: Colors.grey, end: Colors.blue)
316+
.transform(_segmentValue / 10),
317+
pathStrokeWidth: 10.0,
318+
valueStrokeWidth: 10.0,
319+
useCenter: true,
320+
filled: true,
321+
roundCap: true,
322+
),
323+
),
324+
Text("${_segmentValue / 10 * 100}%"),
325+
],
326+
),
327+
Spacer(),
328+
],
329+
),
330+
//线性、步进样式的进度
331+
Row(
332+
children: [
333+
Spacer(),
334+
Stack(
335+
alignment: Alignment.center,
336+
children: <Widget>[
337+
Container(
338+
width: 150,
339+
height: 50,
340+
padding: EdgeInsets.all(5),
341+
child: AirLinearStateProgressIndicator(
342+
size: Size(150, 150),
343+
value: _segmentValue / 10 * 100, //1~100
344+
valueColor:
345+
ColorTween(begin: Colors.grey, end: Colors.blue)
346+
.transform(_segmentValue / 10),
347+
pathStrokeWidth: 10.0,
348+
valueStrokeWidth: 10.0,
349+
roundCap: true,
350+
),
351+
),
352+
Text("${_segmentValue / 10 * 100}%"),
353+
],
354+
),
355+
Spacer(),
356+
Row(
357+
children: [
358+
Container(
359+
width: 90,
360+
height: 50,
361+
padding: EdgeInsets.all(0),
362+
child: AirStepStateProgressIndicator(
363+
size: Size(150, 150),
364+
stepCount: _segmentChildren.length,
365+
stepValue: _segmentValue,
366+
valueColor:
367+
ColorTween(begin: Colors.grey, end: Colors.blue)
368+
.transform(_segmentValue / 10),
369+
pathStrokeWidth: 10.0,
370+
valueStrokeWidth: 10.0,
371+
),
372+
),
373+
Text("${_segmentValue / 10 * 100}%"),
374+
],
375+
),
376+
Spacer(),
377+
],
378+
),
379+
Row(
380+
children: [
381+
Spacer(),
382+
Row(
383+
children: [
384+
Container(
385+
width: 250,
386+
height: 50,
387+
padding: EdgeInsets.all(0),
388+
child: AirStepStateProgressIndicator(
389+
size: Size(150, 150),
390+
stepCount: _segmentChildren.length,
391+
stepValue: _segmentValue,
392+
valueColor:
393+
ColorTween(begin: Colors.grey, end: Colors.blue)
394+
.transform(_segmentValue / 10),
395+
pathStrokeWidth: 30.0,
396+
valueStrokeWidth: 30.0,
397+
),
398+
),
399+
Text("${_segmentValue / 10 * 100}%"),
400+
],
401+
),
402+
Spacer(),
403+
],
404+
),
405+
Row(
406+
mainAxisAlignment: MainAxisAlignment.center,
407+
children: <Widget>[
408+
Container(
409+
width: 150,
410+
padding: EdgeInsets.all(5),
411+
child: LinearProgressIndicator(
412+
value: _segmentValue / 10,
413+
valueColor: _colorTween,
414+
),
415+
),
416+
Text("${_segmentValue / 10 * 100}%"),
417+
],
418+
),
419+
],
420+
),
421+
),
422+
);
423+
}
424+
}

pubspec.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ dependencies:
7878

7979
# popup menu
8080
popup_menu: ^1.0.5
81+
82+
# multiple style progress
83+
ai_progress: ^0.1.3
8184
dev_dependencies:
8285
flutter_test:
8386
sdk: flutter

0 commit comments

Comments
 (0)