Improved layout, fixed transaction popup

This commit is contained in:
2024-02-11 17:28:21 +01:00
parent 44f6d433d1
commit cbaf94d866
21 changed files with 378 additions and 204 deletions

View File

@@ -20,24 +20,35 @@ class StatsPage extends StatelessWidget {
child: BlocBuilder<ChartBloc, ChartState>(
builder: (context, state) => ListView(
children: [
Row(
children: [
Expanded(
flex: 2,
child: MainCounter(value: state.globalTotal)
Center (
child: ConstrainedBox(
constraints: const BoxConstraints(
maxWidth: 1000
),
Expanded(
flex: 1,
child: AccountCounter(accountsTotals: state.accountsTotals)
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const YearSelector(),
ProfitIndicator(monthlyTotals: state.scopedMonthlyTotals)
],
child: Column(
children: [
Row(
children: [
Expanded(
flex: 2,
child: MainCounter(value: state.globalTotal)
),
Expanded(
flex: 1,
child: AccountCounter(accountsTotals: state.accountsTotals)
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const YearSelector(),
ProfitIndicator(profit: state.scoppedProfit)
],
),
]
)
)
),
SizedBox(
height: 200,
@@ -47,14 +58,20 @@ class StatsPage extends StatelessWidget {
height: 500,
child: MonthlyCategoriesTotalChart(categoriesMonthlyTotals: state.scopedCategoriesMonthlyTotals)
),
SizedBox(
height: 450,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
CategoriesTotalsChart(categoriesTotals: state.scopedCategoriesPositiveTotals, categoriesTotalsPercents: state.scopedSimplifiedCategoriesPositiveTotalsPercents),
CategoriesTotalsChart(categoriesTotals: state.scopedCategoriesNegativeTotals, categoriesTotalsPercents: state.scopedSimplifiedCategoriesNegativeTotalsPercents),
],
Center (
child: ConstrainedBox(
constraints: const BoxConstraints(
maxWidth: 1500
),
child: SizedBox(
height: 450,
child: OverflowBar(
children: [
CategoriesTotalsChart(categoriesTotals: state.scopedCategoriesPositiveTotals, categoriesTotalsPercents: state.scopedSimplifiedCategoriesPositiveTotalsPercents),
CategoriesTotalsChart(categoriesTotals: state.scopedCategoriesNegativeTotals, categoriesTotalsPercents: state.scopedSimplifiedCategoriesNegativeTotalsPercents),
],
)
)
)
),
],

View File

@@ -10,7 +10,12 @@ class AccountCounter extends StatelessWidget {
return accountsTotals.entries.toList().map((entry) => Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(entry.key),
Flexible(
child: Text(
entry.key,
overflow: TextOverflow.ellipsis,
)
),
Text(
NumberFormat('#######.00 €', 'fr_FR').format(entry.value),
style: TextStyle(

View File

@@ -60,7 +60,7 @@ class CategoriesTotalsChart extends StatelessWidget {
return BlocBuilder<CategoryBloc, CategoryState>(
builder: (context, state) => Container(
height: 320,
width: 560,
width: 600,
padding: const EdgeInsets.all(10),
margin: const EdgeInsets.all(20),
decoration: BoxDecoration(

View File

@@ -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),