Compare commits
2 Commits
2006ebf5cb
...
979fecb60a
| Author | SHA1 | Date | |
|---|---|---|---|
| 979fecb60a | |||
| 2b53d1ab74 |
58
lib/app.dart
58
lib/app.dart
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:dynamic_color/dynamic_color.dart';
|
||||||
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:flutter_localizations/flutter_localizations.dart';
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||||
@@ -6,7 +7,6 @@ import 'package:tunas/pages/home/home_page.dart';
|
|||||||
import 'package:tunas/repositories/json/json_repository.dart';
|
import 'package:tunas/repositories/json/json_repository.dart';
|
||||||
import 'package:tunas/repositories/metadata/metadata_repository.dart';
|
import 'package:tunas/repositories/metadata/metadata_repository.dart';
|
||||||
import 'package:tunas/repositories/transactions/transactions_repository.dart';
|
import 'package:tunas/repositories/transactions/transactions_repository.dart';
|
||||||
import 'package:tunas/theme.dart';
|
|
||||||
|
|
||||||
class App extends StatefulWidget {
|
class App extends StatefulWidget {
|
||||||
const App({super.key});
|
const App({super.key});
|
||||||
@@ -56,24 +56,44 @@ class _AppViewState extends State<AppView> {
|
|||||||
RepositoryProvider.value(value: _transactionsRepository),
|
RepositoryProvider.value(value: _transactionsRepository),
|
||||||
RepositoryProvider.value(value: _metadataRepository),
|
RepositoryProvider.value(value: _metadataRepository),
|
||||||
],
|
],
|
||||||
child: MaterialApp(
|
child: DynamicColorBuilder(
|
||||||
title: 'Tunas',
|
builder: ((lightDynamic, darkDynamic) {
|
||||||
theme: ThemeData(useMaterial3: true, colorScheme: lightColorScheme),
|
ColorScheme lightColorScheme;
|
||||||
darkTheme: ThemeData(useMaterial3: true, colorScheme: darkColorScheme),
|
ColorScheme darkColorScheme;
|
||||||
themeMode: ThemeMode.dark,
|
|
||||||
initialRoute: '/home',
|
if (lightDynamic != null && darkDynamic != null) {
|
||||||
routes: {
|
lightColorScheme = lightDynamic.harmonized();
|
||||||
'/home':(context) => const HomePage(),
|
darkColorScheme = darkDynamic.harmonized();
|
||||||
},
|
} else {
|
||||||
localizationsDelegates: const [
|
lightColorScheme = ColorScheme.fromSeed(
|
||||||
GlobalMaterialLocalizations.delegate,
|
seedColor: const Color.fromARGB(1, 5, 236, 55),
|
||||||
GlobalWidgetsLocalizations.delegate,
|
);
|
||||||
GlobalCupertinoLocalizations.delegate
|
|
||||||
],
|
darkColorScheme = ColorScheme.fromSeed(
|
||||||
supportedLocales: const [
|
seedColor: const Color.fromARGB(1, 5, 236, 55),
|
||||||
Locale('fr')
|
brightness: Brightness.dark,
|
||||||
],
|
);
|
||||||
)
|
}
|
||||||
|
|
||||||
|
return MaterialApp(
|
||||||
|
title: 'Tunas',
|
||||||
|
theme: ThemeData(colorScheme: lightColorScheme),
|
||||||
|
darkTheme: ThemeData(colorScheme: darkColorScheme),
|
||||||
|
initialRoute: '/home',
|
||||||
|
routes: {
|
||||||
|
'/home':(context) => const HomePage(),
|
||||||
|
},
|
||||||
|
localizationsDelegates: const [
|
||||||
|
GlobalMaterialLocalizations.delegate,
|
||||||
|
GlobalWidgetsLocalizations.delegate,
|
||||||
|
GlobalCupertinoLocalizations.delegate
|
||||||
|
],
|
||||||
|
supportedLocales: const [
|
||||||
|
Locale('fr')
|
||||||
|
],
|
||||||
|
);
|
||||||
|
})
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -172,10 +172,7 @@ class AccountBloc extends Bloc<AccountEvent, AccountState> {
|
|||||||
|
|
||||||
_onAccountEditLabel(AccountEditLabel event, Emitter<AccountState> emit) async {
|
_onAccountEditLabel(AccountEditLabel event, Emitter<AccountState> emit) async {
|
||||||
Account account = event.account;
|
Account account = event.account;
|
||||||
account.label = event.label;
|
// TODO check for existance, rename every transaction
|
||||||
emit(
|
|
||||||
state.copyWith(await _saveAccount(account))
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_onAccountEditSaving(AccountEditSaving event, Emitter<AccountState> emit) async {
|
_onAccountEditSaving(AccountEditSaving event, Emitter<AccountState> emit) async {
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:tunas/repositories/metadata/models/budget.dart';
|
import 'package:tunas/repositories/metadata/models/budget.dart';
|
||||||
@@ -11,6 +13,11 @@ class BudgetBloc extends Bloc<BudgetEvent, BudgetState> {
|
|||||||
|
|
||||||
BudgetBloc({required MetadataRepository metadataRepository}) : _metadataRepository = metadataRepository, super(const BudgetState()) {
|
BudgetBloc({required MetadataRepository metadataRepository}) : _metadataRepository = metadataRepository, super(const BudgetState()) {
|
||||||
on<BudgetsLoad>(_onBudgetsLoad);
|
on<BudgetsLoad>(_onBudgetsLoad);
|
||||||
|
on<BudgetAdd>(_onBudgetAdd);
|
||||||
|
on<BudgetRemove>(_onBudgetRemove);
|
||||||
|
on<BudgetSetValue>(_onBudgetSetValue);
|
||||||
|
on<BudgetCompareNext>(_onBudgetCompareNext);
|
||||||
|
on<BudgetComparePrevious>(_onBudgetComparePrevious);
|
||||||
|
|
||||||
_metadataRepository
|
_metadataRepository
|
||||||
.getBudgetsStream()
|
.getBudgetsStream()
|
||||||
@@ -24,4 +31,68 @@ class BudgetBloc extends Bloc<BudgetEvent, BudgetState> {
|
|||||||
budgets: event.budgets,
|
budgets: event.budgets,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FutureOr<void> _onBudgetAdd(BudgetAdd event, Emitter<BudgetState> emit) async {
|
||||||
|
Budget budget = Budget(
|
||||||
|
label: event.label,
|
||||||
|
);
|
||||||
|
|
||||||
|
emit(_computeState(await _saveBudget(budget)));
|
||||||
|
}
|
||||||
|
|
||||||
|
FutureOr<void> _onBudgetRemove(BudgetRemove event, Emitter<BudgetState> emit) async {
|
||||||
|
List<Budget> budgets = _metadataRepository.getBudgets();
|
||||||
|
Budget budgetToRemove = event.budget;
|
||||||
|
|
||||||
|
budgets.removeWhere((budget) => budget.label == budgetToRemove.label);
|
||||||
|
emit(_computeState(await _metadataRepository.saveBudgets(budgets)));
|
||||||
|
}
|
||||||
|
|
||||||
|
FutureOr<void> _onBudgetSetValue(BudgetSetValue event, Emitter<BudgetState> emit) async {
|
||||||
|
Budget budgetToUpdate = event.budget;
|
||||||
|
|
||||||
|
if (state.remainingBudget - (event.value - budgetToUpdate.value) < 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (state.remainingBudget - event.value < 0 && state.remainingBudget < 10) {
|
||||||
|
// budgetToUpdate.value =
|
||||||
|
// } else {
|
||||||
|
// budgetToUpdate.value = event.value;
|
||||||
|
// }
|
||||||
|
budgetToUpdate.value = event.value;
|
||||||
|
|
||||||
|
emit(_computeState(await _saveBudget(budgetToUpdate)));
|
||||||
|
}
|
||||||
|
|
||||||
|
FutureOr<void> _onBudgetCompareNext(BudgetCompareNext event, Emitter<BudgetState> emit) {
|
||||||
|
}
|
||||||
|
|
||||||
|
FutureOr<void> _onBudgetComparePrevious(BudgetComparePrevious event, Emitter<BudgetState> emit) {
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<List<Budget>> _saveBudget(Budget budgetToSave) async {
|
||||||
|
List<Budget> budgets = _metadataRepository.getBudgets();
|
||||||
|
|
||||||
|
try {
|
||||||
|
Budget budgetFound = budgets.firstWhere((category) => category.label == budgetToSave.label);
|
||||||
|
budgetFound.value = budgetToSave.value;
|
||||||
|
} catch (e) {
|
||||||
|
if (budgets.isEmpty) {
|
||||||
|
budgets = [budgetToSave];
|
||||||
|
} else {
|
||||||
|
budgets.add(budgetToSave);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// _metadataRepository.saveBudgets(budgets);
|
||||||
|
return budgets;
|
||||||
|
}
|
||||||
|
|
||||||
|
BudgetState _computeState(List<Budget> budgets) {
|
||||||
|
return state.copyWith(
|
||||||
|
budgets: budgets,
|
||||||
|
remainingBudget: state.initialBudget - budgets.map((budget) => budget.value).reduce((value, element) => value + element),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -13,4 +13,35 @@ final class BudgetsLoad extends BudgetEvent {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [budgets];
|
List<Object> get props => [budgets];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final class BudgetAdd extends BudgetEvent {
|
||||||
|
final String label;
|
||||||
|
|
||||||
|
const BudgetAdd(this.label);
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [label];
|
||||||
|
}
|
||||||
|
|
||||||
|
final class BudgetRemove extends BudgetEvent {
|
||||||
|
final Budget budget;
|
||||||
|
|
||||||
|
const BudgetRemove(this.budget);
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [budget];
|
||||||
|
}
|
||||||
|
|
||||||
|
final class BudgetSetValue extends BudgetEvent {
|
||||||
|
final Budget budget;
|
||||||
|
final double value;
|
||||||
|
|
||||||
|
const BudgetSetValue(this.budget, this.value);
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [budget, value];
|
||||||
|
}
|
||||||
|
|
||||||
|
final class BudgetCompareNext extends BudgetEvent {}
|
||||||
|
final class BudgetComparePrevious extends BudgetEvent {}
|
||||||
@@ -1,20 +1,25 @@
|
|||||||
part of 'budget_bloc.dart';
|
part of 'budget_bloc.dart';
|
||||||
|
|
||||||
final class BudgetState extends Equatable {
|
final class BudgetState {
|
||||||
final List<Budget> budgets;
|
final List<Budget> budgets;
|
||||||
|
final double initialBudget;
|
||||||
|
final double remainingBudget;
|
||||||
|
|
||||||
const BudgetState({
|
const BudgetState({
|
||||||
this.budgets = const [],
|
this.budgets = const [],
|
||||||
|
this.initialBudget = 2300.0,
|
||||||
|
this.remainingBudget = 2300.0,
|
||||||
});
|
});
|
||||||
|
|
||||||
BudgetState copyWith({
|
BudgetState copyWith({
|
||||||
List<Budget>? budgets,
|
List<Budget>? budgets,
|
||||||
|
double? initialBudget,
|
||||||
|
double? remainingBudget,
|
||||||
}) {
|
}) {
|
||||||
return BudgetState(
|
return BudgetState(
|
||||||
budgets: budgets ?? this.budgets,
|
budgets: budgets ?? this.budgets,
|
||||||
|
initialBudget: initialBudget ?? this.initialBudget,
|
||||||
|
remainingBudget: remainingBudget ?? this.remainingBudget,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@override
|
|
||||||
List<Object?> get props => [budgets];
|
|
||||||
}
|
|
||||||
@@ -1,18 +1,35 @@
|
|||||||
|
import 'dart:async';
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:tunas/repositories/metadata/metadata_repository.dart';
|
import 'package:tunas/repositories/metadata/metadata_repository.dart';
|
||||||
import 'package:tunas/repositories/metadata/models/category.dart';
|
import 'package:tunas/repositories/metadata/models/category.dart';
|
||||||
|
import 'package:tunas/repositories/transactions/models/transaction.dart';
|
||||||
|
import 'package:tunas/repositories/transactions/transactions_repository.dart';
|
||||||
|
import 'package:uuid/uuid.dart';
|
||||||
|
|
||||||
part 'category_event.dart';
|
part 'category_event.dart';
|
||||||
part 'category_state.dart';
|
part 'category_state.dart';
|
||||||
|
|
||||||
class CategoryBloc extends Bloc<CategoryEvent, CategoryState> {
|
class CategoryBloc extends Bloc<CategoryEvent, CategoryState> {
|
||||||
final MetadataRepository _metadataRepository;
|
final MetadataRepository _metadataRepository;
|
||||||
|
final TransactionsRepository _transactionsRepository;
|
||||||
|
|
||||||
CategoryBloc({required MetadataRepository metadataRepository}) : _metadataRepository = metadataRepository, super(const CategoryState()) {
|
CategoryBloc({
|
||||||
|
required MetadataRepository metadataRepository,
|
||||||
|
required TransactionsRepository transactionsRepository,
|
||||||
|
})
|
||||||
|
: _metadataRepository = metadataRepository,
|
||||||
|
_transactionsRepository = transactionsRepository,
|
||||||
|
super(const CategoryState()) {
|
||||||
on<CategoriesLoad>(_onCategoriesLoad);
|
on<CategoriesLoad>(_onCategoriesLoad);
|
||||||
|
on<CategoryEditColor>(_onCategoryEditColor);
|
||||||
|
on<CategoryEditTransfert>(_onCategoryEditTransfert);
|
||||||
|
on<CategoryEditEssential>(_onCategoryEditEssential);
|
||||||
|
on<CategoryEditLabel>(_onCategoryEditLabel);
|
||||||
|
on<CategoryRemove>(_onCategoryRemove);
|
||||||
|
on<CategoryAdd>(_onCategoryAdd);
|
||||||
|
|
||||||
_metadataRepository
|
_metadataRepository
|
||||||
.getCategoriesStream()
|
.getCategoriesStream()
|
||||||
@@ -22,9 +39,81 @@ class CategoryBloc extends Bloc<CategoryEvent, CategoryState> {
|
|||||||
_onCategoriesLoad(
|
_onCategoriesLoad(
|
||||||
CategoriesLoad event, Emitter<CategoryState> emit
|
CategoriesLoad event, Emitter<CategoryState> emit
|
||||||
) {
|
) {
|
||||||
emit(state.copyWith(
|
emit(_computeState(event.categories));
|
||||||
categories: event.categories,
|
}
|
||||||
categoriesColors: { for (var category in event.categories) category.label : category.rgbToColor() }
|
|
||||||
));
|
FutureOr<void> _onCategoryEditColor(CategoryEditColor event, Emitter<CategoryState> emit) async {
|
||||||
|
Category category = event.category;
|
||||||
|
category.color = event.color;
|
||||||
|
emit(_computeState(await _saveCategory(category)));
|
||||||
|
}
|
||||||
|
|
||||||
|
FutureOr<void> _onCategoryEditTransfert(CategoryEditTransfert event, Emitter<CategoryState> emit) async {
|
||||||
|
Category category = event.category;
|
||||||
|
category.transfert = event.transfert;
|
||||||
|
emit(_computeState(await _saveCategory(category)));
|
||||||
|
}
|
||||||
|
|
||||||
|
FutureOr<void> _onCategoryEditEssential(CategoryEditEssential event, Emitter<CategoryState> emit) async {
|
||||||
|
Category category = event.category;
|
||||||
|
category.essential = event.essential;
|
||||||
|
emit(_computeState(await _saveCategory(category)));
|
||||||
|
}
|
||||||
|
|
||||||
|
FutureOr<void> _onCategoryEditLabel(CategoryEditLabel event, Emitter<CategoryState> emit) async {
|
||||||
|
// TODO check for existance, rename every transaction
|
||||||
|
}
|
||||||
|
|
||||||
|
FutureOr<void> _onCategoryRemove(CategoryRemove event, Emitter<CategoryState> emit) async {
|
||||||
|
CategoryState originalCategoryState = state.copyWith();
|
||||||
|
Category categoryToRemove = event.category;
|
||||||
|
List<Category> categories = state.categories;
|
||||||
|
List<Transaction> transactions = _transactionsRepository.getTransactions();
|
||||||
|
|
||||||
|
if (transactions.any((transaction) => transaction.category == categoryToRemove.label)) {
|
||||||
|
emit(CategoryRemoveFail());
|
||||||
|
emit(originalCategoryState);
|
||||||
|
} else {
|
||||||
|
categories.removeWhere((category) => category.label == categoryToRemove.label);
|
||||||
|
emit(CategoryRemoveSucess());
|
||||||
|
emit(_computeState(await _metadataRepository.saveCategories(categories)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FutureOr<void> _onCategoryAdd(CategoryAdd event, Emitter<CategoryState> emit) async {
|
||||||
|
String uuid = const Uuid().v8();
|
||||||
|
Category category = Category(
|
||||||
|
label: 'Category $uuid',
|
||||||
|
color: 'FF74feff',
|
||||||
|
);
|
||||||
|
|
||||||
|
emit(_computeState(await _saveCategory(category)));
|
||||||
|
}
|
||||||
|
|
||||||
|
_saveCategory(Category categoryToSave) async {
|
||||||
|
List<Category> categories = _metadataRepository.getCategories();
|
||||||
|
|
||||||
|
try {
|
||||||
|
Category categoryFound = categories.firstWhere((category) => category.label == categoryToSave.label);
|
||||||
|
categoryFound.color = categoryToSave.color;
|
||||||
|
categoryFound.essential = categoryToSave.essential;
|
||||||
|
categoryFound.transfert = categoryToSave.transfert;
|
||||||
|
} catch (e) {
|
||||||
|
if (categories.isEmpty) {
|
||||||
|
categories = [categoryToSave];
|
||||||
|
} else {
|
||||||
|
categories.add(categoryToSave);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await _metadataRepository.saveCategories(categories);
|
||||||
|
return categories;
|
||||||
|
}
|
||||||
|
|
||||||
|
CategoryState _computeState(List<Category> categories) {
|
||||||
|
return state.copyWith(
|
||||||
|
categories: categories,
|
||||||
|
categoriesColors: { for (var category in categories) category.label : category.rgbToColor() }
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,4 +13,55 @@ final class CategoriesLoad extends CategoryEvent {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [categories];
|
List<Object> get props => [categories];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final class CategoryEditColor extends CategoryEvent {
|
||||||
|
final Category category;
|
||||||
|
final String color;
|
||||||
|
|
||||||
|
const CategoryEditColor(this.category, this.color);
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [category, color];
|
||||||
|
}
|
||||||
|
|
||||||
|
final class CategoryEditTransfert extends CategoryEvent {
|
||||||
|
final Category category;
|
||||||
|
final bool transfert;
|
||||||
|
|
||||||
|
const CategoryEditTransfert(this.category, this.transfert);
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [category, transfert];
|
||||||
|
}
|
||||||
|
|
||||||
|
final class CategoryEditEssential extends CategoryEvent {
|
||||||
|
final Category category;
|
||||||
|
final bool essential;
|
||||||
|
|
||||||
|
const CategoryEditEssential(this.category, this.essential);
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [category, essential];
|
||||||
|
}
|
||||||
|
|
||||||
|
final class CategoryEditLabel extends CategoryEvent {
|
||||||
|
final Category category;
|
||||||
|
final String label;
|
||||||
|
|
||||||
|
const CategoryEditLabel(this.category, this.label);
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [category, label];
|
||||||
|
}
|
||||||
|
|
||||||
|
final class CategoryRemove extends CategoryEvent {
|
||||||
|
final Category category;
|
||||||
|
|
||||||
|
const CategoryRemove(this.category);
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [category];
|
||||||
|
}
|
||||||
|
|
||||||
|
final class CategoryAdd extends CategoryEvent {}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
part of 'category_bloc.dart';
|
part of 'category_bloc.dart';
|
||||||
|
|
||||||
final class CategoryState extends Equatable {
|
final class CategoryState {
|
||||||
final List<Category> categories;
|
final List<Category> categories;
|
||||||
final Map<String, Color> categoriesColors;
|
final Map<String, Color> categoriesColors;
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ final class CategoryState extends Equatable {
|
|||||||
categoriesColors: categoriesColors ?? this.categoriesColors,
|
categoriesColors: categoriesColors ?? this.categoriesColors,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
List<Object> get props => [categories, categoriesColors];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final class CategoryRemoveFail extends CategoryState {}
|
||||||
|
final class CategoryRemoveSucess extends CategoryState {}
|
||||||
@@ -113,7 +113,7 @@ class ChartBloc extends Bloc<ChartEvent, ChartState> {
|
|||||||
double scoppedTotal = 0;
|
double scoppedTotal = 0;
|
||||||
List<ChartItem> scopedCategoriesPositiveTotals = [];
|
List<ChartItem> scopedCategoriesPositiveTotals = [];
|
||||||
List<ChartItem> scopedCategoriesNegativeTotals = [];
|
List<ChartItem> scopedCategoriesNegativeTotals = [];
|
||||||
Map<int, FlSpot> scopedMonthlyTotals = {};
|
Map<int, FlSpot> scopedMonthlyTotalsMap = {};
|
||||||
Map<int, MonthTotals> scopedCategoriesMonthlyTotals = {};
|
Map<int, MonthTotals> scopedCategoriesMonthlyTotals = {};
|
||||||
|
|
||||||
Map<int, double> scopedMonthlyPostitiveTotals = {};
|
Map<int, double> scopedMonthlyPostitiveTotals = {};
|
||||||
@@ -134,7 +134,7 @@ class ChartBloc extends Bloc<ChartEvent, ChartState> {
|
|||||||
DateTime transactionDate = transactionLine.transaction.date;
|
DateTime transactionDate = transactionLine.transaction.date;
|
||||||
int transactionDateDay = transactionDate.difference(DateTime(transactionDate.year,1,1)).inDays + 1;
|
int transactionDateDay = transactionDate.difference(DateTime(transactionDate.year,1,1)).inDays + 1;
|
||||||
|
|
||||||
scopedMonthlyTotals[transactionDateDay] = FlSpot(transactionDateDay.toDouble(), transactionLine.subTotal);
|
scopedMonthlyTotalsMap[transactionDateDay] = FlSpot(transactionDateDay.toDouble(), transactionLine.subTotal);
|
||||||
|
|
||||||
final category = state.categories[transaction.category];
|
final category = state.categories[transaction.category];
|
||||||
if (category == null || category.transfert) {
|
if (category == null || category.transfert) {
|
||||||
@@ -229,6 +229,9 @@ class ChartBloc extends Bloc<ChartEvent, ChartState> {
|
|||||||
_sortMapByValues(monthTotals.negatives);
|
_sortMapByValues(monthTotals.negatives);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<FlSpot> scopedMonthlyTotals = scopedMonthlyTotalsMap.values.toList();
|
||||||
|
scopedMonthlyTotals.sort((a, b) => a.x.compareTo(b.x));
|
||||||
|
|
||||||
return state.copyWith(
|
return state.copyWith(
|
||||||
scoppedProfit: scoppedTotal,
|
scoppedProfit: scoppedTotal,
|
||||||
scopedCategoriesPositiveTotals: scopedCategoriesPositiveTotals,
|
scopedCategoriesPositiveTotals: scopedCategoriesPositiveTotals,
|
||||||
@@ -239,7 +242,7 @@ class ChartBloc extends Bloc<ChartEvent, ChartState> {
|
|||||||
scopedSimplifiedCategoriesPositiveTotalsPercents: scopedSimplifiedCategoriesPositiveTotalsPercents,
|
scopedSimplifiedCategoriesPositiveTotalsPercents: scopedSimplifiedCategoriesPositiveTotalsPercents,
|
||||||
scopedSimplifiedCategoriesNegativeTotals: scopedSimplifiedCategoriesNegativeTotals,
|
scopedSimplifiedCategoriesNegativeTotals: scopedSimplifiedCategoriesNegativeTotals,
|
||||||
scopedSimplifiedCategoriesNegativeTotalsPercents: scopedSimplifiedCategoriesNegativeTotalsPercents,
|
scopedSimplifiedCategoriesNegativeTotalsPercents: scopedSimplifiedCategoriesNegativeTotalsPercents,
|
||||||
scopedMonthlyTotals: scopedMonthlyTotals.values.toList(),
|
scopedMonthlyTotals: scopedMonthlyTotals,
|
||||||
scopedCategoriesMonthlyTotals: scopedCategoriesMonthlyTotals,
|
scopedCategoriesMonthlyTotals: scopedCategoriesMonthlyTotals,
|
||||||
scopedMonthlyPostitiveTotals: scopedMonthlyPostitiveTotals,
|
scopedMonthlyPostitiveTotals: scopedMonthlyPostitiveTotals,
|
||||||
scopedMonthlyNegativeTotals: scopedMonthlyNegativeTotals,
|
scopedMonthlyNegativeTotals: scopedMonthlyNegativeTotals,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class BudgetsPage extends StatelessWidget {
|
|||||||
return Center(
|
return Center(
|
||||||
child: Container(
|
child: Container(
|
||||||
constraints: const BoxConstraints(
|
constraints: const BoxConstraints(
|
||||||
maxWidth: 1000
|
maxWidth: 1000,
|
||||||
),
|
),
|
||||||
child: ListView(
|
child: ListView(
|
||||||
padding: mediaQuery.padding.copyWith(left: 10.0, right: 10.0, bottom: 100.0),
|
padding: mediaQuery.padding.copyWith(left: 10.0, right: 10.0, bottom: 100.0),
|
||||||
|
|||||||
@@ -1,73 +1,104 @@
|
|||||||
import 'package:fl_chart/fl_chart.dart';
|
import 'package:fl_chart/fl_chart.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:tunas/domains/budget/budget_bloc.dart';
|
||||||
import 'package:tunas/pages/common/titled_container.dart';
|
import 'package:tunas/pages/common/titled_container.dart';
|
||||||
|
import 'package:tunas/repositories/metadata/models/budget.dart';
|
||||||
|
import 'package:uuid/uuid.dart';
|
||||||
|
|
||||||
class MonthDistribution extends StatelessWidget {
|
class MonthDistribution extends StatelessWidget {
|
||||||
const MonthDistribution({super.key});
|
const MonthDistribution({super.key});
|
||||||
|
|
||||||
|
List<Widget> _computeBudgetLines(BuildContext context, List<Budget> budgets, double initialBudget, double remainingBudget) {
|
||||||
|
List<Widget> list = [
|
||||||
|
Text('Money to spare: ${NumberFormat('#####00.00 €', 'fr_FR').format(remainingBudget)} € / $initialBudget €'),
|
||||||
|
];
|
||||||
|
|
||||||
|
list.addAll(budgets.map((budget) => Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(budget.label),
|
||||||
|
Text(NumberFormat('#####00.00 €', 'fr_FR').format(budget.value)),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: SliderTheme(
|
||||||
|
data: SliderThemeData(
|
||||||
|
|
||||||
|
),
|
||||||
|
child: Slider(
|
||||||
|
min: 0,
|
||||||
|
max: initialBudget,
|
||||||
|
label: budget.value.round().toString(),
|
||||||
|
value: budget.value,
|
||||||
|
secondaryTrackValue: remainingBudget + budget.value,
|
||||||
|
onChanged: (value) => context.read<BudgetBloc>().add(BudgetSetValue(budget, value)),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)).toList());
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Column(
|
return BlocBuilder<BudgetBloc, BudgetState>(
|
||||||
children: [
|
builder: (context, state) => Column(
|
||||||
TitledContainer(
|
children: [
|
||||||
title: 'Prepare',
|
TitledContainer(
|
||||||
child: Column(
|
title: 'Prepare',
|
||||||
children: [
|
action: IconButton(
|
||||||
Text('Money to spare: 2300 €'),
|
onPressed: () => context.read<BudgetBloc>().add(BudgetAdd(const Uuid().v8())),
|
||||||
Text('Loyer'),
|
icon: const Icon(Icons.add),
|
||||||
Slider(
|
),
|
||||||
min: 0,
|
child: Column(
|
||||||
max: 2300,
|
children: _computeBudgetLines(context, state.budgets, state.initialBudget, state.remainingBudget),
|
||||||
value: 200,
|
),
|
||||||
onChanged: (value) => {},
|
|
||||||
),
|
|
||||||
Text('Loyer'),
|
|
||||||
Slider(
|
|
||||||
min: 0,
|
|
||||||
max: 2300,
|
|
||||||
value: 200,
|
|
||||||
onChanged: (value) => {},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
TitledContainer(
|
||||||
TitledContainer(
|
title: 'Compare',
|
||||||
title: 'Compare',
|
height: 500,
|
||||||
height: 500,
|
child: Row(
|
||||||
child: Row(
|
children: [
|
||||||
children: [
|
Expanded(
|
||||||
Expanded(
|
child: Column(
|
||||||
child: Column(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
children: [
|
||||||
children: [
|
Text('Budget'),
|
||||||
Text('Budget'),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
Expanded(
|
||||||
Expanded(
|
child: Column(
|
||||||
child: Column(
|
children: [
|
||||||
children: [
|
Row(
|
||||||
Row(
|
children: [
|
||||||
children: [
|
IconButton(
|
||||||
IconButton(
|
onPressed: () => {},
|
||||||
onPressed: () => {},
|
icon: const Icon(Icons.skip_previous)
|
||||||
icon: const Icon(Icons.skip_previous)
|
),
|
||||||
),
|
Text('Fev 2024'),
|
||||||
Text('Fev 2024'),
|
IconButton(
|
||||||
IconButton(
|
onPressed: () => {},
|
||||||
onPressed: () => {},
|
icon: const Icon(Icons.skip_next)
|
||||||
icon: const Icon(Icons.skip_next)
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
],
|
)
|
||||||
)
|
)
|
||||||
)
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -35,15 +35,6 @@ class TitledContainer extends StatelessWidget {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Theme.of(context).colorScheme.primaryContainer,
|
color: Theme.of(context).colorScheme.primaryContainer,
|
||||||
borderRadius: BorderRadius.circular(15),
|
borderRadius: BorderRadius.circular(15),
|
||||||
boxShadow: [
|
|
||||||
BoxShadow(
|
|
||||||
color: Theme.of(context).colorScheme.shadow,
|
|
||||||
blurRadius: 10,
|
|
||||||
offset: const Offset(2, 2),
|
|
||||||
spreadRadius: 0.1,
|
|
||||||
blurStyle: BlurStyle.normal,
|
|
||||||
)
|
|
||||||
]
|
|
||||||
),
|
),
|
||||||
margin: const EdgeInsets.symmetric(vertical: 10, horizontal: 0),
|
margin: const EdgeInsets.symmetric(vertical: 10, horizontal: 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
@@ -56,7 +47,12 @@ class TitledContainer extends StatelessWidget {
|
|||||||
Container(
|
Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Theme.of(context).colorScheme.secondaryContainer,
|
color: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
borderRadius: const BorderRadius.only(topLeft: Radius.circular(15), topRight: Radius.circular(15)),
|
borderRadius: const BorderRadius.only(topLeft: Radius.circular(14), topRight: Radius.circular(15)),
|
||||||
|
border: Border(
|
||||||
|
bottom: BorderSide(
|
||||||
|
color: Theme.of(context).colorScheme.onSecondaryContainer,
|
||||||
|
)
|
||||||
|
)
|
||||||
),
|
),
|
||||||
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 15),
|
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 15),
|
||||||
child: _computeTitleRow()
|
child: _computeTitleRow()
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ class DataPage extends StatelessWidget {
|
|||||||
MediaQueryData mediaQuery = MediaQuery.of(context);
|
MediaQueryData mediaQuery = MediaQuery.of(context);
|
||||||
return Center(
|
return Center(
|
||||||
child: Container(
|
child: Container(
|
||||||
|
margin: const EdgeInsets.symmetric(vertical: 11, horizontal: 0),
|
||||||
constraints: const BoxConstraints(
|
constraints: const BoxConstraints(
|
||||||
maxWidth: 1000
|
maxWidth: 1000
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ class CategoriesSettings extends StatelessWidget {
|
|||||||
color: category.rgbToColor(),
|
color: category.rgbToColor(),
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {},
|
onPressed: () => context.read<CategoryBloc>().add(CategoryEditTransfert(category, !category.transfert)),
|
||||||
icon: const Icon(Icons.swap_horiz),
|
icon: const Icon(Icons.swap_horiz),
|
||||||
color: category.transfert ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.error,
|
color: category.transfert ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.error,
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {},
|
onPressed: () => context.read<CategoryBloc>().add(CategoryEditEssential(category, !category.essential)),
|
||||||
icon: const Icon(Icons.foundation),
|
icon: const Icon(Icons.foundation),
|
||||||
color: category.essential ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.error,
|
color: category.essential ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.error,
|
||||||
),
|
),
|
||||||
@@ -34,7 +34,7 @@ class CategoriesSettings extends StatelessWidget {
|
|||||||
icon: const Icon(Icons.edit),
|
icon: const Icon(Icons.edit),
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {},
|
onPressed: () => context.read<CategoryBloc>().add(CategoryRemove(category)),
|
||||||
icon: const Icon(Icons.delete),
|
icon: const Icon(Icons.delete),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -43,9 +43,30 @@ class CategoriesSettings extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocBuilder<CategoryBloc, CategoryState>(
|
return BlocConsumer<CategoryBloc, CategoryState>(
|
||||||
|
listener: (context, state) {
|
||||||
|
if (state is CategoryRemoveSucess) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(
|
||||||
|
backgroundColor: Colors.green,
|
||||||
|
content: Text('Category succesfuly removed !'),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else if (state is CategoryRemoveFail) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(
|
||||||
|
backgroundColor: Colors.red,
|
||||||
|
content: Text('Cannot remove category. Still present on some transactions.'),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
builder: (context, state) => TitledContainer(
|
builder: (context, state) => TitledContainer(
|
||||||
title: "Categories",
|
title: "Categories",
|
||||||
|
action: IconButton(
|
||||||
|
onPressed: () => context.read<CategoryBloc>().add(CategoryAdd()),
|
||||||
|
icon: const Icon(Icons.add),
|
||||||
|
),
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
scrollDirection: Axis.vertical,
|
scrollDirection: Axis.vertical,
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
|||||||
import 'package:tunas/domains/account/account_bloc.dart';
|
import 'package:tunas/domains/account/account_bloc.dart';
|
||||||
import 'package:tunas/domains/budget/budget_bloc.dart';
|
import 'package:tunas/domains/budget/budget_bloc.dart';
|
||||||
import 'package:tunas/domains/category/category_bloc.dart';
|
import 'package:tunas/domains/category/category_bloc.dart';
|
||||||
|
import 'package:tunas/domains/charts/chart_bloc.dart';
|
||||||
import 'package:tunas/domains/transaction/transaction_bloc.dart';
|
import 'package:tunas/domains/transaction/transaction_bloc.dart';
|
||||||
import 'package:tunas/pages/budgets/budgets_page.dart';
|
import 'package:tunas/pages/budgets/budgets_page.dart';
|
||||||
import 'package:tunas/pages/data/data_page.dart';
|
import 'package:tunas/pages/data/data_page.dart';
|
||||||
@@ -14,14 +15,86 @@ import 'package:tunas/repositories/transactions/transactions_repository.dart';
|
|||||||
class HomePage extends StatelessWidget {
|
class HomePage extends StatelessWidget {
|
||||||
const HomePage({super.key});
|
const HomePage({super.key});
|
||||||
|
|
||||||
|
Widget _tabBar() {
|
||||||
|
return 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)),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _largeScreenTotalsCharts(BuildContext context) {
|
||||||
|
return Align(
|
||||||
|
alignment: Alignment.topLeft,
|
||||||
|
child: Container(
|
||||||
|
margin: const EdgeInsets.all(10),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context).colorScheme.primaryContainer,
|
||||||
|
borderRadius: BorderRadius.circular(5),
|
||||||
|
),
|
||||||
|
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)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _smallScreenTotalsCharts(BuildContext context) {
|
||||||
|
return Align(
|
||||||
|
alignment: Alignment.bottomCenter,
|
||||||
|
child: Container(
|
||||||
|
height: 40,
|
||||||
|
width: MediaQuery.sizeOf(context).width,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context).colorScheme.primaryContainer,
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Theme.of(context).colorScheme.shadow,
|
||||||
|
blurRadius: 5,
|
||||||
|
offset: const Offset(0, -2),
|
||||||
|
spreadRadius: 0.1,
|
||||||
|
blurStyle: BlurStyle.normal,
|
||||||
|
)
|
||||||
|
]
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
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)),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
bool smallVerticalScreen = MediaQuery.sizeOf(context).width < 1500;
|
||||||
return MultiBlocProvider(
|
return MultiBlocProvider(
|
||||||
providers: [
|
providers: [
|
||||||
BlocProvider(create: (context) => AccountBloc(transactionsRepository: RepositoryProvider.of<TransactionsRepository>(context), metadataRepository: RepositoryProvider.of<MetadataRepository>(context))),
|
BlocProvider(create: (context) => AccountBloc(metadataRepository: RepositoryProvider.of<MetadataRepository>(context), transactionsRepository: RepositoryProvider.of<TransactionsRepository>(context))),
|
||||||
BlocProvider(create: (context) => TransactionBloc(transactionsRepository: RepositoryProvider.of<TransactionsRepository>(context))),
|
BlocProvider(create: (context) => TransactionBloc(transactionsRepository: RepositoryProvider.of<TransactionsRepository>(context))),
|
||||||
BlocProvider(create: (context) => CategoryBloc(metadataRepository: RepositoryProvider.of<MetadataRepository>(context))),
|
BlocProvider(create: (context) => CategoryBloc(metadataRepository: RepositoryProvider.of<MetadataRepository>(context), transactionsRepository: RepositoryProvider.of<TransactionsRepository>(context))),
|
||||||
BlocProvider(create: (context) => BudgetBloc(metadataRepository: RepositoryProvider.of<MetadataRepository>(context))),
|
BlocProvider(create: (context) => BudgetBloc(metadataRepository: RepositoryProvider.of<MetadataRepository>(context))),
|
||||||
|
BlocProvider(create: (context) => ChartBloc(metadataRepository: RepositoryProvider.of<MetadataRepository>(context), transactionsRepository: RepositoryProvider.of<TransactionsRepository>(context))),
|
||||||
],
|
],
|
||||||
child: DefaultTabController(
|
child: DefaultTabController(
|
||||||
length: 4,
|
length: 4,
|
||||||
@@ -36,26 +109,7 @@ class HomePage extends StatelessWidget {
|
|||||||
DataPage()
|
DataPage()
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Align(
|
smallVerticalScreen ? _smallScreenTotalsCharts(context) : _largeScreenTotalsCharts(context),
|
||||||
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)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ 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/global_total_chart.dart';
|
||||||
import 'package:tunas/pages/stats/widgets/profit_indicator.dart';
|
import 'package:tunas/pages/stats/widgets/profit_indicator.dart';
|
||||||
import 'package:tunas/pages/stats/widgets/year_selector.dart';
|
import 'package:tunas/pages/stats/widgets/year_selector.dart';
|
||||||
import 'package:tunas/repositories/metadata/metadata_repository.dart';
|
|
||||||
import 'package:tunas/repositories/transactions/transactions_repository.dart';
|
|
||||||
|
|
||||||
class StatsPage extends StatelessWidget {
|
class StatsPage extends StatelessWidget {
|
||||||
const StatsPage({super.key});
|
const StatsPage({super.key});
|
||||||
@@ -112,28 +110,22 @@ class StatsPage extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
MediaQueryData mediaQuery = MediaQuery.of(context);
|
MediaQueryData mediaQuery = MediaQuery.of(context);
|
||||||
bool smallVerticalScreen = MediaQuery.sizeOf(context).width < 800;
|
bool smallVerticalScreen = MediaQuery.sizeOf(context).width < 800;
|
||||||
return BlocProvider(
|
return BlocBuilder<ChartBloc, ChartState>(
|
||||||
create: (context) => ChartBloc(
|
builder: (context, state) => ListView(
|
||||||
metadataRepository: RepositoryProvider.of<MetadataRepository>(context),
|
padding: mediaQuery.padding.copyWith(bottom: 100.0),
|
||||||
transactionsRepository: RepositoryProvider.of<TransactionsRepository>(context),
|
children: [
|
||||||
),
|
smallVerticalScreen ? _smallScreenHeader(state) : _largeScreenHeader(state),
|
||||||
child: BlocBuilder<ChartBloc, ChartState>(
|
SizedBox(
|
||||||
builder: (context, state) => ListView(
|
height: smallVerticalScreen ? 100 : 200,
|
||||||
padding: mediaQuery.padding.copyWith(bottom: 100.0),
|
child: GlobalTotalChart(monthlyTotals: state.scopedMonthlyTotals)
|
||||||
children: [
|
),
|
||||||
smallVerticalScreen ? _smallScreenHeader(state) : _largeScreenHeader(state),
|
SizedBox(
|
||||||
SizedBox(
|
height: smallVerticalScreen ? 200 : 500,
|
||||||
height: smallVerticalScreen ? 100 : 200,
|
child: MonthlyCategoriesTotalChart(categoriesMonthlyTotals: state.scopedCategoriesMonthlyTotals)
|
||||||
child: GlobalTotalChart(monthlyTotals: state.scopedMonthlyTotals)
|
),
|
||||||
),
|
smallVerticalScreen ? _smallScreenTotalsCharts(state) : _largeScreenTotalsCharts(state),
|
||||||
SizedBox(
|
],
|
||||||
height: smallVerticalScreen ? 200 : 500,
|
)
|
||||||
child: MonthlyCategoriesTotalChart(categoriesMonthlyTotals: state.scopedCategoriesMonthlyTotals)
|
|
||||||
),
|
|
||||||
smallVerticalScreen ? _smallScreenTotalsCharts(state) : _largeScreenTotalsCharts(state),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -35,15 +35,6 @@ class AccountCounter extends StatelessWidget {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(15),
|
borderRadius: BorderRadius.circular(15),
|
||||||
color: Theme.of(context).colorScheme.primaryContainer,
|
color: Theme.of(context).colorScheme.primaryContainer,
|
||||||
boxShadow: [
|
|
||||||
BoxShadow(
|
|
||||||
color: Theme.of(context).colorScheme.shadow,
|
|
||||||
blurRadius: 10,
|
|
||||||
offset: const Offset(2, 2),
|
|
||||||
spreadRadius: 0.1,
|
|
||||||
blurStyle: BlurStyle.normal,
|
|
||||||
)
|
|
||||||
]
|
|
||||||
),
|
),
|
||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|||||||
@@ -71,15 +71,6 @@ class CategoriesTotalsChart extends StatelessWidget {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(15),
|
borderRadius: BorderRadius.circular(15),
|
||||||
color: Theme.of(context).colorScheme.primaryContainer,
|
color: Theme.of(context).colorScheme.primaryContainer,
|
||||||
boxShadow: [
|
|
||||||
BoxShadow(
|
|
||||||
color: Theme.of(context).colorScheme.shadow,
|
|
||||||
blurRadius: 10,
|
|
||||||
offset: const Offset(2, 2),
|
|
||||||
spreadRadius: 0.1,
|
|
||||||
blurStyle: BlurStyle.normal,
|
|
||||||
)
|
|
||||||
]
|
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@@ -14,15 +14,6 @@ class GlobalCounter extends StatelessWidget {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(15),
|
borderRadius: BorderRadius.circular(15),
|
||||||
color: Theme.of(context).colorScheme.primaryContainer,
|
color: Theme.of(context).colorScheme.primaryContainer,
|
||||||
boxShadow: [
|
|
||||||
BoxShadow(
|
|
||||||
color: Theme.of(context).colorScheme.shadow,
|
|
||||||
blurRadius: 10,
|
|
||||||
offset: const Offset(2, 2),
|
|
||||||
spreadRadius: 0.1,
|
|
||||||
blurStyle: BlurStyle.normal,
|
|
||||||
)
|
|
||||||
]
|
|
||||||
),
|
),
|
||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
child: Text(
|
child: Text(
|
||||||
|
|||||||
@@ -57,8 +57,12 @@ class TransactionsHeader extends StatelessWidget {
|
|||||||
return Container(
|
return Container(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 9, horizontal: 10),
|
padding: const EdgeInsets.symmetric(vertical: 9, horizontal: 10),
|
||||||
margin: const EdgeInsets.symmetric(vertical: 2, horizontal: 10),
|
margin: const EdgeInsets.symmetric(vertical: 2, horizontal: 10),
|
||||||
decoration: const BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border(bottom: BorderSide(color: Colors.black))
|
border: Border(
|
||||||
|
bottom: BorderSide(
|
||||||
|
color: Theme.of(context).colorScheme.onPrimaryContainer
|
||||||
|
)
|
||||||
|
)
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
|||||||
@@ -16,10 +16,18 @@ class MetadataRepository {
|
|||||||
required jsonRepository,
|
required jsonRepository,
|
||||||
}) : _jsonRepository = jsonRepository;
|
}) : _jsonRepository = jsonRepository;
|
||||||
|
|
||||||
|
List<Category> getCategories() {
|
||||||
|
return _categoriesController.value;
|
||||||
|
}
|
||||||
|
|
||||||
Stream<List<Category>> getCategoriesStream() {
|
Stream<List<Category>> getCategoriesStream() {
|
||||||
return _categoriesController.asBroadcastStream();
|
return _categoriesController.asBroadcastStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<Budget> getBudgets() {
|
||||||
|
return _budgetController.value;
|
||||||
|
}
|
||||||
|
|
||||||
Stream<List<Budget>> getBudgetsStream() {
|
Stream<List<Budget>> getBudgetsStream() {
|
||||||
return _budgetController.asBroadcastStream();
|
return _budgetController.asBroadcastStream();
|
||||||
}
|
}
|
||||||
@@ -32,30 +40,33 @@ class MetadataRepository {
|
|||||||
return _accountController.asBroadcastStream();
|
return _accountController.asBroadcastStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
loadMetadata() async {
|
void loadMetadata() async {
|
||||||
Metadata metadata = await _jsonRepository.loadJson(Metadata(), MetadataFactory());
|
Metadata metadata = await _jsonRepository.loadJson(Metadata(), MetadataFactory());
|
||||||
_broadcastMetadata(metadata);
|
_broadcastMetadata(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
saveCategories(List<Category> categories) async {
|
Future<List<Category>> saveCategories(List<Category> categories) async {
|
||||||
Metadata metadata = _constructMetadataFromControllers();
|
Metadata metadata = _constructMetadataFromControllers();
|
||||||
metadata.categories = categories;
|
metadata.categories = categories;
|
||||||
await _jsonRepository.saveJson(metadata);
|
await _jsonRepository.saveJson(metadata);
|
||||||
_categoriesController.add(categories);
|
_categoriesController.add(categories);
|
||||||
|
return categories;
|
||||||
}
|
}
|
||||||
|
|
||||||
saveBudgets(List<Budget> budgets) async {
|
Future<List<Budget>> saveBudgets(List<Budget> budgets) async {
|
||||||
Metadata metadata = _constructMetadataFromControllers();
|
Metadata metadata = _constructMetadataFromControllers();
|
||||||
metadata.budgets = budgets;
|
metadata.budgets = budgets;
|
||||||
await _jsonRepository.saveJson(metadata);
|
await _jsonRepository.saveJson(metadata);
|
||||||
_budgetController.add(budgets);
|
_budgetController.add(budgets);
|
||||||
|
return budgets;
|
||||||
}
|
}
|
||||||
|
|
||||||
saveAccounts(List<Account> accounts) async {
|
Future<List<Account>> saveAccounts(List<Account> accounts) async {
|
||||||
Metadata metadata = _constructMetadataFromControllers();
|
Metadata metadata = _constructMetadataFromControllers();
|
||||||
metadata.accounts = accounts;
|
metadata.accounts = accounts;
|
||||||
await _jsonRepository.saveJson(metadata);
|
await _jsonRepository.saveJson(metadata);
|
||||||
_accountController.add(accounts);
|
_accountController.add(accounts);
|
||||||
|
return accounts;
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteMetadata() async {
|
deleteMetadata() async {
|
||||||
|
|||||||
@@ -1,20 +1,24 @@
|
|||||||
class Budget {
|
class Budget {
|
||||||
|
String label;
|
||||||
bool monthly;
|
bool monthly;
|
||||||
double value;
|
double value;
|
||||||
|
|
||||||
Budget({
|
Budget({
|
||||||
|
this.label = '',
|
||||||
this.monthly = false,
|
this.monthly = false,
|
||||||
this.value = 0.0,
|
this.value = 0.0,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory Budget.fromJson(Map<String, dynamic> json) {
|
factory Budget.fromJson(Map<String, dynamic> json) {
|
||||||
return Budget(
|
return Budget(
|
||||||
monthly: json['monthly'],
|
label: json['label'],
|
||||||
|
monthly: bool.parse(json['monthly']),
|
||||||
value: double.parse(json['value']),
|
value: double.parse(json['value']),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, String> toJson() => {
|
Map<String, String> toJson() => {
|
||||||
|
'label': label,
|
||||||
'monthly': monthly.toString(),
|
'monthly': monthly.toString(),
|
||||||
'value': value.toString(),
|
'value': value.toString(),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,6 +6,10 @@
|
|||||||
|
|
||||||
#include "generated_plugin_registrant.h"
|
#include "generated_plugin_registrant.h"
|
||||||
|
|
||||||
|
#include <dynamic_color/dynamic_color_plugin.h>
|
||||||
|
|
||||||
void fl_register_plugins(FlPluginRegistry* registry) {
|
void fl_register_plugins(FlPluginRegistry* registry) {
|
||||||
|
g_autoptr(FlPluginRegistrar) dynamic_color_registrar =
|
||||||
|
fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin");
|
||||||
|
dynamic_color_plugin_register_with_registrar(dynamic_color_registrar);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
|
dynamic_color
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||||
|
|||||||
@@ -5,8 +5,10 @@
|
|||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
import dynamic_color
|
||||||
import path_provider_foundation
|
import path_provider_foundation
|
||||||
|
|
||||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
|
DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin"))
|
||||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||||
}
|
}
|
||||||
|
|||||||
52
pubspec.lock
52
pubspec.lock
@@ -29,10 +29,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: bloc
|
name: bloc
|
||||||
sha256: "3820f15f502372d979121de1f6b97bfcf1630ebff8fe1d52fb2b0bfa49be5b49"
|
sha256: f53a110e3b48dcd78136c10daa5d51512443cea5e1348c9d80a320095fa2db9e
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "8.1.2"
|
version: "8.1.3"
|
||||||
boolean_selector:
|
boolean_selector:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -113,6 +113,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.6"
|
version: "1.0.6"
|
||||||
|
dynamic_color:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: dynamic_color
|
||||||
|
sha256: a866f1f8947bfdaf674d7928e769eac7230388a2e7a2542824fad4bb5b87be3b
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.6.9"
|
||||||
equatable:
|
equatable:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -157,10 +165,10 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: fl_chart
|
name: fl_chart
|
||||||
sha256: "5a74434cc83bf64346efb562f1a06eefaf1bcb530dc3d96a104f631a1eff8d79"
|
sha256: "00b74ae680df6b1135bdbea00a7d1fc072a9180b7c3f3702e4b19a9943f5ed7d"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.65.0"
|
version: "0.66.2"
|
||||||
flex_color_picker:
|
flex_color_picker:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -289,10 +297,10 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: formz
|
name: formz
|
||||||
sha256: df8301299601139de7e653e68a07c332fd2db7cec65745eca1a1ea73fb711e06
|
sha256: a58eb48d84685b7ffafac1d143bf47d585bf54c7db89fe81c175dfd6e53201c7
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.6.1"
|
version: "0.7.0"
|
||||||
image:
|
image:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -385,26 +393,26 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: path_provider
|
name: path_provider
|
||||||
sha256: a1aa8aaa2542a6bc57e381f132af822420216c80d4781f7aa085ca3229208aaa
|
sha256: b27217933eeeba8ff24845c34003b003b2b22151de3c908d0e679e8fe1aa078b
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.1"
|
version: "2.1.2"
|
||||||
path_provider_android:
|
path_provider_android:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path_provider_android
|
name: path_provider_android
|
||||||
sha256: e595b98692943b4881b219f0a9e3945118d3c16bd7e2813f98ec6e532d905f72
|
sha256: "477184d672607c0a3bf68fbbf601805f92ef79c82b64b4d6eb318cbca4c48668"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.1"
|
version: "2.2.2"
|
||||||
path_provider_foundation:
|
path_provider_foundation:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path_provider_foundation
|
name: path_provider_foundation
|
||||||
sha256: "19314d595120f82aca0ba62787d58dde2cc6b5df7d2f0daf72489e38d1b57f2d"
|
sha256: "5a7999be66e000916500be4f15a3633ebceb8302719b47b9cc49ce924125350f"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.3.1"
|
version: "2.3.2"
|
||||||
path_provider_linux:
|
path_provider_linux:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -417,10 +425,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path_provider_platform_interface
|
name: path_provider_platform_interface
|
||||||
sha256: "94b1e0dd80970c1ce43d5d4e050a9918fce4f4a775e6142424c30a29a363265c"
|
sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.1"
|
version: "2.1.2"
|
||||||
path_provider_windows:
|
path_provider_windows:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -441,18 +449,18 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: platform
|
name: platform
|
||||||
sha256: "0a279f0707af40c890e80b1e9df8bb761694c074ba7e1d4ab1bc4b728e200b59"
|
sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.3"
|
version: "3.1.4"
|
||||||
plugin_platform_interface:
|
plugin_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: plugin_platform_interface
|
name: plugin_platform_interface
|
||||||
sha256: f4f88d4a900933e7267e2b353594774fc0d07fb072b47eedcd5b54e1ea3269f8
|
sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.7"
|
version: "2.1.8"
|
||||||
pointer_interceptor:
|
pointer_interceptor:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -606,18 +614,18 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: win32
|
name: win32
|
||||||
sha256: b0f37db61ba2f2e9b7a78a1caece0052564d1bc70668156cf3a29d676fe4e574
|
sha256: "464f5674532865248444b4c3daca12bd9bf2d7c47f759ce2617986e7229494a8"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.1.1"
|
version: "5.2.0"
|
||||||
xdg_directories:
|
xdg_directories:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: xdg_directories
|
name: xdg_directories
|
||||||
sha256: "589ada45ba9e39405c198fe34eb0f607cddb2108527e658136120892beac46d2"
|
sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.3"
|
version: "1.0.4"
|
||||||
xml:
|
xml:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ dependencies:
|
|||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
||||||
cupertino_icons: ^1.0.2
|
cupertino_icons: ^1.0.2
|
||||||
fl_chart: ^0.65.0
|
fl_chart: ^0.66.2
|
||||||
logging: ^1.2.0
|
logging: ^1.2.0
|
||||||
flutter_bloc: ^8.1.4
|
flutter_bloc: ^8.1.4
|
||||||
path_provider: ^2.1.1
|
path_provider: ^2.1.1
|
||||||
@@ -24,10 +24,11 @@ dependencies:
|
|||||||
flutter_localizations:
|
flutter_localizations:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
intl: any
|
intl: any
|
||||||
formz: ^0.6.1
|
formz: ^0.7.0
|
||||||
uuid: ^4.3.2
|
uuid: ^4.3.2
|
||||||
flutter_typeahead: ^5.2.0
|
flutter_typeahead: ^5.2.0
|
||||||
flex_color_picker: ^3.3.1
|
flex_color_picker: ^3.3.1
|
||||||
|
dynamic_color: ^1.6.9
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
@@ -6,6 +6,9 @@
|
|||||||
|
|
||||||
#include "generated_plugin_registrant.h"
|
#include "generated_plugin_registrant.h"
|
||||||
|
|
||||||
|
#include <dynamic_color/dynamic_color_plugin_c_api.h>
|
||||||
|
|
||||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||||
|
DynamicColorPluginCApiRegisterWithRegistrar(
|
||||||
|
registry->GetRegistrarForPlugin("DynamicColorPluginCApi"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
|
dynamic_color
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||||
|
|||||||
Reference in New Issue
Block a user