more cleanup
This commit is contained in:
parent
b6fe1841aa
commit
99c9c0d4e5
|
|
@ -40,10 +40,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||||
),
|
),
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding: const EdgeInsets.all(20),
|
padding: const EdgeInsets.all(20),
|
||||||
child: RotatedBox(
|
child: MyBarChart(),
|
||||||
quarterTurns: 1,
|
|
||||||
child: MyBarChart(),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -91,8 +88,18 @@ class MyBarChart extends StatelessWidget {
|
||||||
.map((d) => BarChartGroupData(
|
.map((d) => BarChartGroupData(
|
||||||
x: data.indexOf(d),
|
x: data.indexOf(d),
|
||||||
barRods: [
|
barRods: [
|
||||||
BarChartRodData(toY: d.year.toDouble(), color: Colors.orange),
|
BarChartRodData(
|
||||||
BarChartRodData(toY: d.gpa.toDouble(), color: Colors.indigo)
|
toY: d.year.toDouble(),
|
||||||
|
width: 40,
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(5)),
|
||||||
|
color: Colors.orange,
|
||||||
|
),
|
||||||
|
BarChartRodData(
|
||||||
|
toY: d.gpa.toDouble(),
|
||||||
|
width: 40,
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(5)),
|
||||||
|
color: Colors.indigo,
|
||||||
|
)
|
||||||
],
|
],
|
||||||
))
|
))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
@ -122,7 +129,10 @@ class MyBarChart extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BarChart(_chartData());
|
return RotatedBox(
|
||||||
|
quarterTurns: 1,
|
||||||
|
child: BarChart(_chartData()),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -135,6 +145,8 @@ class ChartData {
|
||||||
|
|
||||||
static List<ChartData> exampleData() {
|
static List<ChartData> exampleData() {
|
||||||
return [
|
return [
|
||||||
|
ChartData(name: "John", gpa: 2, year: 1),
|
||||||
|
ChartData(name: "Jane", gpa: 3, year: 2),
|
||||||
ChartData(name: "John Doe", gpa: 2, year: 1),
|
ChartData(name: "John Doe", gpa: 2, year: 1),
|
||||||
ChartData(name: "Jane Doe", gpa: 3, year: 2),
|
ChartData(name: "Jane Doe", gpa: 3, year: 2),
|
||||||
ChartData(name: "Doe", gpa: 4, year: 3),
|
ChartData(name: "Doe", gpa: 4, year: 3),
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,8 @@ class ChartData {
|
||||||
return [
|
return [
|
||||||
ChartData(name: "John", gpa: 2, year: 1),
|
ChartData(name: "John", gpa: 2, year: 1),
|
||||||
ChartData(name: "Jane", gpa: 3, year: 2),
|
ChartData(name: "Jane", gpa: 3, year: 2),
|
||||||
|
ChartData(name: "John Doe", gpa: 2, year: 1),
|
||||||
|
ChartData(name: "Jane Doe", gpa: 3, year: 2),
|
||||||
ChartData(name: "Doe", gpa: 4, year: 3),
|
ChartData(name: "Doe", gpa: 4, year: 3),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue