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,41 @@
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
class ProfitIndicator extends StatelessWidget {
final List<FlSpot> monthlyTotals;
const ProfitIndicator({super.key, required this.monthlyTotals});
double _profit() {
if (monthlyTotals.isEmpty) {
return 0;
}
final maxDateSpot = monthlyTotals.reduce((value, element) => value.x > element.x ? value : element);
final minDateSpot = monthlyTotals.reduce((value, element) => value.x < element.x ? value : element);
return maxDateSpot.y - minDateSpot.y;
}
@override
Widget build(BuildContext context) {
final profit = _profit();
return Container(
margin: const EdgeInsets.fromLTRB(0, 0, 20, 0),
padding: const EdgeInsets.fromLTRB(10, 5, 10, 5),
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(5)
),
child: Text(
"Profit ${NumberFormat('#####00.00 €', 'fr_FR').format(profit)}",
style: TextStyle(
fontFamily: 'NovaMono',
fontSize: 20,
fontWeight: FontWeight.w500,
color: profit > 0 ? const Color.fromARGB(255, 0, 255, 8) : Colors.red
),
)
);
}
}