Skip to content

Commit

Permalink
Merge pull request #90 from covid19cuba/release/v0.3.1
Browse files Browse the repository at this point in the history
Release v0.3.1
  • Loading branch information
leynier authored Apr 4, 2020
2 parents 16c69a4 + 29bb70c commit 22a57f9
Show file tree
Hide file tree
Showing 20 changed files with 152 additions and 146 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Covid19 Cuba Data Mobile Application Changelog

## [0.3.1] - April 4, 2020

### Changed

* Default comparison entity
* Size of samples images of Gallery

### Fixed

* Bug in top tables

## [0.3.0] - April 2, 2020

### Added
Expand Down
24 changes: 4 additions & 20 deletions GALLERY.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,9 @@
# Covid19 Cuba Data Mobile Application Gallery

![Image 1](gallery/image_1.jpg)
![Image 1](gallery/image_1.jpg) ![Image 2](gallery/image_2.jpg) ![Image 3](gallery/image_3.jpg)

![Image 2](gallery/image_2.jpg)
![Image 4](gallery/image_4.jpg) ![Image 5](gallery/image_5.jpg) ![Image 6](gallery/image_6.jpg)

![Image 3](gallery/image_3.jpg)
![Image 7](gallery/image_7.jpg) ![Image 8](gallery/image_8.jpg) ![Image 9](gallery/image_9.jpg)

![Image 4](gallery/image_4.jpg)

![Image 5](gallery/image_5.jpg)

![Image 6](gallery/image_6.jpg)

![Image 7](gallery/image_7.jpg)

![Image 8](gallery/image_8.jpg)

![Image 9](gallery/image_9.jpg)

![Image 10](gallery/image_10.jpg)

![Image 11](gallery/image_11.jpg)

![Image 12](gallery/image_12.jpg)
![Image 10](gallery/image_10.jpg) ![Image 11](gallery/image_11.jpg) ![Image 12](gallery/image_12.jpg)
Binary file modified gallery/image_1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified gallery/image_10.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified gallery/image_11.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified gallery/image_12.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified gallery/image_2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified gallery/image_3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified gallery/image_4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified gallery/image_5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified gallery/image_6.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified gallery/image_7.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified gallery/image_8.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified gallery/image_9.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 37 additions & 31 deletions lib/src/models/data_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -272,62 +272,68 @@ class DataModel {
}

