-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from AMCAsimulagro/feature/graficas
Feature/graficas
- Loading branch information
Showing
28 changed files
with
1,865 additions
and
540 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import 'package:amca/domain/model/chart_data.dart'; | ||
|
||
class BarDataUI { | ||
final int month; | ||
|
||
double? totalCost; | ||
|
||
BarDataUI({ | ||
required this.month, | ||
this.totalCost, | ||
}); | ||
|
||
String get monthName { | ||
final months = { | ||
1: 'Ene', | ||
2: 'Feb', | ||
3: 'Mar', | ||
4: 'Abr', | ||
5: 'May', | ||
6: 'Jun', | ||
7: 'Jul', | ||
8: 'Ago', | ||
9: 'Sep', | ||
10: 'Oct', | ||
11: 'Nov', | ||
12: 'Dic' | ||
}; | ||
return months[month] ?? ''; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import 'package:amca/domain/model/cost_expense.dart'; | ||
|
||
class ChartDataYear { | ||
final int year; | ||
final List<ChartDataMonth>? monthsData; | ||
|
||
ChartDataYear({ | ||
required this.year, | ||
this.monthsData, | ||
}); | ||
} | ||
|
||
class ChartDataMonth { | ||
final int? month; | ||
final List<CostAndExpense>? costAndExpense; | ||
|
||
ChartDataMonth({ | ||
this.month, | ||
this.costAndExpense, | ||
}); | ||
|
||
List<CostAndExpense> get costs => | ||
costAndExpense?.where((element) => element.isCost).toList() ?? []; | ||
|
||
List<CostAndExpense> get expenses => | ||
costAndExpense?.where((element) => !element.isCost).toList() ?? []; | ||
|
||
bool get hasCosts => costs.isNotEmpty; | ||
bool get hasExpenses => expenses.isNotEmpty; | ||
|
||
double? get totalCost => costs.isNotEmpty | ||
? costs | ||
.map((cost) => cost.priceDouble) | ||
.reduce((valorAnterior, valorActual) => valorAnterior + valorActual) | ||
: null; | ||
|
||
double? get totalExpense => expenses.isNotEmpty | ||
? expenses | ||
.map((cost) => cost.priceDouble) | ||
.reduce((valorAnterior, valorActual) => valorAnterior + valorActual) | ||
: null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import 'package:amca/ui/utils/amca_palette.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class PieDataUI { | ||
final double value; | ||
|
||
final double percentageInThePie; | ||
final bool? isCost; | ||
|
||
PieDataUI({ | ||
required this.value, | ||
this.isCost = false, | ||
required this.percentageInThePie, | ||
}); | ||
|
||
String get percentage => '${percentageInThePie.toStringAsFixed(2)}%'; | ||
|
||
Color get color => | ||
isCost! ? AmcaPalette.pieCostColor : AmcaPalette.pieExpenseColor; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.