Improved layout, fixed transaction popup
This commit is contained in:
@@ -1,25 +1,14 @@
|
||||
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;
|
||||
final double profit;
|
||||
|
||||
const ProfitIndicator({super.key, required this.monthlyTotals});
|
||||
const ProfitIndicator({super.key, required this.profit});
|
||||
|
||||
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),
|
||||
|
||||
Reference in New Issue
Block a user