82 lines
3.2 KiB
Dart
82 lines
3.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:tunas/domains/charts/chart_bloc.dart';
|
|
import 'package:tunas/pages/stats/widgets/account_counters.dart';
|
|
import 'package:tunas/pages/stats/widgets/categories_totals_chart.dart';
|
|
import 'package:tunas/pages/stats/widgets/global_counter.dart';
|
|
import 'package:tunas/pages/stats/widgets/monthly_categories_total_chart.dart';
|
|
import 'package:tunas/pages/stats/widgets/global_total_chart.dart';
|
|
import 'package:tunas/pages/stats/widgets/profit_indicator.dart';
|
|
import 'package:tunas/pages/stats/widgets/year_selector.dart';
|
|
import 'package:tunas/repositories/account/account_repository.dart';
|
|
|
|
class StatsPage extends StatelessWidget {
|
|
const StatsPage({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BlocProvider(
|
|
create: (context) => ChartBloc(accountRepository: RepositoryProvider.of<AccountRepository>(context)),
|
|
child: BlocBuilder<ChartBloc, ChartState>(
|
|
builder: (context, state) => ListView(
|
|
children: [
|
|
Center (
|
|
child: ConstrainedBox(
|
|
constraints: const BoxConstraints(
|
|
maxWidth: 1000
|
|
),
|
|
child: Column(
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
flex: 2,
|
|
child: GlobalCounter(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,
|
|
child: GlobalTotalChart(monthlyTotals: state.scopedMonthlyTotals)
|
|
),
|
|
SizedBox(
|
|
height: 500,
|
|
child: MonthlyCategoriesTotalChart(categoriesMonthlyTotals: state.scopedCategoriesMonthlyTotals)
|
|
),
|
|
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),
|
|
],
|
|
)
|
|
)
|
|
)
|
|
),
|
|
],
|
|
)
|
|
),
|
|
);
|
|
}
|
|
} |