-
Notifications
You must be signed in to change notification settings - Fork 6
/
main.dart
181 lines (171 loc) · 6.1 KB
/
main.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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
/*
* @Author: Cao Shixin
* @Date: 2020-03-29 10:26:09
* @LastEditors: Cao Shixin
* @LastEditTime: 2023-03-28 15:12:53
* @Description:
* @Email: cao_shixin@yahoo.com
* @Company: BrainCo
*/
import 'package:example/chart_bar_circle.dart';
import 'package:example/chart_bar_round.dart';
import 'package:example/chart_curve.dart';
import 'package:example/chart_dimensionality_view.dart';
import 'package:example/chart_line.dart';
import 'package:example/chart_line_section_enlarge.dart';
import 'package:example/chart_pie.dart';
import 'package:example/double_chart_line.dart';
import 'package:example/focus_chart_double_line.dart';
import 'package:example/focus_chart_gradient_line.dart';
import 'package:example/focus_chart_line.dart';
import 'package:example/focus_chart_special_point.dart';
import 'package:example/percent_indicator_circle.dart';
import 'package:example/percent_indicator_line.dart';
import 'package:example/step_curve_line.dart';
import 'package:flutter/material.dart';
import 'chart_dimensionality_view_1.dart';
import 'chart_dimensionality_view_2.dart';
import 'chart_line_gradiet.dart';
import 'normal_widget.dart';
void main() => runApp(MyApp());
final Map<String, WidgetBuilder> _routes = {
//FN专注力样式图
FocusChartLinePage.routeName: (_) => FocusChartLinePage(),
//FN专注力特殊点样式图
FocusChartSpecialPointPage.routeName: (_) => FocusChartSpecialPointPage(),
//FN专注力颜色渐变曲线
FocusChartGradientLinePage.routeName: (_) => FocusChartGradientLinePage(),
//FN大师竞赛双专注力样式图
FNDoubleLinePage.routeName: (_) => FNDoubleLinePage(),
//FN步进曲线,可拖拽
StepCurveLine.routeName: (_) => StepCurveLine(),
//柱状顶部半圆型
ChartBarCirclePage.routeName: (_) => ChartBarCirclePage(),
//柱状图顶部自定义弧角
ChartBarRoundPage.routeName: (_) => ChartBarRoundPage(),
//平滑曲线带填充颜色
ChartCurvePage.routeName: (_) => ChartCurvePage(),
//折线y轴区间放大
ChartLineSectionEnlarge.routeName: (_) => ChartLineSectionEnlarge(),
//折线带填充颜色
ChartLinePage.routeName: (_) => ChartLinePage(),
//折线线条渐变色
ChartLineGradientPage.routeName: (_) => ChartLineGradientPage(),
//双折线
DoubleChartlinePage.routeName: (_) => DoubleChartlinePage(),
//饼状图
ChartPiePage.routeName: (_) => ChartPiePage(),
//维度图
ChartDimensionalityView.routeName: (_) => ChartDimensionalityView(),
//纬度图另一种显示样式
ChartDimensionaView.routeName: (_) => ChartDimensionaView(),
//纬度图第二种显示样式
ChartDimensionaView2.routeName: (_) => ChartDimensionaView2(),
//圆圈进度指示器
PercentIndicatorCircle.routeName: (_) => PercentIndicatorCircle(),
//线条进度指示器
PercentIndicatorLine.routeName: (_) => PercentIndicatorLine(),
//常用小组件展示
NormalWidget.routeName: (_) => NormalWidget(),
};
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: '绘图图表测试',
theme: ThemeData(primaryColor: Colors.blue),
routes: _routes,
home: Scaffold(
appBar: AppBar(
title: Text('绘图图表测试'),
),
body: MyAppPage(),
),
);
}
}
class MyAppPage extends StatefulWidget {
@override
_MyAppPageState createState() => _MyAppPageState();
}
class _MyAppPageState extends State<MyAppPage> {
List<CellModel> _demoTitleArr = [];
@override
void initState() {
super.initState();
_demoTitleArr = [
CellModel(
title: FocusChartLinePage.title,
routeName: FocusChartLinePage.routeName),
CellModel(
title: FocusChartSpecialPointPage.title,
routeName: FocusChartSpecialPointPage.routeName),
CellModel(
title: FocusChartGradientLinePage.title,
routeName: FocusChartGradientLinePage.routeName),
CellModel(
title: FNDoubleLinePage.title, routeName: FNDoubleLinePage.routeName),
CellModel(title: StepCurveLine.title, routeName: StepCurveLine.routeName),
CellModel(
title: ChartBarCirclePage.title,
routeName: ChartBarCirclePage.routeName),
CellModel(
title: ChartBarRoundPage.title,
routeName: ChartBarRoundPage.routeName),
CellModel(
title: ChartCurvePage.title, routeName: ChartCurvePage.routeName),
CellModel(
title: ChartLineGradientPage.title,
routeName: ChartLineGradientPage.routeName),
CellModel(title: ChartLinePage.title, routeName: ChartLinePage.routeName),
CellModel(
title: ChartLineSectionEnlarge.title,
routeName: ChartLineSectionEnlarge.routeName),
CellModel(
title: DoubleChartlinePage.title,
routeName: DoubleChartlinePage.routeName),
CellModel(title: ChartPiePage.title, routeName: ChartPiePage.routeName),
CellModel(
title: ChartDimensionalityView.title,
routeName: ChartDimensionalityView.routeName),
CellModel(
title: ChartDimensionaView.title,
routeName: ChartDimensionaView.routeName),
CellModel(
title: ChartDimensionaView2.title,
routeName: ChartDimensionaView2.routeName),
CellModel(
title: PercentIndicatorCircle.title,
routeName: PercentIndicatorCircle.routeName),
CellModel(
title: PercentIndicatorLine.title,
routeName: PercentIndicatorLine.routeName),
CellModel(title: NormalWidget.title, routeName: NormalWidget.routeName),
];
}
@override
Widget build(BuildContext context) {
return ListView.builder(
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
Navigator.of(context).pushNamed(_demoTitleArr[index].routeName);
},
child: ListTile(
title: Center(
child: Text(_demoTitleArr[index].title),
),
),
);
},
itemCount: _demoTitleArr.length,
);
}
}
class CellModel {
//显示标题
String title;
//路由地址名
String routeName;
CellModel({this.title, this.routeName});
}