basic csv loader, transaction list & half done stats page

This commit is contained in:
2024-02-04 22:34:28 +01:00
commit 3abee9ff6f
179 changed files with 6999 additions and 0 deletions

View File

@@ -0,0 +1,92 @@
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
class GlobalTotalChart extends StatelessWidget {
final List<FlSpot> monthlyTotals;
const GlobalTotalChart({super.key, required this.monthlyTotals});
@override
Widget build(BuildContext context) {
var maxY = 1.0;
var minY = -1.0;
if (monthlyTotals.isNotEmpty) {
maxY = monthlyTotals.map((e) => e.y).toList().reduce((value, element) => value > element ? value : element) + 1000;
minY = monthlyTotals.map((e) => e.y).toList().reduce((value, element) => value < element ? value : element) - 1000;
}
return Padding(
padding: const EdgeInsets.only(
left: 12,
bottom: 12,
right: 20,
top: 20,
),
child: AspectRatio(
aspectRatio: 1,
child: LayoutBuilder(
builder: (context, constraints) => LineChart(
LineChartData(
lineTouchData: LineTouchData(
touchTooltipData: LineTouchTooltipData(
maxContentWidth: 100,
tooltipBgColor: Colors.black,
getTooltipItems: (touchedSpots) {
return touchedSpots.map((LineBarSpot touchedSpot) {
final textStyle = TextStyle(
color: touchedSpot.bar.gradient?.colors[0] ?? touchedSpot.bar.color,
fontWeight: FontWeight.bold,
fontSize: 14,
);
final date = DateTime(DateTime.now().year).add(Duration(days: touchedSpot.x.toInt() - 1));
return LineTooltipItem(
"${NumberFormat('#######.00 €', 'fr_FR').format(touchedSpot.y )} ${date.day}/${date.month}",
textStyle,
);
}).toList();
},
),
handleBuiltInTouches: true,
getTouchLineStart: (data, index) => 0,
),
lineBarsData: [
LineChartBarData(
color: Colors.pink,
spots: monthlyTotals,
isCurved: true,
isStrokeCapRound: true,
barWidth: 3,
belowBarData: BarAreaData(
show: false,
),
dotData: const FlDotData(show: false),
),
],
minY: minY,
maxY: maxY,
titlesData: const FlTitlesData(
leftTitles: AxisTitles(
sideTitles: SideTitles(showTitles: false),
),
rightTitles: AxisTitles(
sideTitles: SideTitles(showTitles: false),
),
topTitles: AxisTitles(
sideTitles: SideTitles(showTitles: false),
),
bottomTitles: AxisTitles(
sideTitles: SideTitles(showTitles: false),
),
),
gridData: const FlGridData(
show: false,
),
borderData: FlBorderData(show: false),
),
)
)
)
);
}
}