List<Map<String, dynamic>> get top10Province {
var provs = Map<String, int>();
int total = 0;
var provinces = Map<String, int>();
days
.where((x) => x.diagnosed != null)
.map((x) => x.diagnosed)
.forEach((diagnosed) {
diagnosed.forEach((item) {
if (provs.containsKey(item.detectionProvince)) {
++provs[item.detectionProvince];
if (provinces.containsKey(item.detectionProvince)) {
++provinces[item.detectionProvince];
} else {
provs[item.detectionProvince] = 1;
provinces[item.detectionProvince] = 1;
}
total+=1;
});
});
var total = provinces.values.reduce((a, b) => a + b);
var result = List<Map<String, dynamic>>();
provs.forEach((k, v) { result.add({'Provincia': k, 'casos': v, 'total': total});});
result.sort((a,b)=> -(a['casos'].compareTo(b['casos'])));
var res =result.sublist(0,10);
int cont=1;
for(var item in res){
item.addEntries([MapEntry('index',cont)]);
cont+=1;
provinces.forEach((k, v) {
if (k != null) {
result.add({'province': k, 'cases': v, 'total': total});
}
});
result.sort((a, b) => b['cases'].compareTo(a['cases']));
result = result.take(10).toList();
var cont = 1;
for (var item in result) {
item.addEntries([MapEntry('index', cont)]);
cont += 1;
}
return res;
return result;
}

List<Map<String, dynamic>> get top10Municipality {
var mun = Map<String, int>();
var mun2 = Map<String, String>();
int total = 0;
var municipalities = Map<String, int>();
var provinces = Map<String, String>();
days
.where((x) => x.diagnosed != null)
.map((x) => x.diagnosed)
.forEach((diagnosed) {
diagnosed.forEach((item) {
if (mun.containsKey(item.detectionMunicipality)) {
++mun[item.detectionMunicipality];
if (municipalities.containsKey(item.detectionMunicipality)) {
++municipalities[item.detectionMunicipality];
} else {
mun2[item.detectionMunicipality]=item.detectionProvince;
mun[item.detectionMunicipality] = 1;
provinces[item.detectionMunicipality] = item.detectionProvince;
municipalities[item.detectionMunicipality] = 1;
}
total+=1;
});
});
var total = municipalities.values.reduce((a, b) => a + b);
var result = List<Map<String, dynamic>>();
mun.forEach((k, v) { result.add({'Municipio': k, 'casos': v, 'total': total});});
result.sort((a,b)=> -(a['casos'].compareTo(b['casos'])));
var res =result.sublist(0,10);
int cont=1;
for(var item in res){
item.addEntries([MapEntry('index',cont)]);
item.addEntries([MapEntry('Provincia',mun2[item['Municipio']])]);
cont+=1;
municipalities.forEach((k, v) {
if (k != null) {
result.add({'municipality': k, 'cases': v, 'total': total});
}
});
result.sort((a, b) => b['cases'].compareTo(a['cases']));
result = result.take(10).toList();
var cont = 1;
for (var item in result) {
item.addEntries([MapEntry('index', cont)]);
item.addEntries([MapEntry('province', provinces[item['municipality']])]);
cont += 1;
}
return res;
return result;
}

factory DataModel.fromJson(Map<String, dynamic> json) =>
Expand Down
2 changes: 1 addition & 1 deletion lib/src/widgets/comparison_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ComparisonWidget extends StatefulWidget {
}

class ComparisonWidgetState extends State<ComparisonWidget> {
String selectedCountry = 'Greece';
String selectedCountry = 'Hungary';
final DataModel data;
final WorldTotalsModel countries;

Expand Down
4 changes: 2 additions & 2 deletions lib/src/widgets/home_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ class HomeWidget extends StatelessWidget {
margin: EdgeInsets.only(left: 5, right: 5, top: 5),
child: Card(
child: Container(
child: TableData(data: data, infoToShow: 'Provincia'),
child: TableData(data: data, infoToShow: 'province'),
),
),
),
Container(
margin: EdgeInsets.only(left: 5, right: 5, top: 5),
child: Card(
child: Container(
child: TableData(data: data, infoToShow: 'Municipio'),
child: TableData(data: data, infoToShow: 'municipality'),
),
),
),
Expand Down
183 changes: 94 additions & 89 deletions lib/src/widgets/tables_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,12 @@ class TableData extends StatelessWidget {
color: Constants.primaryColor,
width: 1,
);
List<Map<String, dynamic>> topData = List<Map<String, dynamic>>();
String title = '';
if (infoToShow == 'Provincia') {
topData = data.top10Province;
title = 'Provincias';
}
if (infoToShow == 'Municipio') {
topData = data.top10Municipality;
title = 'Municipios';
var title = infoToShow == 'municipality' ? 'Municipios' : 'Provincias';
var topData = infoToShow == 'municipality'
? data.top10Municipality
: data.top10Province;
if (topData == null || topData.length == 0) {
return Container();
}
Map<int, TableColumnWidth> col = {
0: FlexColumnWidth(0.3),
Expand All @@ -43,7 +40,7 @@ class TableData extends StatelessWidget {
margin: EdgeInsets.all(15),
child: Center(
child: Text(
'TOP10 $title ${infoToShow == 'Municipio' ? "Afectados" : "Afectadas"}',
'TOP${topData.length} $title ${infoToShow == 'municipality' ? "Afectados" : "Afectadas"}',
style: TextStyle(
color: Constants.primaryColor,
fontWeight: FontWeight.bold,
Expand All @@ -60,93 +57,101 @@ class TableData extends StatelessWidget {
Table(
columnWidths: col,
border: TableBorder(horizontalInside: borderSide),
children: [TableRow(
children: [
TableCell(
child: Container(
margin: EdgeInsets.all(10),
child: Text(
'#',
style: TextStyle(
color: Constants.primaryColor,
fontWeight: FontWeight.bold,
),
),
),
),
TableCell(
child: Container(
alignment: Alignment.centerLeft,
margin: EdgeInsets.all(10),
child: Text(
infoToShow,
style: TextStyle(
color: Constants.primaryColor,
fontWeight: FontWeight.bold,
),
),
),
),
TableCell(
child: Container(
margin: EdgeInsets.all(10),
child: Center(
child: Text(
'% del total',
style: TextStyle(
color: Constants.primaryColor,
fontWeight: FontWeight.bold,
children: [
TableRow(
children: [
TableCell(
child: Container(
margin: EdgeInsets.all(10),
child: Text(
'#',
style: TextStyle(
color: Constants.primaryColor,
fontWeight: FontWeight.bold,
),
),
),
),
),
),
),
],
)] + topData.map((key) {
return TableRow(
children: [
TableCell(
child: Container(
margin: EdgeInsets.all(10),
child: Text(
'${key['index']}',
style: TextStyle(
color: Constants.primaryColor,
fontWeight: FontWeight.normal,
TableCell(
child: Container(
alignment: Alignment.centerLeft,
margin: EdgeInsets.all(10),
child: Text(
title,
style: TextStyle(
color: Constants.primaryColor,
fontWeight: FontWeight.bold,
),
),
),
),
),
),
TableCell(
child: Container(
alignment: Alignment.centerLeft,
margin: EdgeInsets.all(10),
child: Text(
'${key[infoToShow]} ${infoToShow == 'Municipio' ? "(" + key['Provincia'] + ")" : ""}',
style: TextStyle(
color: Constants.primaryColor,
fontWeight: FontWeight.normal,
TableCell(
child: Container(
margin: EdgeInsets.all(10),
child: Center(
child: Text(
'% del total de casos',
style: TextStyle(
color: Constants.primaryColor,
fontWeight: FontWeight.bold,
),
),
),
),
),
),
),
TableCell(
child: Container(
margin: EdgeInsets.all(10),
child: Center(
child: Text(
'${(key['casos'] / key['total'] * 100).toStringAsFixed(2)}%',
style: TextStyle(
color: Constants.primaryColor,
fontWeight: FontWeight.normal,
],
)
] +
topData.map(
(key) {
return TableRow(
children: [
TableCell(
child: Container(
margin: EdgeInsets.all(10),
child: Text(
'${key['index']}',
style: TextStyle(
color: Constants.primaryColor,
fontWeight: FontWeight.normal,
),
),
),
),
),
),
),
],
);
}).toList(),
TableCell(
child: Container(
alignment: Alignment.centerLeft,
margin: EdgeInsets.all(10),
child: Text(
'${key[infoToShow]} '
'${infoToShow == 'municipality' ? '(${key['province']})' : ''}',
style: TextStyle(
color: Constants.primaryColor,
fontWeight: FontWeight.normal,
),
),
),
),
TableCell(
child: Container(
margin: EdgeInsets.all(10),
child: Center(
child: Text(
(key['cases'] * 100 / key['total'])
.toStringAsFixed(2) +
'%',
style: TextStyle(
color: Constants.primaryColor,
fontWeight: FontWeight.normal,
),
),
),
),
),
],
);
},
).toList(),
),
],
);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/widgets/test_evolution_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class TestEvolutionWidget extends StatelessWidget {
charts.OutsideJustification.middleDrawArea,
),
charts.ChartTitle(
'Tests acumulados',
'Tests por días',
behaviorPosition: charts.BehaviorPosition.start,
titleStyleSpec: charts.TextStyleSpec(fontSize: 11),
titleOutsideJustification:
Expand Down
Loading

0 comments on commit 22a57f9

Please sign in to comment.