Improved layout, fixed transaction popup
This commit is contained in:
@@ -41,8 +41,13 @@ class AccountBloc extends Bloc<AccountEvent, AccountState> {
|
|||||||
super(const AccountState()) {
|
super(const AccountState()) {
|
||||||
on<AccountImportJSON>(_onAccountImportJSON);
|
on<AccountImportJSON>(_onAccountImportJSON);
|
||||||
on<AccountImportCSV>(_onAccountImportCSV);
|
on<AccountImportCSV>(_onAccountImportCSV);
|
||||||
|
on<SubAccountLoad>(_onSubAccountLoad);
|
||||||
// on<AccountExportJSON>(_onAccountImportJSON);
|
// on<AccountExportJSON>(_onAccountImportJSON);
|
||||||
// on<AccountExportCSV>(_onAccountImportJSON);
|
// on<AccountExportCSV>(_onAccountImportJSON);
|
||||||
|
|
||||||
|
_accountRepository
|
||||||
|
.getSubAccountsStream()
|
||||||
|
.listen((subAccounts) => add(SubAccountLoad(subAccounts)));
|
||||||
}
|
}
|
||||||
|
|
||||||
double _universalConvertToDouble(dynamic value) {
|
double _universalConvertToDouble(dynamic value) {
|
||||||
@@ -69,6 +74,7 @@ class AccountBloc extends Bloc<AccountEvent, AccountState> {
|
|||||||
final List<List<dynamic>> csvList = const CsvToListConverter(fieldDelimiter: '|', eol: '\n').convert(csvFileContent);
|
final List<List<dynamic>> csvList = const CsvToListConverter(fieldDelimiter: '|', eol: '\n').convert(csvFileContent);
|
||||||
|
|
||||||
final Map<String, Category> categoriesMap = {};
|
final Map<String, Category> categoriesMap = {};
|
||||||
|
final Set<String> subAccounts = {};
|
||||||
|
|
||||||
final transactions = csvList
|
final transactions = csvList
|
||||||
.map((line) {
|
.map((line) {
|
||||||
@@ -88,6 +94,8 @@ class AccountBloc extends Bloc<AccountEvent, AccountState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
subAccounts.add(line[3]);
|
||||||
|
|
||||||
return Transaction(
|
return Transaction(
|
||||||
uuid: const Uuid().v8(),
|
uuid: const Uuid().v8(),
|
||||||
date: DateTime.parse(line[0]),
|
date: DateTime.parse(line[0]),
|
||||||
@@ -99,7 +107,7 @@ class AccountBloc extends Bloc<AccountEvent, AccountState> {
|
|||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
await _accountRepository.deleteAccount();
|
await _accountRepository.deleteAccount();
|
||||||
final account = Account(transactions: transactions, categories: categoriesMap.values.toList());
|
final account = Account(transactions: transactions, categories: categoriesMap.values.toList(), subAccounts: subAccounts);
|
||||||
await _accountRepository.saveAccount(account);
|
await _accountRepository.saveAccount(account);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -119,4 +127,12 @@ class AccountBloc extends Bloc<AccountEvent, AccountState> {
|
|||||||
await _accountRepository.saveTransactions(transactions);
|
await _accountRepository.saveTransactions(transactions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_onSubAccountLoad(
|
||||||
|
SubAccountLoad event, Emitter<AccountState> emit
|
||||||
|
) {
|
||||||
|
emit(
|
||||||
|
state.copyWith(event.subAccounts)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,3 +22,11 @@ final class AccountExportJSON extends AccountEvent {
|
|||||||
final class AccountExportCSV extends AccountEvent {
|
final class AccountExportCSV extends AccountEvent {
|
||||||
const AccountExportCSV();
|
const AccountExportCSV();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final class SubAccountLoad extends AccountEvent {
|
||||||
|
final Set<String> subAccounts;
|
||||||
|
const SubAccountLoad(this.subAccounts);
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [subAccounts];
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,12 +1,18 @@
|
|||||||
part of 'account_bloc.dart';
|
part of 'account_bloc.dart';
|
||||||
|
|
||||||
final class AccountState extends Equatable {
|
final class AccountState extends Equatable {
|
||||||
const AccountState();
|
final Set<String> subAccounts;
|
||||||
|
|
||||||
AccountState copyWith() {
|
const AccountState({
|
||||||
return const AccountState();
|
this.subAccounts = const {},
|
||||||
|
});
|
||||||
|
|
||||||
|
AccountState copyWith(Set<String>? subAccounts) {
|
||||||
|
return AccountState(
|
||||||
|
subAccounts: subAccounts ?? this.subAccounts,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Object?> get props => [];
|
List<Object?> get props => [subAccounts];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,22 +96,21 @@ class ChartBloc extends Bloc<ChartEvent, ChartState> {
|
|||||||
|
|
||||||
ChartState _computeStateScopedStats(ChartState state) {
|
ChartState _computeStateScopedStats(ChartState state) {
|
||||||
double globalTotal = 0;
|
double globalTotal = 0;
|
||||||
|
double scoppedTotal = 0;
|
||||||
List<ChartItem> scopedCategoriesPositiveTotals = [];
|
List<ChartItem> scopedCategoriesPositiveTotals = [];
|
||||||
List<ChartItem> scopedCategoriesNegativeTotals = [];
|
List<ChartItem> scopedCategoriesNegativeTotals = [];
|
||||||
Map<int, FlSpot> scopedMonthlyTotals = {};
|
Map<int, FlSpot> scopedMonthlyTotals = {};
|
||||||
Map<int, Map<String, double>> scopedCategoriesMonthlyTotals = {};
|
Map<int, Map<String, double>> scopedCategoriesMonthlyTotals = {};
|
||||||
|
|
||||||
for(var transaction in state.transactions) {
|
for(var transaction in state.transactions) {
|
||||||
double subTotal = globalTotal + transaction.value;
|
globalTotal += transaction.value;
|
||||||
globalTotal = subTotal;
|
double subTotal = globalTotal;
|
||||||
|
|
||||||
if (transaction.date.year != state.currentYear) {
|
if (transaction.date.year != state.currentYear) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.accountsTotals.containsKey(transaction.category)) {
|
scoppedTotal += transaction.value;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
TransactionLine transactionLine = TransactionLine(transaction: transaction, subTotal: subTotal);
|
TransactionLine transactionLine = TransactionLine(transaction: transaction, subTotal: subTotal);
|
||||||
|
|
||||||
@@ -155,7 +154,6 @@ class ChartBloc extends Bloc<ChartEvent, ChartState> {
|
|||||||
a?[transaction.category] = transaction.value.abs() + (a[transaction.category] ?? 0);
|
a?[transaction.category] = transaction.value.abs() + (a[transaction.category] ?? 0);
|
||||||
scopedCategoriesMonthlyTotals[transaction.date.month] = a!;
|
scopedCategoriesMonthlyTotals[transaction.date.month] = a!;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ChartItem> scopedCategoriesPositiveTotalsPercents = [];
|
List<ChartItem> scopedCategoriesPositiveTotalsPercents = [];
|
||||||
@@ -205,6 +203,7 @@ class ChartBloc extends Bloc<ChartEvent, ChartState> {
|
|||||||
scopedSimplifiedCategoriesNegativeTotalsPercents.sort((a, b) => a.value.compareTo(b.value));
|
scopedSimplifiedCategoriesNegativeTotalsPercents.sort((a, b) => a.value.compareTo(b.value));
|
||||||
|
|
||||||
return state.copyWith(
|
return state.copyWith(
|
||||||
|
scoppedProfit: scoppedTotal,
|
||||||
scopedCategoriesPositiveTotals: scopedCategoriesPositiveTotals,
|
scopedCategoriesPositiveTotals: scopedCategoriesPositiveTotals,
|
||||||
scopedCategoriesPositiveTotalsPercents: scopedCategoriesPositiveTotalsPercents,
|
scopedCategoriesPositiveTotalsPercents: scopedCategoriesPositiveTotalsPercents,
|
||||||
scopedCategoriesNegativeTotals: scopedCategoriesNegativeTotals,
|
scopedCategoriesNegativeTotals: scopedCategoriesNegativeTotals,
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ final class ChartState extends Equatable {
|
|||||||
final List<FlSpot> scopedMonthlyTotals;
|
final List<FlSpot> scopedMonthlyTotals;
|
||||||
final Map<int, Map<String, double>> scopedCategoriesMonthlyTotals;
|
final Map<int, Map<String, double>> scopedCategoriesMonthlyTotals;
|
||||||
|
|
||||||
|
final double scoppedProfit;
|
||||||
|
|
||||||
const ChartState({
|
const ChartState({
|
||||||
this.transactions = const [],
|
this.transactions = const [],
|
||||||
this.transactionsLines = const [],
|
this.transactionsLines = const [],
|
||||||
@@ -50,6 +52,7 @@ final class ChartState extends Equatable {
|
|||||||
this.scopedSimplifiedCategoriesNegativeTotalsPercents = const [],
|
this.scopedSimplifiedCategoriesNegativeTotalsPercents = const [],
|
||||||
this.scopedMonthlyTotals = const [],
|
this.scopedMonthlyTotals = const [],
|
||||||
this.scopedCategoriesMonthlyTotals = const {},
|
this.scopedCategoriesMonthlyTotals = const {},
|
||||||
|
this.scoppedProfit = 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
ChartState copyWith({
|
ChartState copyWith({
|
||||||
@@ -73,6 +76,7 @@ final class ChartState extends Equatable {
|
|||||||
List<ChartItem>? scopedSimplifiedCategoriesNegativeTotalsPercents,
|
List<ChartItem>? scopedSimplifiedCategoriesNegativeTotalsPercents,
|
||||||
List<FlSpot>? scopedMonthlyTotals,
|
List<FlSpot>? scopedMonthlyTotals,
|
||||||
Map<int, Map<String, double>>? scopedCategoriesMonthlyTotals,
|
Map<int, Map<String, double>>? scopedCategoriesMonthlyTotals,
|
||||||
|
double? scoppedProfit,
|
||||||
}) {
|
}) {
|
||||||
return ChartState(
|
return ChartState(
|
||||||
transactions: transactions ?? this.transactions,
|
transactions: transactions ?? this.transactions,
|
||||||
@@ -95,6 +99,7 @@ final class ChartState extends Equatable {
|
|||||||
scopedSimplifiedCategoriesNegativeTotalsPercents: scopedSimplifiedCategoriesNegativeTotalsPercents ?? this.scopedSimplifiedCategoriesNegativeTotalsPercents,
|
scopedSimplifiedCategoriesNegativeTotalsPercents: scopedSimplifiedCategoriesNegativeTotalsPercents ?? this.scopedSimplifiedCategoriesNegativeTotalsPercents,
|
||||||
scopedMonthlyTotals: scopedMonthlyTotals ?? this.scopedMonthlyTotals,
|
scopedMonthlyTotals: scopedMonthlyTotals ?? this.scopedMonthlyTotals,
|
||||||
scopedCategoriesMonthlyTotals: scopedCategoriesMonthlyTotals ?? this.scopedCategoriesMonthlyTotals,
|
scopedCategoriesMonthlyTotals: scopedCategoriesMonthlyTotals ?? this.scopedCategoriesMonthlyTotals,
|
||||||
|
scoppedProfit: scoppedProfit ?? this.scoppedProfit,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,6 +123,7 @@ final class ChartState extends Equatable {
|
|||||||
scopedSimplifiedCategoriesNegativeTotalsPercents,
|
scopedSimplifiedCategoriesNegativeTotalsPercents,
|
||||||
scopedMonthlyTotals,
|
scopedMonthlyTotals,
|
||||||
scopedCategoriesMonthlyTotals,
|
scopedCategoriesMonthlyTotals,
|
||||||
|
scoppedProfit,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,16 +6,17 @@ class BudgetsPage extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return const Flex(
|
return Center(
|
||||||
direction: Axis.horizontal,
|
child: ConstrainedBox(
|
||||||
children: [
|
constraints: const BoxConstraints(
|
||||||
Expanded(
|
maxWidth: 1000
|
||||||
child: Column(
|
),
|
||||||
|
child: const Column(
|
||||||
children: [
|
children: [
|
||||||
BudgetsActions(),
|
BudgetsActions(),
|
||||||
],
|
],
|
||||||
))
|
)
|
||||||
],
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:tunas/pages/data/widgets/account_settings.dart';
|
||||||
import 'package:tunas/pages/data/widgets/categories_settings.dart';
|
import 'package:tunas/pages/data/widgets/categories_settings.dart';
|
||||||
import 'package:tunas/pages/data/widgets/import_settings.dart';
|
import 'package:tunas/pages/data/widgets/import_settings.dart';
|
||||||
|
|
||||||
@@ -7,27 +8,33 @@ class DataPage extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Center(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 9, horizontal: 10),
|
child: Container(
|
||||||
margin: const EdgeInsets.symmetric(vertical: 2, horizontal: 10),
|
constraints: const BoxConstraints(
|
||||||
child: const Column(
|
maxWidth: 1000
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
),
|
||||||
children: [
|
padding: const EdgeInsets.symmetric(vertical: 9, horizontal: 10),
|
||||||
Text(
|
margin: const EdgeInsets.symmetric(vertical: 2, horizontal: 10),
|
||||||
'Settings',
|
child: const Column(
|
||||||
style: TextStyle(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
fontWeight: FontWeight.w900,
|
children: [
|
||||||
fontSize: 35,
|
Text(
|
||||||
|
'Settings',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w900,
|
||||||
|
fontSize: 35,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
Row(
|
||||||
Row(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
children: [
|
||||||
children: [
|
ImportSettings(),
|
||||||
ImportSettings(),
|
CategoriesSettings(),
|
||||||
CategoriesSettings()
|
AccountSettings(),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
50
lib/pages/data/widgets/account_settings.dart
Normal file
50
lib/pages/data/widgets/account_settings.dart
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:tunas/domains/account/account_bloc.dart';
|
||||||
|
|
||||||
|
class AccountSettings extends StatelessWidget {
|
||||||
|
const AccountSettings({super.key});
|
||||||
|
|
||||||
|
List<Widget> _computeCategoryList(Set<String> subAccounts) {
|
||||||
|
return subAccounts.map((subAccount) => Row(
|
||||||
|
children: [
|
||||||
|
Text(subAccount),
|
||||||
|
],
|
||||||
|
)).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BlocBuilder<AccountBloc, AccountState>(
|
||||||
|
builder: (context, state) => Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.blue,
|
||||||
|
borderRadius: BorderRadius.circular(5),
|
||||||
|
),
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 15),
|
||||||
|
margin: const EdgeInsets.all(5),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
const Text(
|
||||||
|
"Accounts",
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w900,
|
||||||
|
fontSize: 20,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
SingleChildScrollView(
|
||||||
|
scrollDirection: Axis.vertical,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: _computeCategoryList(state.subAccounts),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,23 +25,36 @@ class HomePage extends StatelessWidget {
|
|||||||
child: DefaultTabController(
|
child: DefaultTabController(
|
||||||
length: 4,
|
length: 4,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
body: Stack(
|
||||||
title: const Text('Tunas'),
|
|
||||||
bottom: const TabBar(
|
|
||||||
tabs: [
|
|
||||||
Tab(icon: Icon(Icons.insights)),
|
|
||||||
Tab(icon: Icon(Icons.receipt_long)),
|
|
||||||
Tab(icon: Icon(Icons.pie_chart)),
|
|
||||||
Tab(icon: Icon(Icons.settings)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
body: const TabBarView(
|
|
||||||
children: [
|
children: [
|
||||||
StatsPage(),
|
const TabBarView(
|
||||||
TransactionsPage(),
|
children: [
|
||||||
BudgetsPage(),
|
StatsPage(),
|
||||||
DataPage()
|
TransactionsPage(),
|
||||||
|
BudgetsPage(),
|
||||||
|
DataPage()
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.bottomCenter,
|
||||||
|
child: Container(
|
||||||
|
margin: const EdgeInsets.all(15),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: const Color.fromARGB(255, 41, 49, 56),
|
||||||
|
borderRadius: BorderRadius.circular(25)
|
||||||
|
),
|
||||||
|
child: TabBar(
|
||||||
|
tabAlignment: TabAlignment.center,
|
||||||
|
splashBorderRadius: BorderRadius.circular(25),
|
||||||
|
tabs: const [
|
||||||
|
Tab(icon: Icon(Icons.insights)),
|
||||||
|
Tab(icon: Icon(Icons.receipt_long)),
|
||||||
|
Tab(icon: Icon(Icons.pie_chart)),
|
||||||
|
Tab(icon: Icon(Icons.settings)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -20,24 +20,35 @@ class StatsPage extends StatelessWidget {
|
|||||||
child: BlocBuilder<ChartBloc, ChartState>(
|
child: BlocBuilder<ChartBloc, ChartState>(
|
||||||
builder: (context, state) => ListView(
|
builder: (context, state) => ListView(
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Center (
|
||||||
children: [
|
child: ConstrainedBox(
|
||||||
Expanded(
|
constraints: const BoxConstraints(
|
||||||
flex: 2,
|
maxWidth: 1000
|
||||||
child: MainCounter(value: state.globalTotal)
|
|
||||||
),
|
),
|
||||||
Expanded(
|
child: Column(
|
||||||
flex: 1,
|
children: [
|
||||||
child: AccountCounter(accountsTotals: state.accountsTotals)
|
Row(
|
||||||
),
|
children: [
|
||||||
],
|
Expanded(
|
||||||
),
|
flex: 2,
|
||||||
Row(
|
child: MainCounter(value: state.globalTotal)
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
),
|
||||||
children: [
|
Expanded(
|
||||||
const YearSelector(),
|
flex: 1,
|
||||||
ProfitIndicator(monthlyTotals: state.scopedMonthlyTotals)
|
child: AccountCounter(accountsTotals: state.accountsTotals)
|
||||||
],
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
const YearSelector(),
|
||||||
|
ProfitIndicator(profit: state.scoppedProfit)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
)
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 200,
|
height: 200,
|
||||||
@@ -47,14 +58,20 @@ class StatsPage extends StatelessWidget {
|
|||||||
height: 500,
|
height: 500,
|
||||||
child: MonthlyCategoriesTotalChart(categoriesMonthlyTotals: state.scopedCategoriesMonthlyTotals)
|
child: MonthlyCategoriesTotalChart(categoriesMonthlyTotals: state.scopedCategoriesMonthlyTotals)
|
||||||
),
|
),
|
||||||
SizedBox(
|
Center (
|
||||||
height: 450,
|
child: ConstrainedBox(
|
||||||
child: Row(
|
constraints: const BoxConstraints(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
maxWidth: 1500
|
||||||
children: [
|
),
|
||||||
CategoriesTotalsChart(categoriesTotals: state.scopedCategoriesPositiveTotals, categoriesTotalsPercents: state.scopedSimplifiedCategoriesPositiveTotalsPercents),
|
child: SizedBox(
|
||||||
CategoriesTotalsChart(categoriesTotals: state.scopedCategoriesNegativeTotals, categoriesTotalsPercents: state.scopedSimplifiedCategoriesNegativeTotalsPercents),
|
height: 450,
|
||||||
],
|
child: OverflowBar(
|
||||||
|
children: [
|
||||||
|
CategoriesTotalsChart(categoriesTotals: state.scopedCategoriesPositiveTotals, categoriesTotalsPercents: state.scopedSimplifiedCategoriesPositiveTotalsPercents),
|
||||||
|
CategoriesTotalsChart(categoriesTotals: state.scopedCategoriesNegativeTotals, categoriesTotalsPercents: state.scopedSimplifiedCategoriesNegativeTotalsPercents),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -10,7 +10,12 @@ class AccountCounter extends StatelessWidget {
|
|||||||
return accountsTotals.entries.toList().map((entry) => Row(
|
return accountsTotals.entries.toList().map((entry) => Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text(entry.key),
|
Flexible(
|
||||||
|
child: Text(
|
||||||
|
entry.key,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
)
|
||||||
|
),
|
||||||
Text(
|
Text(
|
||||||
NumberFormat('#######.00 €', 'fr_FR').format(entry.value),
|
NumberFormat('#######.00 €', 'fr_FR').format(entry.value),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class CategoriesTotalsChart extends StatelessWidget {
|
|||||||
return BlocBuilder<CategoryBloc, CategoryState>(
|
return BlocBuilder<CategoryBloc, CategoryState>(
|
||||||
builder: (context, state) => Container(
|
builder: (context, state) => Container(
|
||||||
height: 320,
|
height: 320,
|
||||||
width: 560,
|
width: 600,
|
||||||
padding: const EdgeInsets.all(10),
|
padding: const EdgeInsets.all(10),
|
||||||
margin: const EdgeInsets.all(20),
|
margin: const EdgeInsets.all(20),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
|
|||||||
@@ -1,25 +1,14 @@
|
|||||||
import 'package:fl_chart/fl_chart.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
class ProfitIndicator extends StatelessWidget {
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final profit = _profit();
|
|
||||||
return Container(
|
return Container(
|
||||||
margin: const EdgeInsets.fromLTRB(0, 0, 20, 0),
|
margin: const EdgeInsets.fromLTRB(0, 0, 20, 0),
|
||||||
padding: const EdgeInsets.fromLTRB(10, 5, 10, 5),
|
padding: const EdgeInsets.fromLTRB(10, 5, 10, 5),
|
||||||
|
|||||||
@@ -8,18 +8,19 @@ class TransactionsPage extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return const Flex(
|
return Center(
|
||||||
direction: Axis.horizontal,
|
child: ConstrainedBox(
|
||||||
children: [
|
constraints: const BoxConstraints(
|
||||||
Expanded(
|
maxWidth: 1000
|
||||||
child: Column(
|
),
|
||||||
|
child: const Column(
|
||||||
children: [
|
children: [
|
||||||
TransactionsActions(),
|
TransactionsActions(),
|
||||||
TransactionsHeader(),
|
TransactionsHeader(),
|
||||||
TransactionsList(),
|
TransactionsList(),
|
||||||
],
|
],
|
||||||
))
|
),
|
||||||
],
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class AutocompleteInput extends StatelessWidget {
|
|
||||||
final List<String> options;
|
|
||||||
final String hintText;
|
|
||||||
final String? errorText;
|
|
||||||
final String? initialValue;
|
|
||||||
final ValueChanged<String>? onChanged;
|
|
||||||
|
|
||||||
const AutocompleteInput({
|
|
||||||
super.key,
|
|
||||||
required this.options,
|
|
||||||
required this.hintText,
|
|
||||||
required this.errorText,
|
|
||||||
required this.initialValue,
|
|
||||||
required this.onChanged,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return RawAutocomplete<String>(
|
|
||||||
initialValue: TextEditingValue(text: initialValue ?? ''),
|
|
||||||
optionsBuilder: (TextEditingValue textEditingValue) => options.where((String option) =>option.contains(textEditingValue.text.toLowerCase())),
|
|
||||||
fieldViewBuilder: (
|
|
||||||
BuildContext context,
|
|
||||||
TextEditingController textEditingController,
|
|
||||||
FocusNode focusNode,
|
|
||||||
VoidCallback onFieldSubmitted,
|
|
||||||
) {
|
|
||||||
return TextFormField(
|
|
||||||
controller: textEditingController,
|
|
||||||
focusNode: focusNode,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
hintText: hintText,
|
|
||||||
errorText: errorText
|
|
||||||
),
|
|
||||||
onFieldSubmitted: (String value) {
|
|
||||||
onFieldSubmitted();
|
|
||||||
},
|
|
||||||
onChanged: onChanged,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
optionsViewBuilder: (
|
|
||||||
BuildContext context,
|
|
||||||
AutocompleteOnSelected<String> onSelected,
|
|
||||||
Iterable<String> options,
|
|
||||||
) {
|
|
||||||
return Align(
|
|
||||||
alignment: Alignment.topLeft,
|
|
||||||
child: Material(
|
|
||||||
elevation: 4.0,
|
|
||||||
child: SizedBox(
|
|
||||||
height: 200.0,
|
|
||||||
child: ListView.builder(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
itemCount: options.length,
|
|
||||||
itemBuilder: (BuildContext context, int index) {
|
|
||||||
final String option = options.elementAt(index);
|
|
||||||
return GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
onSelected(option);
|
|
||||||
},
|
|
||||||
child: ListTile(
|
|
||||||
title: Text(option),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:tunas/domains/account/account_bloc.dart';
|
||||||
import 'package:tunas/domains/category/category_bloc.dart';
|
import 'package:tunas/domains/category/category_bloc.dart';
|
||||||
import 'package:tunas/domains/transaction/transaction_bloc.dart';
|
import 'package:tunas/domains/transaction/transaction_bloc.dart';
|
||||||
import 'package:tunas/pages/transactions/widgets/transaction_form.dart';
|
import 'package:tunas/pages/transactions/widgets/transaction_form.dart';
|
||||||
@@ -18,6 +19,7 @@ class TransactionAddDialog extends StatelessWidget {
|
|||||||
providers: [
|
providers: [
|
||||||
BlocProvider.value(value: BlocProvider.of<TransactionBloc>(context)),
|
BlocProvider.value(value: BlocProvider.of<TransactionBloc>(context)),
|
||||||
BlocProvider.value(value: BlocProvider.of<CategoryBloc>(context)),
|
BlocProvider.value(value: BlocProvider.of<CategoryBloc>(context)),
|
||||||
|
BlocProvider.value(value: BlocProvider.of<AccountBloc>(context)),
|
||||||
],
|
],
|
||||||
child: const TransactionAddDialog()
|
child: const TransactionAddDialog()
|
||||||
)
|
)
|
||||||
@@ -55,10 +57,7 @@ class TransactionAddDialog extends StatelessWidget {
|
|||||||
builder: (context, state) => AlertDialog(
|
builder: (context, state) => AlertDialog(
|
||||||
title: Text(state.currentTransaction == null ? 'Add Transaction' : 'Edit Transaction'),
|
title: Text(state.currentTransaction == null ? 'Add Transaction' : 'Edit Transaction'),
|
||||||
actions: _computeActions(context, state.currentTransaction),
|
actions: _computeActions(context, state.currentTransaction),
|
||||||
content: const SizedBox(
|
content: const TransactionForm()
|
||||||
height: 400,
|
|
||||||
child: TransactionForm(),
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:tunas/domains/account/account_bloc.dart';
|
||||||
import 'package:tunas/domains/category/category_bloc.dart';
|
import 'package:tunas/domains/category/category_bloc.dart';
|
||||||
import 'package:tunas/domains/transaction/transaction_bloc.dart';
|
import 'package:tunas/domains/transaction/transaction_bloc.dart';
|
||||||
|
|
||||||
import 'autocomplete_input.dart';
|
|
||||||
|
|
||||||
class TransactionForm extends StatelessWidget {
|
class TransactionForm extends StatelessWidget {
|
||||||
|
|
||||||
const TransactionForm({super.key});
|
const TransactionForm({super.key});
|
||||||
@@ -13,11 +12,16 @@ class TransactionForm extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Column(
|
return Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
_TransactionDateInput(),
|
_TransactionDateInput(),
|
||||||
|
const SizedBox(height: 10,),
|
||||||
_TransactionCategoryInput(),
|
_TransactionCategoryInput(),
|
||||||
|
const SizedBox(height: 10,),
|
||||||
_TransactionDescriptionInput(),
|
_TransactionDescriptionInput(),
|
||||||
|
const SizedBox(height: 10,),
|
||||||
_TransactionAccountInput(),
|
_TransactionAccountInput(),
|
||||||
|
const SizedBox(height: 10,),
|
||||||
_TransactionValueInput()
|
_TransactionValueInput()
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@@ -41,11 +45,19 @@ class _TransactionDateInput extends StatelessWidget {
|
|||||||
context: context,
|
context: context,
|
||||||
firstDate: DateTime.fromMicrosecondsSinceEpoch(0),
|
firstDate: DateTime.fromMicrosecondsSinceEpoch(0),
|
||||||
lastDate: DateTime.now()
|
lastDate: DateTime.now()
|
||||||
).then((value) => context.read<TransactionBloc>().add(TransactionDateChange(value)));
|
).then((value) {
|
||||||
|
if (value != null) {
|
||||||
|
context.read<TransactionBloc>().add(TransactionDateChange(value));
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
|
icon: const Icon(Icons.calendar_month),
|
||||||
hintText: 'Date',
|
hintText: 'Date',
|
||||||
errorText: state.transactionDate.isNotValid ? state.transactionDate.error?.message : null
|
errorText: state.transactionDate.isNotValid ? state.transactionDate.error?.message : null,
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(5),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -61,12 +73,18 @@ class _TransactionCategoryInput extends StatelessWidget {
|
|||||||
buildWhen: (previous, current) => previous.transactionCategory != current.transactionCategory,
|
buildWhen: (previous, current) => previous.transactionCategory != current.transactionCategory,
|
||||||
builder: (context, state) => SizedBox(
|
builder: (context, state) => SizedBox(
|
||||||
width: 500,
|
width: 500,
|
||||||
child: AutocompleteInput(
|
child: DropdownButtonFormField<String>(
|
||||||
options: categoryState.categories.map((e) => e.label).toList(),
|
value: state.transactionCategory.value.toString() == '' ? null : state.transactionCategory.value.toString(),
|
||||||
hintText: 'Category',
|
onChanged: (value) => context.read<TransactionBloc>().add(TransactionCategoryChange(value!)),
|
||||||
initialValue: state.transactionCategory.value,
|
items: categoryState.categories.map((e) => DropdownMenuItem(value: e.label, child: Text(e.label))).toList(),
|
||||||
errorText: state.transactionCategory.isNotValid ? state.transactionCategory.error?.message : null,
|
decoration: InputDecoration(
|
||||||
onChanged: (value) => context.read<TransactionBloc>().add(TransactionCategoryChange(value)),
|
icon: const Icon(Icons.category),
|
||||||
|
hintText: 'Category',
|
||||||
|
errorText: state.transactionCategory.isNotValid ? state.transactionCategory.error?.message : null,
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(5),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -80,11 +98,16 @@ class _TransactionDescriptionInput extends StatelessWidget {
|
|||||||
buildWhen: (previous, current) => previous.transactionDescription != current.transactionDescription,
|
buildWhen: (previous, current) => previous.transactionDescription != current.transactionDescription,
|
||||||
builder: (context, state) => SizedBox(
|
builder: (context, state) => SizedBox(
|
||||||
width: 500,
|
width: 500,
|
||||||
child: TextField(
|
child: TextFormField(
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
|
icon: const Icon(Icons.description),
|
||||||
hintText: 'Description',
|
hintText: 'Description',
|
||||||
errorText: state.transactionDescription.isNotValid ? state.transactionDescription.error?.message : null
|
errorText: state.transactionDescription.isNotValid ? state.transactionDescription.error?.message : null,
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(5),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
initialValue: state.transactionDescription.value,
|
||||||
onChanged: (value) => context.read<TransactionBloc>().add(TransactionDescriptionChange(value))
|
onChanged: (value) => context.read<TransactionBloc>().add(TransactionDescriptionChange(value))
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
@@ -95,16 +118,23 @@ class _TransactionDescriptionInput extends StatelessWidget {
|
|||||||
class _TransactionAccountInput extends StatelessWidget {
|
class _TransactionAccountInput extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final accountState = context.watch<AccountBloc>().state;
|
||||||
return BlocBuilder<TransactionBloc, TransactionState>(
|
return BlocBuilder<TransactionBloc, TransactionState>(
|
||||||
buildWhen: (previous, current) => previous.transactionAccount != current.transactionAccount,
|
buildWhen: (previous, current) => previous.transactionAccount != current.transactionAccount,
|
||||||
builder: (context, state) => SizedBox(
|
builder: (context, state) => SizedBox(
|
||||||
width: 500,
|
width: 500,
|
||||||
child: AutocompleteInput(
|
child: DropdownButtonFormField<String>(
|
||||||
options: state.accountsTotals.keys.toList(),
|
value: state.transactionAccount.value.toString() == '' ? null : state.transactionAccount.value.toString(),
|
||||||
hintText: 'Account',
|
onChanged: (value) => context.read<TransactionBloc>().add(TransactionAccountChange(value!)),
|
||||||
initialValue: state.transactionAccount.value,
|
items: accountState.subAccounts.map((e) => DropdownMenuItem(value: e, child: Text(e))).toList(),
|
||||||
errorText: state.transactionAccount.isNotValid ? state.transactionAccount.error?.message : null,
|
decoration: InputDecoration(
|
||||||
onChanged: (value) => context.read<TransactionBloc>().add(TransactionAccountChange(value)),
|
icon: const Icon(Icons.account_box),
|
||||||
|
hintText: 'Account',
|
||||||
|
errorText: state.transactionAccount.isNotValid ? state.transactionAccount.error?.message : null,
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(5),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -118,12 +148,17 @@ class _TransactionValueInput extends StatelessWidget {
|
|||||||
buildWhen: (previous, current) => previous.transactionValue != current.transactionValue,
|
buildWhen: (previous, current) => previous.transactionValue != current.transactionValue,
|
||||||
builder: (context, state) => SizedBox(
|
builder: (context, state) => SizedBox(
|
||||||
width: 500,
|
width: 500,
|
||||||
child: TextField(
|
child: TextFormField(
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
|
icon: const Icon(Icons.euro),
|
||||||
hintText: '\$\$\$',
|
hintText: '\$\$\$',
|
||||||
errorText: state.transactionValue.isNotValid ? state.transactionValue.error?.message : null
|
errorText: state.transactionValue.isNotValid ? state.transactionValue.error?.message : null,
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(5),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
initialValue: state.transactionValue.value.toString(),
|
||||||
onChanged: (value) => context.read<TransactionBloc>().add(TransactionValueChange(value))
|
onChanged: (value) => context.read<TransactionBloc>().add(TransactionValueChange(value))
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ class AccountRepository {
|
|||||||
final _transactionsController = BehaviorSubject<List<Transaction>>.seeded(const []);
|
final _transactionsController = BehaviorSubject<List<Transaction>>.seeded(const []);
|
||||||
final _categoriesController = BehaviorSubject<List<Category>>.seeded(const []);
|
final _categoriesController = BehaviorSubject<List<Category>>.seeded(const []);
|
||||||
final _budgetController = BehaviorSubject<List<Budget>>.seeded(const []);
|
final _budgetController = BehaviorSubject<List<Budget>>.seeded(const []);
|
||||||
|
final _subAccountController = BehaviorSubject<Set<String>>.seeded(const {});
|
||||||
|
|
||||||
AccountRepository({
|
AccountRepository({
|
||||||
required storageClient,
|
required storageClient,
|
||||||
@@ -25,9 +26,7 @@ class AccountRepository {
|
|||||||
|
|
||||||
init() async {
|
init() async {
|
||||||
final account = await getAccount();
|
final account = await getAccount();
|
||||||
_transactionsController.add(account.transactions);
|
_broadcastAccountData(account);
|
||||||
_categoriesController.add(account.categories);
|
|
||||||
_budgetController.add(account.budgets);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<List<Transaction>> getTransactionsStream() {
|
Stream<List<Transaction>> getTransactionsStream() {
|
||||||
@@ -42,6 +41,10 @@ class AccountRepository {
|
|||||||
return _budgetController.asBroadcastStream();
|
return _budgetController.asBroadcastStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Stream<Set<String>> getSubAccountsStream() {
|
||||||
|
return _subAccountController.asBroadcastStream();
|
||||||
|
}
|
||||||
|
|
||||||
Future<Account> getAccount() async {
|
Future<Account> getAccount() async {
|
||||||
String json = await _storageClient.load(accountFile);
|
String json = await _storageClient.load(accountFile);
|
||||||
Map<String, dynamic> accountJson = jsonDecode(json);
|
Map<String, dynamic> accountJson = jsonDecode(json);
|
||||||
@@ -72,5 +75,6 @@ class AccountRepository {
|
|||||||
_transactionsController.add(account.transactions);
|
_transactionsController.add(account.transactions);
|
||||||
_categoriesController.add(account.categories);
|
_categoriesController.add(account.categories);
|
||||||
_budgetController.add(account.budgets);
|
_budgetController.add(account.budgets);
|
||||||
|
_subAccountController.add(account.subAccounts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,11 +9,13 @@ class Account {
|
|||||||
List<Transaction> transactions;
|
List<Transaction> transactions;
|
||||||
List<Budget> budgets;
|
List<Budget> budgets;
|
||||||
List<Category> categories;
|
List<Category> categories;
|
||||||
|
Set<String> subAccounts;
|
||||||
|
|
||||||
Account({
|
Account({
|
||||||
this.transactions = const [],
|
this.transactions = const [],
|
||||||
this.budgets = const [],
|
this.budgets = const [],
|
||||||
this.categories = const [],
|
this.categories = const [],
|
||||||
|
this.subAccounts = const {},
|
||||||
});
|
});
|
||||||
|
|
||||||
factory Account.fromJson(Map<String, dynamic> json) {
|
factory Account.fromJson(Map<String, dynamic> json) {
|
||||||
@@ -21,6 +23,7 @@ class Account {
|
|||||||
transactions: (jsonDecode(json['transactions']) as List<dynamic>).map((transaction) => Transaction.fromJson(transaction)).toList(),
|
transactions: (jsonDecode(json['transactions']) as List<dynamic>).map((transaction) => Transaction.fromJson(transaction)).toList(),
|
||||||
budgets: (jsonDecode(json['budgets']) as List<dynamic>).map((budget) => Budget.fromJson(budget)).toList(),
|
budgets: (jsonDecode(json['budgets']) as List<dynamic>).map((budget) => Budget.fromJson(budget)).toList(),
|
||||||
categories: (jsonDecode(json['categories']) as List<dynamic>).map((category) => Category.fromJson(category)).toList(),
|
categories: (jsonDecode(json['categories']) as List<dynamic>).map((category) => Category.fromJson(category)).toList(),
|
||||||
|
subAccounts: Set.from(jsonDecode(json['subAccounts'])),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,5 +31,6 @@ class Account {
|
|||||||
'transactions': jsonEncode(transactions.map((transaction) => transaction.toJson()).toList()),
|
'transactions': jsonEncode(transactions.map((transaction) => transaction.toJson()).toList()),
|
||||||
'budgets': jsonEncode(budgets.map((budget) => budget.toJson()).toList()),
|
'budgets': jsonEncode(budgets.map((budget) => budget.toJson()).toList()),
|
||||||
'categories': jsonEncode(categories.map((category) => category.toJson()).toList()),
|
'categories': jsonEncode(categories.map((category) => category.toJson()).toList()),
|
||||||
|
'subAccounts': jsonEncode(subAccounts.toList()),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
90
pubspec.lock
90
pubspec.lock
@@ -134,6 +134,54 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "8.1.3"
|
version: "8.1.3"
|
||||||
|
flutter_keyboard_visibility:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: flutter_keyboard_visibility
|
||||||
|
sha256: "98664be7be0e3ffca00de50f7f6a287ab62c763fc8c762e0a21584584a3ff4f8"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "6.0.0"
|
||||||
|
flutter_keyboard_visibility_linux:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: flutter_keyboard_visibility_linux
|
||||||
|
sha256: "6fba7cd9bb033b6ddd8c2beb4c99ad02d728f1e6e6d9b9446667398b2ac39f08"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
|
flutter_keyboard_visibility_macos:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: flutter_keyboard_visibility_macos
|
||||||
|
sha256: c5c49b16fff453dfdafdc16f26bdd8fb8d55812a1d50b0ce25fc8d9f2e53d086
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
|
flutter_keyboard_visibility_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: flutter_keyboard_visibility_platform_interface
|
||||||
|
sha256: e43a89845873f7be10cb3884345ceb9aebf00a659f479d1c8f4293fcb37022a4
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.0"
|
||||||
|
flutter_keyboard_visibility_web:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: flutter_keyboard_visibility_web
|
||||||
|
sha256: d3771a2e752880c79203f8d80658401d0c998e4183edca05a149f5098ce6e3d1
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.0"
|
||||||
|
flutter_keyboard_visibility_windows:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: flutter_keyboard_visibility_windows
|
||||||
|
sha256: fc4b0f0b6be9b93ae527f3d527fb56ee2d918cd88bbca438c478af7bcfd0ef73
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
flutter_lints:
|
flutter_lints:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
@@ -160,6 +208,14 @@ packages:
|
|||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
flutter_typeahead:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: flutter_typeahead
|
||||||
|
sha256: d64712c65db240b1057559b952398ebb6e498077baeebf9b0731dade62438a6d
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "5.2.0"
|
||||||
flutter_web_plugins:
|
flutter_web_plugins:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description: flutter
|
description: flutter
|
||||||
@@ -301,6 +357,38 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.7"
|
version: "2.1.7"
|
||||||
|
pointer_interceptor:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: pointer_interceptor
|
||||||
|
sha256: bd18321519718678d5fa98ad3a3359cbc7a31f018554eab80b73d08a7f0c165a
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.10.1"
|
||||||
|
pointer_interceptor_ios:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: pointer_interceptor_ios
|
||||||
|
sha256: "2e73c39452830adc4695757130676a39412a3b7f3c34e3f752791b5384770877"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.10.0+2"
|
||||||
|
pointer_interceptor_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: pointer_interceptor_platform_interface
|
||||||
|
sha256: "0597b0560e14354baeb23f8375cd612e8bd4841bf8306ecb71fcd0bb78552506"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.10.0+1"
|
||||||
|
pointer_interceptor_web:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: pointer_interceptor_web
|
||||||
|
sha256: "9386e064097fd16419e935c23f08f35b58e6aaec155dd39bd6a003b88f9c14b4"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.10.1+2"
|
||||||
provider:
|
provider:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -428,4 +516,4 @@ packages:
|
|||||||
version: "1.0.3"
|
version: "1.0.3"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=3.2.2 <4.0.0"
|
dart: ">=3.2.2 <4.0.0"
|
||||||
flutter: ">=3.7.0"
|
flutter: ">=3.16.0"
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ dependencies:
|
|||||||
intl: any
|
intl: any
|
||||||
formz: ^0.6.1
|
formz: ^0.6.1
|
||||||
uuid: ^4.3.2
|
uuid: ^4.3.2
|
||||||
|
flutter_typeahead: ^5.2.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Reference in New Issue
Block a user