79 lines
2.8 KiB
Dart
79 lines
2.8 KiB
Dart
/*import 'package:flutter/material.dart';
|
|
import 'package:fl_chart/fl_chart.dart';
|
|
|
|
void main() {
|
|
runApp(MyApp());
|
|
}
|
|
|
|
class MyApp extends StatelessWidget {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
home: Scaffold(
|
|
appBar: AppBar(
|
|
title: Text('Nutrition Chart'),
|
|
),
|
|
body: Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: <Widget>[
|
|
Container(
|
|
height: 300,
|
|
width: 300,
|
|
child: BarChart(
|
|
BarChartData(
|
|
barTouchData: BarTouchData(enabled: false),
|
|
titlesData: FlTitlesData(
|
|
show: true,
|
|
bottomTitles: SideTitles(
|
|
showTitles: true,
|
|
getTextStyles: (value) =>
|
|
const TextStyle(color: Colors.black, fontSize: 14),
|
|
margin: 10,
|
|
showTitles: (double value) {
|
|
switch (value.toInt()) {
|
|
case 0:
|
|
return 'Calories';
|
|
case 1:
|
|
return 'Protein';
|
|
case 2:
|
|
return 'Fat';
|
|
case 3:
|
|
return 'Carbs';
|
|
default:
|
|
return '';
|
|
}
|
|
},
|
|
),
|
|
leftTitles: SideTitles(showTitles: false),
|
|
),
|
|
borderData: FlBorderData(show: false),
|
|
barGroups: [
|
|
BarChartGroupData(x: 0, barRods: [
|
|
BarChartRodData(y: 200, color: Colors.blue),
|
|
BarChartRodData(y: 150, color: Colors.blueAccent),
|
|
]),
|
|
BarChartGroupData(x: 1, barRods: [
|
|
BarChartRodData(y: 50, color: Colors.red),
|
|
BarChartRodData(y: 60, color: Colors.deepOrange),
|
|
]),
|
|
BarChartGroupData(x: 2, barRods: [
|
|
BarChartRodData(y: 80, color: Colors.green),
|
|
BarChartRodData(y: 70, color: Colors.lightGreen),
|
|
]),
|
|
BarChartGroupData(x: 3, barRods: [
|
|
BarChartRodData(y: 100, color: Colors.orange),
|
|
BarChartRodData(y: 120, color: Colors.orangeAccent),
|
|
]),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
*/ |