diff --git a/CHANGELOG.md b/CHANGELOG.md
index 12b0862..6ef3ce4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,24 @@
# Covid19 Cuba Data Mobile Application Changelog
+## [0.8.0] - May 11, 2020
+
+### Added
+
+* Tips section accessible from the menu at the bottom.
+* News section accessible from the menu at the bottom.
+* Evolution chart by days of cases and daily discharges.
+* Evolution chart by days of active cases and accumulated registrations.
+* Sorting and paging of the Accumulated table by countries in the World section accessible from the menu at the bottom.
+
+### Changed
+
+* Organization of provincial and municipal statistics, now all are found from the Cuba section accessible from the menu at the bottom using filters to select the desired province or municipality.
+* Ability to choose between any pair of countries in the Comparison chart between countries in the World section.
+
+### Fixed
+
+Color of the municipalities and provinces on the maps.
+
## [0.7.1] - May 4, 2020
### Added
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index bcf440a..41ad706 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,11 +1,14 @@
## Contributions are highly appreciated.
### All contributors will be granted credit on the following list:
+
* Leynier Gutiérrez González ([@leynier](https://github.com/leynier))
* Norlan Capote Díaz ([@norlancd](https://github.com/norlancd))
* Carlos Bermudez Porto ([@stdevCbermudez](https://github.com/stdevCbermudez))
* Roberto Martí Cedeño ([@rmarticedeno](https://github.com/rmarticedeno))
* Sadan ([@fsadannn](https://github.com/fsadannn))
+* Luis Eduardo Gonzalez ([@luiseduardoglez](https://github.com/luiseduardoglez))
+* Daniel Alejandro Cárdenas Cabrera ([@DanielUH2019](https://github.com/DanielUH2019))
You can help out by:
- Reporting a bug
@@ -22,9 +25,11 @@ We're using the following branches to manage work:
- `feature`, `bug` branches: unstable development
## How to report bugs
+
We use GitHub issues to track public bugs. Report a bug by [opening a new issue](https:ithub.//gcom/covid19-cuba-efforts/covid19cuba-app/issues/new/choose); it's that easy!
### Write bug reports with detail, background, and sample code
+
**Great Bug Reports** tend to have:
- A quick summary and/or background
@@ -38,6 +43,7 @@ We use GitHub issues to track public bugs. Report a bug by [opening a new issue]
We <3 thorough bug reports.
## How to contribute code
+
We use GitHub to host code, to track issues and feature requests, as well as accept pull requests.
Pull requests are the best way to propose changes to the codebase. We use a loose version of Git Flow
@@ -54,4 +60,5 @@ and actively welcome your pull requests:
1. Issue that pull request!
### Any contributions you make will be under the Creative Commons Zero v1.0 Universal
+
When you submit code changes, your submissions are understood to be under the same [CC0-1.0](LICENSE) that covers the project.
diff --git a/USAGE.md b/USAGE.md
index 8ef7757..d03cd5d 100644
--- a/USAGE.md
+++ b/USAGE.md
@@ -3,16 +3,12 @@
## Setup
1. Install and configure the Flutter framework: https://flutter.dev/docs/get-started/install
-
2. Add the Flutter and Dart plugins to your IDE: https://flutter.dev/docs/get-started/editor
-
3. Fork this repository and clone your fork.
-
4. Install all dependencies
```
flutter pub get
```
-
5. Run the project using your IDE or the Flutter CLI:
```
flutter run
@@ -21,6 +17,7 @@
## Useful commands
### Clean the project's build folders
+
This can resolve issues where the simulator is not running the latest code.
```sh
flutter clean
diff --git a/assets/images/avoid_contact_handshake.png b/assets/images/avoid_contact_handshake.png
new file mode 100644
index 0000000..2a43e80
Binary files /dev/null and b/assets/images/avoid_contact_handshake.png differ
diff --git a/assets/images/casa.png b/assets/images/casa.png
new file mode 100644
index 0000000..b1e2a7e
Binary files /dev/null and b/assets/images/casa.png differ
diff --git a/assets/images/clean_hands.svg b/assets/images/clean_hands.svg
new file mode 100644
index 0000000..0d25cc0
--- /dev/null
+++ b/assets/images/clean_hands.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/assets/images/cleaning_soap.svg b/assets/images/cleaning_soap.svg
new file mode 100644
index 0000000..3386eac
--- /dev/null
+++ b/assets/images/cleaning_soap.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/assets/images/distance_keep_social.png b/assets/images/distance_keep_social.png
new file mode 100644
index 0000000..d4b8503
Binary files /dev/null and b/assets/images/distance_keep_social.png differ
diff --git a/assets/images/doctor.svg b/assets/images/doctor.svg
new file mode 100644
index 0000000..914252d
--- /dev/null
+++ b/assets/images/doctor.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/assets/images/dolor_cabeza.svg b/assets/images/dolor_cabeza.svg
new file mode 100644
index 0000000..3081f93
--- /dev/null
+++ b/assets/images/dolor_cabeza.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/assets/images/dolor_garganta.svg b/assets/images/dolor_garganta.svg
new file mode 100644
index 0000000..c693c3f
--- /dev/null
+++ b/assets/images/dolor_garganta.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/assets/images/dont_face_touch.svg b/assets/images/dont_face_touch.svg
new file mode 100644
index 0000000..9eb24d0
--- /dev/null
+++ b/assets/images/dont_face_touch.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/assets/images/falta_aire.svg b/assets/images/falta_aire.svg
new file mode 100644
index 0000000..c75dc86
--- /dev/null
+++ b/assets/images/falta_aire.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/assets/images/fiebre.svg b/assets/images/fiebre.svg
new file mode 100644
index 0000000..371872e
--- /dev/null
+++ b/assets/images/fiebre.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/assets/images/man_mask.svg b/assets/images/man_mask.svg
new file mode 100644
index 0000000..f89747e
--- /dev/null
+++ b/assets/images/man_mask.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/assets/images/tos.svg b/assets/images/tos.svg
new file mode 100644
index 0000000..bce3203
--- /dev/null
+++ b/assets/images/tos.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/assets/js/map.js b/assets/js/map.js
index 05f781a..e3c911d 100644
--- a/assets/js/map.js
+++ b/assets/js/map.js
@@ -50,9 +50,9 @@ function getMarkerProfile(title, pro, mun) {
covidData = function (data, events) {
- var factor = 100;
var muns = data.muns;
var genInfo = data.genInfo;
+ var factor = 1.5*10**(Math.floor(Math.log10(genInfo.max_pros)));
if (geojsonM)
map_mun.removeLayer(geojsonM);
@@ -92,6 +92,7 @@ covidData = function (data, events) {
function getColorM(code) {
if (code in muns) {
var opac = logx(factor,muns[code] * factor / genInfo.max_muns);
+ if(opac<0.07){opac=0.07;}
return "rgba(176,30,34," + opac + ")";
}
return '#D1D2D4';
@@ -121,9 +122,9 @@ covidData = function (data, events) {
covidData2 = function (data, events) {
- var factor = 100;
var pros = data.pros;
var genInfo = data.genInfo;
+ var factor = 1.5*10**(Math.floor(Math.log10(genInfo.max_pros)));
if (geojsonM)
map_mun.removeLayer(geojsonM);
@@ -162,6 +163,7 @@ covidData2 = function (data, events) {
function getColorP(code) {
if (code in pros) {
var opac = logx(factor,pros[code] * factor / genInfo.max_pros);
+ if(opac<0.07){opac=0.07;}
return "rgba(176,30,34," + opac + ")";
}
return '#D1D2D4';
@@ -189,9 +191,10 @@ filterByProvince = function (province_id, data) {
covidData3 = function (data, province_id, events) {
var municipalitydata = JSON.parse(strGeoJson);
- var factor = 100;
var muns = data.muns;
var genInfo = data.genInfo;
+ var factor = 1.5*10**(Math.floor(Math.log10(genInfo.max_muns)));
+ factor = 100;
var features = [];
for (const i in municipalitydata.features) {
const municipality = municipalitydata.features[i].properties;
@@ -240,6 +243,7 @@ covidData3 = function (data, province_id, events) {
function getColorM(code) {
if (code in muns) {
var opac = logx(factor,muns[code] * factor / genInfo.max_muns);
+ if(opac<0.07){opac=0.07;}
return "rgba(176,30,34," + opac + ")";
}
return '#D1D2D4';
diff --git a/fonts/Ubuntu/UFL.txt b/fonts/Ubuntu/UFL.txt
new file mode 100644
index 0000000..ae78a8f
--- /dev/null
+++ b/fonts/Ubuntu/UFL.txt
@@ -0,0 +1,96 @@
+-------------------------------
+UBUNTU FONT LICENCE Version 1.0
+-------------------------------
+
+PREAMBLE
+This licence allows the licensed fonts to be used, studied, modified and
+redistributed freely. The fonts, including any derivative works, can be
+bundled, embedded, and redistributed provided the terms of this licence
+are met. The fonts and derivatives, however, cannot be released under
+any other licence. The requirement for fonts to remain under this
+licence does not require any document created using the fonts or their
+derivatives to be published under this licence, as long as the primary
+purpose of the document is not to be a vehicle for the distribution of
+the fonts.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this licence and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Original Version" refers to the collection of Font Software components
+as received under this licence.
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to
+a new environment.
+
+"Copyright Holder(s)" refers to all individuals and companies who have a
+copyright ownership of the Font Software.
+
+"Substantially Changed" refers to Modified Versions which can be easily
+identified as dissimilar to the Font Software by users of the Font
+Software comparing the Original Version with the Modified Version.
+
+To "Propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification and with or without charging
+a redistribution fee), making available to the public, and in some
+countries other activities as well.
+
+PERMISSION & CONDITIONS
+This licence does not grant any rights under trademark law and all such
+rights are reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of the Font Software, to propagate the Font Software, subject to
+the below conditions:
+
+1) Each copy of the Font Software must contain the above copyright
+notice and this licence. These can be included either as stand-alone
+text files, human-readable headers or in the appropriate machine-
+readable metadata fields within text or binary files as long as those
+fields can be easily viewed by the user.
+
+2) The font name complies with the following:
+(a) The Original Version must retain its name, unmodified.
+(b) Modified Versions which are Substantially Changed must be renamed to
+avoid use of the name of the Original Version or similar names entirely.
+(c) Modified Versions which are not Substantially Changed must be
+renamed to both (i) retain the name of the Original Version and (ii) add
+additional naming elements to distinguish the Modified Version from the
+Original Version. The name of such Modified Versions must be the name of
+the Original Version, with "derivative X" where X represents the name of
+the new work, appended to that name.
+
+3) The name(s) of the Copyright Holder(s) and any contributor to the
+Font Software shall not be used to promote, endorse or advertise any
+Modified Version, except (i) as required by this licence, (ii) to
+acknowledge the contribution(s) of the Copyright Holder(s) or (iii) with
+their explicit written permission.
+
+4) The Font Software, modified or unmodified, in part or in whole, must
+be distributed entirely under this licence, and must not be distributed
+under any other licence. The requirement for fonts to remain under this
+licence does not affect any document created using the Font Software,
+except any version of the Font Software extracted from a document
+created using the Font Software may only be distributed under this
+licence.
+
+TERMINATION
+This licence becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
+COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER
+DEALINGS IN THE FONT SOFTWARE.
diff --git a/fonts/Ubuntu/Ubuntu-Bold.ttf b/fonts/Ubuntu/Ubuntu-Bold.ttf
new file mode 100644
index 0000000..4af149a
Binary files /dev/null and b/fonts/Ubuntu/Ubuntu-Bold.ttf differ
diff --git a/fonts/Ubuntu/Ubuntu-BoldItalic.ttf b/fonts/Ubuntu/Ubuntu-BoldItalic.ttf
new file mode 100644
index 0000000..a68afb6
Binary files /dev/null and b/fonts/Ubuntu/Ubuntu-BoldItalic.ttf differ
diff --git a/fonts/Ubuntu/Ubuntu-Italic.ttf b/fonts/Ubuntu/Ubuntu-Italic.ttf
new file mode 100644
index 0000000..b022726
Binary files /dev/null and b/fonts/Ubuntu/Ubuntu-Italic.ttf differ
diff --git a/fonts/Ubuntu/Ubuntu-Light.ttf b/fonts/Ubuntu/Ubuntu-Light.ttf
new file mode 100644
index 0000000..0e9f90d
Binary files /dev/null and b/fonts/Ubuntu/Ubuntu-Light.ttf differ
diff --git a/fonts/Ubuntu/Ubuntu-LightItalic.ttf b/fonts/Ubuntu/Ubuntu-LightItalic.ttf
new file mode 100644
index 0000000..2e007de
Binary files /dev/null and b/fonts/Ubuntu/Ubuntu-LightItalic.ttf differ
diff --git a/fonts/Ubuntu/Ubuntu-Medium.ttf b/fonts/Ubuntu/Ubuntu-Medium.ttf
new file mode 100644
index 0000000..5296045
Binary files /dev/null and b/fonts/Ubuntu/Ubuntu-Medium.ttf differ
diff --git a/fonts/Ubuntu/Ubuntu-MediumItalic.ttf b/fonts/Ubuntu/Ubuntu-MediumItalic.ttf
new file mode 100644
index 0000000..5dc193d
Binary files /dev/null and b/fonts/Ubuntu/Ubuntu-MediumItalic.ttf differ
diff --git a/fonts/Ubuntu/Ubuntu-Regular.ttf b/fonts/Ubuntu/Ubuntu-Regular.ttf
new file mode 100644
index 0000000..dbb834a
Binary files /dev/null and b/fonts/Ubuntu/Ubuntu-Regular.ttf differ
diff --git a/lib/main.dart b/lib/main.dart
index 94c7e14..f984224 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'dart:developer';
import 'package:covid19cuba/src/models/models.dart';
diff --git a/lib/src/app.dart b/lib/src/app.dart
index f171f1e..608f8f2 100644
--- a/lib/src/app.dart
+++ b/lib/src/app.dart
@@ -1,6 +1,11 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:preferences/preference_service.dart';
+import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:covid19cuba/src/pages/pages.dart';
import 'package:covid19cuba/src/utils/utils.dart';
@@ -18,6 +23,13 @@ class App extends StatelessWidget {
var isOnBoarding = PrefService.getBool(Constants.prefIsOnBoarding) ?? false;
return MaterialApp(
debugShowCheckedModeBanner: false,
+ localizationsDelegates: [
+ GlobalMaterialLocalizations.delegate,
+ GlobalWidgetsLocalizations.delegate,
+ ],
+ supportedLocales: [
+ const Locale('es', 'ES'),
+ ],
title: Constants.appName,
theme: AppTheme.themeLight,
home: isOnBoarding
diff --git a/lib/src/blocs/blocs.dart b/lib/src/blocs/blocs.dart
index 1bbac10..8e3e9d7 100644
--- a/lib/src/blocs/blocs.dart
+++ b/lib/src/blocs/blocs.dart
@@ -1,2 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
export 'changelog_bloc.dart';
export 'home_bloc.dart';
+export 'jt_news_bloc.dart';
diff --git a/lib/src/blocs/changelog_bloc.dart b/lib/src/blocs/changelog_bloc.dart
index 9efada1..699b5a5 100644
--- a/lib/src/blocs/changelog_bloc.dart
+++ b/lib/src/blocs/changelog_bloc.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'dart:developer';
import 'dart:io';
diff --git a/lib/src/blocs/events/changelog_events.dart b/lib/src/blocs/events/changelog_events.dart
index 721cff7..2d04645 100644
--- a/lib/src/blocs/events/changelog_events.dart
+++ b/lib/src/blocs/events/changelog_events.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:equatable/equatable.dart';
abstract class ChangelogEvent extends Equatable {
diff --git a/lib/src/blocs/events/events.dart b/lib/src/blocs/events/events.dart
index 8766775..f6c69bc 100644
--- a/lib/src/blocs/events/events.dart
+++ b/lib/src/blocs/events/events.dart
@@ -1,2 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
export 'changelog_events.dart';
export 'home_events.dart';
+export 'jt_news_events.dart';
diff --git a/lib/src/blocs/events/home_events.dart b/lib/src/blocs/events/home_events.dart
index 47fa128..7410f83 100644
--- a/lib/src/blocs/events/home_events.dart
+++ b/lib/src/blocs/events/home_events.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:equatable/equatable.dart';
abstract class HomeEvent extends Equatable {
diff --git a/lib/src/blocs/events/jt_news_events.dart b/lib/src/blocs/events/jt_news_events.dart
new file mode 100644
index 0000000..40c8f02
--- /dev/null
+++ b/lib/src/blocs/events/jt_news_events.dart
@@ -0,0 +1,26 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
+import 'package:equatable/equatable.dart';
+
+abstract class JTNewsEvent extends Equatable {
+ const JTNewsEvent();
+
+ @override
+ List get props => [];
+}
+
+class LoadJTNewsEvent extends JTNewsEvent {
+ final bool showNotification;
+
+ const LoadJTNewsEvent({this.showNotification = true});
+}
+
+class FetchJTNewsEvent extends JTNewsEvent {
+ const FetchJTNewsEvent();
+}
+
+class RefreshJTNewsEvent extends JTNewsEvent {
+ const RefreshJTNewsEvent();
+}
diff --git a/lib/src/blocs/home_bloc.dart b/lib/src/blocs/home_bloc.dart
index 866e765..e0b3d73 100644
--- a/lib/src/blocs/home_bloc.dart
+++ b/lib/src/blocs/home_bloc.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'dart:developer';
import 'dart:io';
diff --git a/lib/src/blocs/jt_news_bloc.dart b/lib/src/blocs/jt_news_bloc.dart
new file mode 100644
index 0000000..394dc79
--- /dev/null
+++ b/lib/src/blocs/jt_news_bloc.dart
@@ -0,0 +1,154 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
+import 'dart:developer';
+import 'dart:io';
+
+import 'package:covid19cuba/src/models/models.dart';
+import 'package:flutter_bloc/flutter_bloc.dart';
+
+import 'package:covid19cuba/src/blocs/events/events.dart';
+import 'package:covid19cuba/src/blocs/states/states.dart';
+import 'package:covid19cuba/src/data_providers/data_providers.dart';
+import 'package:covid19cuba/src/utils/utils.dart';
+
+export 'events/events.dart';
+export 'states/states.dart';
+
+class JTNewsBloc extends Bloc {
+ @override
+ JTNewsState get initialState => InitialJTNewsState();
+
+ @override
+ Stream mapEventToState(JTNewsEvent event) async* {
+ if (event is LoadJTNewsEvent) {
+ yield LoadingJTNewsState();
+ try {
+ JTNewsModel data;
+ try {
+ data = await getJTNewsData();
+ } catch (e) {
+ data = await getJTNewsDataFromCache();
+ if (data == null) {
+ throw e;
+ } else if (event.showNotification) {
+ NotificationManager.show(
+ title: 'No se ha podido establecer conexión',
+ body: 'Se muestra la última información descargada. '
+ 'Por favor, revise su conexión y vuelva a intentarlo.',
+ );
+ }
+ }
+ setJTNewsDataToCache(data);
+ yield LoadedJTNewsState(data: data);
+ } on BadRequestException catch (e) {
+ log(e.toString());
+ var data = await getJTNewsDataFromCache();
+ yield ErrorJTNewsState(
+ errorMessage: 'No se ha podido establecer conexión. Por favor, '
+ 'revise su conexión y vuelva a intentarlo.',
+ cache: data != null,
+ );
+ } on SocketException catch (e) {
+ log(e.toString());
+ var data = await getJTNewsDataFromCache();
+ yield ErrorJTNewsState(
+ errorMessage: 'No se ha podido establecer conexión. Por favor, '
+ 'revise su conexión y vuelva a intentarlo.',
+ cache: data != null,
+ );
+ } on ParseException catch (e) {
+ log(e.toString());
+ var data = await getJTNewsDataFromCache();
+ yield ErrorJTNewsState(
+ errorMessage: 'Hay problema con los servidores. Por favor, '
+ 'espere unos minutos y vuelva a intentarlo.',
+ cache: data != null,
+ );
+ } catch (e) {
+ log(e.toString());
+ var data = await getJTNewsDataFromCache();
+ yield ErrorJTNewsState(
+ errorMessage: e.toString(),
+ cache: data != null,
+ );
+ }
+ }
+ if (event is FetchJTNewsEvent) {
+ yield LoadingJTNewsState();
+ try {
+ var data = await getJTNewsData();
+ yield LoadedJTNewsState(data: data);
+ } on BadRequestException catch (e) {
+ log(e.toString());
+ var data = await getJTNewsDataFromCache();
+ yield ErrorJTNewsState(
+ errorMessage: 'No se ha podido establecer conexión. Por favor, '
+ 'revise su conexión y vuelva a intentarlo.',
+ cache: data != null,
+ );
+ } on SocketException catch (e) {
+ log(e.toString());
+ var data = await getJTNewsDataFromCache();
+ yield ErrorJTNewsState(
+ errorMessage: 'No se ha podido establecer conexión. Por favor, '
+ 'revise su conexión y vuelva a intentarlo.',
+ cache: data != null,
+ );
+ } on ParseException catch (e) {
+ log(e.toString());
+ var data = await getJTNewsDataFromCache();
+ yield ErrorJTNewsState(
+ errorMessage: 'Hay problema con los servidores. Por favor, '
+ 'espere unos minutos y vuelva a intentarlo.',
+ cache: data != null,
+ );
+ } catch (e) {
+ log(e.toString());
+ var data = await getJTNewsDataFromCache();
+ yield ErrorJTNewsState(
+ errorMessage: e.toString(),
+ cache: data != null,
+ );
+ }
+ }
+ if (event is RefreshJTNewsEvent) {
+ try {
+ var data = await getJTNewsData();
+ yield LoadedJTNewsState(data: data);
+ } on BadRequestException catch (e) {
+ log(e.toString());
+ var data = await getJTNewsDataFromCache();
+ yield ErrorJTNewsState(
+ errorMessage: 'No se ha podido establecer conexión. Por favor, '
+ 'revise su conexión y vuelva a intentarlo.',
+ cache: data != null,
+ );
+ } on SocketException catch (e) {
+ log(e.toString());
+ var data = await getJTNewsDataFromCache();
+ yield ErrorJTNewsState(
+ errorMessage: 'No se ha podido establecer conexión. Por favor, '
+ 'revise su conexión y vuelva a intentarlo.',
+ cache: data != null,
+ );
+ } on ParseException catch (e) {
+ log(e.toString());
+ var data = await getJTNewsDataFromCache();
+ yield ErrorJTNewsState(
+ errorMessage: 'Hay problema con los servidores. Por favor, '
+ 'espere unos minutos y vuelva a intentarlo.',
+ cache: data != null,
+ );
+ } catch (e) {
+ log(e.toString());
+ var data = await getJTNewsDataFromCache();
+ yield ErrorJTNewsState(
+ errorMessage: e.toString(),
+ cache: data != null,
+ );
+ }
+ }
+ }
+}
diff --git a/lib/src/blocs/states/changelog_states.dart b/lib/src/blocs/states/changelog_states.dart
index fda62cc..4025aed 100644
--- a/lib/src/blocs/states/changelog_states.dart
+++ b/lib/src/blocs/states/changelog_states.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:meta/meta.dart';
import 'package:equatable/equatable.dart';
diff --git a/lib/src/blocs/states/home_states.dart b/lib/src/blocs/states/home_states.dart
index 4c093f8..081c12a 100644
--- a/lib/src/blocs/states/home_states.dart
+++ b/lib/src/blocs/states/home_states.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:meta/meta.dart';
import 'package:equatable/equatable.dart';
diff --git a/lib/src/blocs/states/jt_news_states.dart b/lib/src/blocs/states/jt_news_states.dart
new file mode 100644
index 0000000..6987e9c
--- /dev/null
+++ b/lib/src/blocs/states/jt_news_states.dart
@@ -0,0 +1,39 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
+import 'package:meta/meta.dart';
+import 'package:equatable/equatable.dart';
+
+import 'package:covid19cuba/src/models/models.dart';
+
+abstract class JTNewsState extends Equatable {
+ const JTNewsState();
+
+ @override
+ List get props => [];
+}
+
+class InitialJTNewsState extends JTNewsState {}
+
+class LoadingJTNewsState extends JTNewsState {}
+
+class LoadedJTNewsState extends JTNewsState {
+ final JTNewsModel data;
+
+ const LoadedJTNewsState({@required this.data}) : assert(data != null);
+
+ @override
+ List get props => [data];
+}
+
+class ErrorJTNewsState extends JTNewsState {
+ final String errorMessage;
+ final bool cache;
+
+ const ErrorJTNewsState({@required this.errorMessage, @required this.cache})
+ : assert(errorMessage != null, cache != null);
+
+ @override
+ List get props => [errorMessage];
+}
diff --git a/lib/src/blocs/states/states.dart b/lib/src/blocs/states/states.dart
index 3f4b4ae..d4b9d8f 100644
--- a/lib/src/blocs/states/states.dart
+++ b/lib/src/blocs/states/states.dart
@@ -1,2 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
export 'changelog_states.dart';
export 'home_states.dart';
+export 'jt_news_states.dart';
diff --git a/lib/src/data_providers/changelog_provider.dart b/lib/src/data_providers/changelog_provider.dart
index e79829e..fdfaaa0 100644
--- a/lib/src/data_providers/changelog_provider.dart
+++ b/lib/src/data_providers/changelog_provider.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'dart:convert';
import 'dart:developer';
diff --git a/lib/src/data_providers/cuba_data_provider.dart b/lib/src/data_providers/cuba_data_provider.dart
index 6737f2f..813782a 100644
--- a/lib/src/data_providers/cuba_data_provider.dart
+++ b/lib/src/data_providers/cuba_data_provider.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'dart:convert';
import 'dart:developer';
diff --git a/lib/src/data_providers/data_providers.dart b/lib/src/data_providers/data_providers.dart
index c97e5cb..ef06dc9 100644
--- a/lib/src/data_providers/data_providers.dart
+++ b/lib/src/data_providers/data_providers.dart
@@ -1,3 +1,9 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
export 'changelog_provider.dart';
export 'cuba_data_provider.dart';
+export 'jt_news_provider.dart';
+export 'jt_news_state_provider.dart';
export 'state_provider.dart';
diff --git a/lib/src/data_providers/jt_news_provider.dart b/lib/src/data_providers/jt_news_provider.dart
new file mode 100644
index 0000000..71341d7
--- /dev/null
+++ b/lib/src/data_providers/jt_news_provider.dart
@@ -0,0 +1,96 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
+import 'dart:convert';
+import 'dart:developer';
+
+import 'package:http/http.dart';
+import 'package:package_info/package_info.dart';
+import 'package:preferences/preferences.dart';
+
+import 'package:covid19cuba/src/models/models.dart';
+import 'package:covid19cuba/src/utils/utils.dart';
+
+const urlJTNewsDataCU = 'https://cusobu.nat.cu/covid/api/v1/jt_news.json';
+const urlJTNewsDataIO =
+ 'https://covid19cuba.github.io/covid19cubadata.github.io/api/v1/jt_news.json';
+
+Future getJTNewsData() async {
+ var stateList = await JTNewsStateModel.check();
+ var cache = true;
+ if (stateList != null) {
+ cache = stateList[0];
+ }
+ if (!cache) {
+ var data = await getJTNewsDataFromCache();
+ if (data != null) {
+ log('Data obtained from cache.');
+ return data;
+ }
+ }
+ var mode = PrefService.getInt(Constants.prefConnectionMode) ??
+ Constants.ConnectionModeMerge;
+ switch (mode) {
+ case Constants.ConnectionModeIntranet:
+ return await getJTNewsDataFrom(urlJTNewsDataCU);
+ case Constants.ConnectionModeInternet:
+ return await getJTNewsDataFrom(urlJTNewsDataIO);
+ case Constants.ConnectionModeMerge:
+ default:
+ try {
+ return await getJTNewsDataFrom(urlJTNewsDataCU);
+ } catch (e) {
+ log(e.toString());
+ return await getJTNewsDataFrom(urlJTNewsDataIO);
+ }
+ }
+}
+
+Future getJTNewsDataFrom(String url) async {
+ var resp = await get(url, headers: {
+ 'Accept-Encoding': 'gzip, deflate, br',
+ });
+ if (resp.statusCode == 404) {
+ throw InvalidSourceException('Source is invalid');
+ } else if (resp.statusCode != 200) {
+ throw BadRequestException('Bad request');
+ }
+ JTNewsModel result;
+ try {
+ var json = jsonDecode(utf8.decode(resp.bodyBytes));
+ result = JTNewsModel.fromJson(json);
+ } catch (e) {
+ log(e.toString());
+ throw ParseException('Parse error');
+ }
+ return result;
+}
+
+Future getJTNewsDataFromCache() async {
+ try {
+ var packageInfo = await PackageInfo.fromPlatform();
+ var versionCodeNow = int.parse(packageInfo.buildNumber);
+ var versionCodeOld = PrefService.getInt(Constants.prefVersionCode) ?? 0;
+ if (versionCodeNow != versionCodeOld) {
+ return null;
+ }
+ var data = PrefService.getString(Constants.prefDataJTNews);
+ if (data == null) {
+ return null;
+ }
+ return JTNewsModel.fromJson(jsonDecode(data));
+ } catch (e) {
+ log(e.toString());
+ }
+ return null;
+}
+
+Future setJTNewsDataToCache(JTNewsModel data) async {
+ try {
+ String result = jsonEncode(data.toJson());
+ PrefService.setString(Constants.prefDataJTNews, result);
+ } catch (e) {
+ log(e.toString());
+ }
+}
diff --git a/lib/src/data_providers/jt_news_state_provider.dart b/lib/src/data_providers/jt_news_state_provider.dart
new file mode 100644
index 0000000..f770757
--- /dev/null
+++ b/lib/src/data_providers/jt_news_state_provider.dart
@@ -0,0 +1,56 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
+import 'dart:convert';
+import 'dart:developer';
+
+import 'package:http/http.dart';
+import 'package:preferences/preferences.dart';
+
+import 'package:covid19cuba/src/models/models.dart';
+import 'package:covid19cuba/src/utils/utils.dart';
+
+const urlJTNewsStateDataCU =
+ 'https://cusobu.nat.cu/covid/api/v1/jt_news_state.json';
+const urlJTNewsStateDataIO =
+ 'https://covid19cuba.github.io/covid19cubadata.github.io/api/v1/jt_news_state.json';
+
+Future getJTNewsStateData() async {
+ var mode = PrefService.getInt(Constants.prefConnectionMode) ??
+ Constants.ConnectionModeMerge;
+ switch (mode) {
+ case Constants.ConnectionModeIntranet:
+ return await getJTNewsStateDataFrom(urlJTNewsStateDataCU);
+ case Constants.ConnectionModeInternet:
+ return await getJTNewsStateDataFrom(urlJTNewsStateDataIO);
+ case Constants.ConnectionModeMerge:
+ default:
+ try {
+ return await getJTNewsStateDataFrom(urlJTNewsStateDataCU);
+ } catch (e) {
+ log(e.toString());
+ return await getJTNewsStateDataFrom(urlJTNewsStateDataIO);
+ }
+ }
+}
+
+Future getJTNewsStateDataFrom(String url) async {
+ var resp = await get(url, headers: {
+ 'Accept-Encoding': 'gzip, deflate, br',
+ });
+ if (resp.statusCode == 404) {
+ throw InvalidSourceException('Source is invalid');
+ } else if (resp.statusCode != 200) {
+ throw BadRequestException('Bad request');
+ }
+ JTNewsStateModel result;
+ try {
+ var json = jsonDecode(utf8.decode(resp.bodyBytes));
+ result = JTNewsStateModel.fromJson(json);
+ } catch (e) {
+ log(e.toString());
+ throw ParseException('Parse error');
+ }
+ return result;
+}
diff --git a/lib/src/data_providers/state_provider.dart b/lib/src/data_providers/state_provider.dart
index e3abe82..6e8c2dd 100644
--- a/lib/src/data_providers/state_provider.dart
+++ b/lib/src/data_providers/state_provider.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'dart:convert';
import 'dart:developer';
diff --git a/lib/src/models/cases_by_mode_of_contagion.dart b/lib/src/models/cases_by_mode_of_contagion.dart
index 4a55d14..23bea7f 100644
--- a/lib/src/models/cases_by_mode_of_contagion.dart
+++ b/lib/src/models/cases_by_mode_of_contagion.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
import 'package:covid19cuba/src/models/models.dart';
diff --git a/lib/src/models/cases_by_mode_of_contagion.g.dart b/lib/src/models/cases_by_mode_of_contagion.g.dart
index 974bc63..bbb15b7 100644
--- a/lib/src/models/cases_by_mode_of_contagion.g.dart
+++ b/lib/src/models/cases_by_mode_of_contagion.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'cases_by_mode_of_contagion.dart';
diff --git a/lib/src/models/cases_by_nationality.dart b/lib/src/models/cases_by_nationality.dart
index 24ff204..8e087ce 100644
--- a/lib/src/models/cases_by_nationality.dart
+++ b/lib/src/models/cases_by_nationality.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
import 'package:covid19cuba/src/models/models.dart';
diff --git a/lib/src/models/cases_by_nationality.g.dart b/lib/src/models/cases_by_nationality.g.dart
index 7b78a23..adde863 100644
--- a/lib/src/models/cases_by_nationality.g.dart
+++ b/lib/src/models/cases_by_nationality.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'cases_by_nationality.dart';
diff --git a/lib/src/models/cases_by_sex.dart b/lib/src/models/cases_by_sex.dart
index 08d3cf3..3085fb5 100644
--- a/lib/src/models/cases_by_sex.dart
+++ b/lib/src/models/cases_by_sex.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
import 'package:covid19cuba/src/models/models.dart';
diff --git a/lib/src/models/cases_by_sex.g.dart b/lib/src/models/cases_by_sex.g.dart
index 12af056..3dc27c8 100644
--- a/lib/src/models/cases_by_sex.g.dart
+++ b/lib/src/models/cases_by_sex.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'cases_by_sex.dart';
diff --git a/lib/src/models/changelog_item.dart b/lib/src/models/changelog_item.dart
index c8d692d..859880f 100644
--- a/lib/src/models/changelog_item.dart
+++ b/lib/src/models/changelog_item.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
import 'package:covid19cuba/src/utils/utils.dart';
diff --git a/lib/src/models/changelog_item.g.dart b/lib/src/models/changelog_item.g.dart
index 1c80a48..14843cb 100644
--- a/lib/src/models/changelog_item.g.dart
+++ b/lib/src/models/changelog_item.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'changelog_item.dart';
diff --git a/lib/src/models/changelog_model.dart b/lib/src/models/changelog_model.dart
index 6c7febf..faa673c 100644
--- a/lib/src/models/changelog_model.dart
+++ b/lib/src/models/changelog_model.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
import 'package:covid19cuba/src/models/models.dart';
diff --git a/lib/src/models/changelog_model.g.dart b/lib/src/models/changelog_model.g.dart
index 9532e28..b0791d0 100644
--- a/lib/src/models/changelog_model.g.dart
+++ b/lib/src/models/changelog_model.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'changelog_model.dart';
diff --git a/lib/src/models/comparison_of_accumulated_cases.dart b/lib/src/models/comparison_of_accumulated_cases.dart
index dd8c2bf..4b494c6 100644
--- a/lib/src/models/comparison_of_accumulated_cases.dart
+++ b/lib/src/models/comparison_of_accumulated_cases.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:covid19cuba/src/models/comparison_of_accumulated_cases_item.dart';
import 'package:json_annotation/json_annotation.dart';
diff --git a/lib/src/models/comparison_of_accumulated_cases.g.dart b/lib/src/models/comparison_of_accumulated_cases.g.dart
index f8246d6..c5a55ac 100644
--- a/lib/src/models/comparison_of_accumulated_cases.g.dart
+++ b/lib/src/models/comparison_of_accumulated_cases.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'comparison_of_accumulated_cases.dart';
diff --git a/lib/src/models/comparison_of_accumulated_cases_item.dart b/lib/src/models/comparison_of_accumulated_cases_item.dart
index ced42ab..41922b4 100644
--- a/lib/src/models/comparison_of_accumulated_cases_item.dart
+++ b/lib/src/models/comparison_of_accumulated_cases_item.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
part 'comparison_of_accumulated_cases_item.g.dart';
diff --git a/lib/src/models/comparison_of_accumulated_cases_item.g.dart b/lib/src/models/comparison_of_accumulated_cases_item.g.dart
index 87c1d24..7373c2d 100644
--- a/lib/src/models/comparison_of_accumulated_cases_item.g.dart
+++ b/lib/src/models/comparison_of_accumulated_cases_item.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'comparison_of_accumulated_cases_item.dart';
diff --git a/lib/src/models/cuba_model.dart b/lib/src/models/cuba_model.dart
index c758a4d..c11dd0d 100644
--- a/lib/src/models/cuba_model.dart
+++ b/lib/src/models/cuba_model.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
import 'package:covid19cuba/src/models/models.dart';
@@ -19,6 +23,13 @@ class CubaModel {
@JsonKey(name: 'evolution_of_cases_by_days')
EvolutionOfCasesByDays evolutionOfCasesByDays;
+ @JsonKey(name: 'evolution_of_cases_and_recovered_by_days')
+ EvolutionOfCasesAndRecoveredByDays evolutionOfCasesAndRecoveredByDays;
+
+ @JsonKey(name: 'evolution_of_active_and_recovered_accumulated')
+ EvolutionOfActiveAndRecoveredAccumulated
+ evolutionOfActiveAndRecoveredAccumulated;
+
@JsonKey(name: 'evolution_of_deaths_by_days')
EvolutionOfDeathsByDays evolutionOfDeathsByDays;
@@ -76,8 +87,8 @@ class CubaModel {
@JsonKey(name: 'note')
String note;
- @JsonKey(name: 'top_20_accumulated_countries')
- List top20AccumulatedCountries;
+ @JsonKey(name: 'world_countries')
+ List worldCountries;
@JsonKey(name: 'effective_reproductive_number')
EffectiveReproductiveNumber effectiveReproductiveNumber;
diff --git a/lib/src/models/cuba_model.g.dart b/lib/src/models/cuba_model.g.dart
index 5ce3370..8f6d854 100644
--- a/lib/src/models/cuba_model.g.dart
+++ b/lib/src/models/cuba_model.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'cuba_model.dart';
@@ -23,25 +26,25 @@ CubaModel _$CubaModelFromJson(Map json) {
? null
: EvolutionOfCasesByDays.fromJson(
json['evolution_of_cases_by_days'] as Map)
- ..evolutionOfDeathsByDays = json['evolution_of_deaths_by_days'] == null
- ? null
- : EvolutionOfDeathsByDays.fromJson(
- json['evolution_of_deaths_by_days'] as Map)
- ..evolutionOfRecoveredByDays =
- json['evolution_of_recovered_by_days'] == null
+ ..evolutionOfCasesAndRecoveredByDays =
+ json['evolution_of_cases_and_recovered_by_days'] == null
? null
- : EvolutionOfRecoveredByDays.fromJson(
- json['evolution_of_recovered_by_days'] as Map)
- ..distributionByAgeRanges = (json['distribution_by_age_ranges'] as List)
- ?.map((e) =>
- e == null ? null : ItemCode.fromJson(e as Map))
- ?.toList()
- ..distributionOfCases = json['distribution_of_cases'] == null
+ : EvolutionOfCasesAndRecoveredByDays.fromJson(
+ json['evolution_of_cases_and_recovered_by_days']
+ as Map)
+ ..evolutionOfActiveAndRecoveredAccumulated =
+ json['evolution_of_active_and_recovered_accumulated'] == null
+ ? null
+ : EvolutionOfActiveAndRecoveredAccumulated.fromJson(
+ json['evolution_of_active_and_recovered_accumulated']
+ as Map)
+ ..evolutionOfDeathsByDays = json['evolution_of_deaths_by_days'] == null
? null
- : DistributionOfCases.fromJson(
- json['distribution_of_cases'] as Map)
- ..casesByNationality =
- json['cases_by_nationality'] == null ? null : CasesByNationality.fromJson(json['cases_by_nationality'] as Map)
+ : EvolutionOfDeathsByDays.fromJson(json['evolution_of_deaths_by_days'] as Map)
+ ..evolutionOfRecoveredByDays = json['evolution_of_recovered_by_days'] == null ? null : EvolutionOfRecoveredByDays.fromJson(json['evolution_of_recovered_by_days'] as Map)
+ ..distributionByAgeRanges = (json['distribution_by_age_ranges'] as List)?.map((e) => e == null ? null : ItemCode.fromJson(e as Map))?.toList()
+ ..distributionOfCases = json['distribution_of_cases'] == null ? null : DistributionOfCases.fromJson(json['distribution_of_cases'] as Map)
+ ..casesByNationality = json['cases_by_nationality'] == null ? null : CasesByNationality.fromJson(json['cases_by_nationality'] as Map)
..distributionByNationalityOfForeignCases = (json['distribution_by_nationality_of_foreign_cases'] as List)?.map((e) => e == null ? null : ItemCode.fromJson(e as Map))?.toList()
..listOfTestsPerformed = json['list_of_tests_performed'] == null ? null : ListOfTestsPerformed.fromJson(json['list_of_tests_performed'] as Map)
..testsByDays = json['tests_by_days'] == null ? null : TestsByDays.fromJson(json['tests_by_days'] as Map)
@@ -56,7 +59,7 @@ CubaModel _$CubaModelFromJson(Map json) {
..curvesEvolution = json['curves_evolution_v2'] as Map
..updated = dateTimeFromJson(json['updated'] as String)
..note = json['note'] as String
- ..top20AccumulatedCountries = (json['top_20_accumulated_countries'] as List)?.map((e) => e == null ? null : ItemExtended.fromJson(e as Map))?.toList()
+ ..worldCountries = (json['world_countries'] as List)?.map((e) => e == null ? null : ItemExtended.fromJson(e as Map))?.toList()
..effectiveReproductiveNumber = json['effective_reproductive_number'] == null ? null : EffectiveReproductiveNumber.fromJson(json['effective_reproductive_number'] as Map)
..testBehaviorComparison = (json['test_behavior_comparison'] as Map)?.map(
(k, e) => MapEntry(
@@ -72,6 +75,10 @@ Map _$CubaModelToJson(CubaModel instance) => {
'cases_by_sex': instance.casesBySex,
'cases_by_mode_of_contagion': instance.casesByModeOfContagion,
'evolution_of_cases_by_days': instance.evolutionOfCasesByDays,
+ 'evolution_of_cases_and_recovered_by_days':
+ instance.evolutionOfCasesAndRecoveredByDays,
+ 'evolution_of_active_and_recovered_accumulated':
+ instance.evolutionOfActiveAndRecoveredAccumulated,
'evolution_of_deaths_by_days': instance.evolutionOfDeathsByDays,
'evolution_of_recovered_by_days': instance.evolutionOfRecoveredByDays,
'distribution_by_age_ranges': instance.distributionByAgeRanges,
@@ -92,7 +99,7 @@ Map _$CubaModelToJson(CubaModel instance) => {
'curves_evolution_v2': instance.curvesEvolution,
'updated': dateTimeToJson(instance.updated),
'note': instance.note,
- 'top_20_accumulated_countries': instance.top20AccumulatedCountries,
+ 'world_countries': instance.worldCountries,
'effective_reproductive_number': instance.effectiveReproductiveNumber,
'test_behavior_comparison': instance.testBehaviorComparison,
};
diff --git a/lib/src/models/data_model.dart b/lib/src/models/data_model.dart
index c1e6044..0278e22 100644
--- a/lib/src/models/data_model.dart
+++ b/lib/src/models/data_model.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:covid19cuba/src/utils/constants.dart';
import 'package:json_annotation/json_annotation.dart';
diff --git a/lib/src/models/data_model.g.dart b/lib/src/models/data_model.g.dart
index 50fbbaf..95beb9f 100644
--- a/lib/src/models/data_model.g.dart
+++ b/lib/src/models/data_model.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'data_model.dart';
diff --git a/lib/src/models/distribution_of_cases.dart b/lib/src/models/distribution_of_cases.dart
index 1d62a14..2bbd870 100644
--- a/lib/src/models/distribution_of_cases.dart
+++ b/lib/src/models/distribution_of_cases.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
import 'package:covid19cuba/src/models/models.dart';
diff --git a/lib/src/models/distribution_of_cases.g.dart b/lib/src/models/distribution_of_cases.g.dart
index 1a42385..83470e7 100644
--- a/lib/src/models/distribution_of_cases.g.dart
+++ b/lib/src/models/distribution_of_cases.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'distribution_of_cases.dart';
diff --git a/lib/src/models/effective_reproductive_number.dart b/lib/src/models/effective_reproductive_number.dart
index c568763..c8e19a2 100644
--- a/lib/src/models/effective_reproductive_number.dart
+++ b/lib/src/models/effective_reproductive_number.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
import 'package:covid19cuba/src/models/models.dart';
diff --git a/lib/src/models/effective_reproductive_number.g.dart b/lib/src/models/effective_reproductive_number.g.dart
index da9df2c..4afe598 100644
--- a/lib/src/models/effective_reproductive_number.g.dart
+++ b/lib/src/models/effective_reproductive_number.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'effective_reproductive_number.dart';
diff --git a/lib/src/models/evolution_of_active_and_recovered_accumulated.dart b/lib/src/models/evolution_of_active_and_recovered_accumulated.dart
new file mode 100644
index 0000000..03fbfc5
--- /dev/null
+++ b/lib/src/models/evolution_of_active_and_recovered_accumulated.dart
@@ -0,0 +1,25 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
+import 'package:json_annotation/json_annotation.dart';
+
+import 'package:covid19cuba/src/models/models.dart';
+
+part 'evolution_of_active_and_recovered_accumulated.g.dart';
+
+@JsonSerializable()
+class EvolutionOfActiveAndRecoveredAccumulated {
+ ItemList active;
+ ItemList recovered;
+ ItemDateList date;
+
+ EvolutionOfActiveAndRecoveredAccumulated();
+
+ factory EvolutionOfActiveAndRecoveredAccumulated.fromJson(
+ Map json) =>
+ _$EvolutionOfActiveAndRecoveredAccumulatedFromJson(json);
+
+ Map toJson() =>
+ _$EvolutionOfActiveAndRecoveredAccumulatedToJson(this);
+}
diff --git a/lib/src/models/evolution_of_active_and_recovered_accumulated.g.dart b/lib/src/models/evolution_of_active_and_recovered_accumulated.g.dart
new file mode 100644
index 0000000..d10b2ff
--- /dev/null
+++ b/lib/src/models/evolution_of_active_and_recovered_accumulated.g.dart
@@ -0,0 +1,33 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
+part of 'evolution_of_active_and_recovered_accumulated.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+EvolutionOfActiveAndRecoveredAccumulated
+ _$EvolutionOfActiveAndRecoveredAccumulatedFromJson(
+ Map json) {
+ return EvolutionOfActiveAndRecoveredAccumulated()
+ ..active = json['active'] == null
+ ? null
+ : ItemList.fromJson(json['active'] as Map)
+ ..recovered = json['recovered'] == null
+ ? null
+ : ItemList.fromJson(json['recovered'] as Map)
+ ..date = json['date'] == null
+ ? null
+ : ItemDateList.fromJson(json['date'] as Map);
+}
+
+Map _$EvolutionOfActiveAndRecoveredAccumulatedToJson(
+ EvolutionOfActiveAndRecoveredAccumulated instance) =>
+ {
+ 'active': instance.active,
+ 'recovered': instance.recovered,
+ 'date': instance.date,
+ };
diff --git a/lib/src/models/evolution_of_cases_and_recovered_by_days.dart b/lib/src/models/evolution_of_cases_and_recovered_by_days.dart
new file mode 100644
index 0000000..e549e56
--- /dev/null
+++ b/lib/src/models/evolution_of_cases_and_recovered_by_days.dart
@@ -0,0 +1,25 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
+import 'package:json_annotation/json_annotation.dart';
+
+import 'package:covid19cuba/src/models/models.dart';
+
+part 'evolution_of_cases_and_recovered_by_days.g.dart';
+
+@JsonSerializable()
+class EvolutionOfCasesAndRecoveredByDays {
+ ItemList diagnosed;
+ ItemList recovered;
+ ItemDateList date;
+
+ EvolutionOfCasesAndRecoveredByDays();
+
+ factory EvolutionOfCasesAndRecoveredByDays.fromJson(
+ Map json) =>
+ _$EvolutionOfCasesAndRecoveredByDaysFromJson(json);
+
+ Map toJson() =>
+ _$EvolutionOfCasesAndRecoveredByDaysToJson(this);
+}
diff --git a/lib/src/models/evolution_of_cases_and_recovered_by_days.g.dart b/lib/src/models/evolution_of_cases_and_recovered_by_days.g.dart
new file mode 100644
index 0000000..3a18f46
--- /dev/null
+++ b/lib/src/models/evolution_of_cases_and_recovered_by_days.g.dart
@@ -0,0 +1,32 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
+part of 'evolution_of_cases_and_recovered_by_days.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+EvolutionOfCasesAndRecoveredByDays _$EvolutionOfCasesAndRecoveredByDaysFromJson(
+ Map json) {
+ return EvolutionOfCasesAndRecoveredByDays()
+ ..diagnosed = json['diagnosed'] == null
+ ? null
+ : ItemList.fromJson(json['diagnosed'] as Map)
+ ..recovered = json['recovered'] == null
+ ? null
+ : ItemList.fromJson(json['recovered'] as Map)
+ ..date = json['date'] == null
+ ? null
+ : ItemDateList.fromJson(json['date'] as Map);
+}
+
+Map _$EvolutionOfCasesAndRecoveredByDaysToJson(
+ EvolutionOfCasesAndRecoveredByDays instance) =>
+ {
+ 'diagnosed': instance.diagnosed,
+ 'recovered': instance.recovered,
+ 'date': instance.date,
+ };
diff --git a/lib/src/models/evolution_of_cases_by_days.dart b/lib/src/models/evolution_of_cases_by_days.dart
index f5d2e8a..fad2abf 100644
--- a/lib/src/models/evolution_of_cases_by_days.dart
+++ b/lib/src/models/evolution_of_cases_by_days.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
import 'package:covid19cuba/src/models/models.dart';
diff --git a/lib/src/models/evolution_of_cases_by_days.g.dart b/lib/src/models/evolution_of_cases_by_days.g.dart
index 615752a..e96aef9 100644
--- a/lib/src/models/evolution_of_cases_by_days.g.dart
+++ b/lib/src/models/evolution_of_cases_by_days.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'evolution_of_cases_by_days.dart';
diff --git a/lib/src/models/evolution_of_deaths_by_days.dart b/lib/src/models/evolution_of_deaths_by_days.dart
index a1a4aae..0b0b2b5 100644
--- a/lib/src/models/evolution_of_deaths_by_days.dart
+++ b/lib/src/models/evolution_of_deaths_by_days.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
import 'package:covid19cuba/src/models/models.dart';
diff --git a/lib/src/models/evolution_of_deaths_by_days.g.dart b/lib/src/models/evolution_of_deaths_by_days.g.dart
index 50dbf0b..1197dba 100644
--- a/lib/src/models/evolution_of_deaths_by_days.g.dart
+++ b/lib/src/models/evolution_of_deaths_by_days.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'evolution_of_deaths_by_days.dart';
diff --git a/lib/src/models/evolution_of_recovered_by_days.dart b/lib/src/models/evolution_of_recovered_by_days.dart
index fd671e2..b1318fd 100644
--- a/lib/src/models/evolution_of_recovered_by_days.dart
+++ b/lib/src/models/evolution_of_recovered_by_days.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
import 'package:covid19cuba/src/models/models.dart';
diff --git a/lib/src/models/evolution_of_recovered_by_days.g.dart b/lib/src/models/evolution_of_recovered_by_days.g.dart
index 7b2caf6..5b967ab 100644
--- a/lib/src/models/evolution_of_recovered_by_days.g.dart
+++ b/lib/src/models/evolution_of_recovered_by_days.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'evolution_of_recovered_by_days.dart';
diff --git a/lib/src/models/item.dart b/lib/src/models/item.dart
index 59591ba..7d85195 100644
--- a/lib/src/models/item.dart
+++ b/lib/src/models/item.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
part 'item.g.dart';
diff --git a/lib/src/models/item.g.dart b/lib/src/models/item.g.dart
index 430718f..56f096d 100644
--- a/lib/src/models/item.g.dart
+++ b/lib/src/models/item.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'item.dart';
diff --git a/lib/src/models/item_code.dart b/lib/src/models/item_code.dart
index cabb4f7..abf319e 100644
--- a/lib/src/models/item_code.dart
+++ b/lib/src/models/item_code.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
part 'item_code.g.dart';
diff --git a/lib/src/models/item_code.g.dart b/lib/src/models/item_code.g.dart
index 0f13ed1..e120364 100644
--- a/lib/src/models/item_code.g.dart
+++ b/lib/src/models/item_code.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'item_code.dart';
diff --git a/lib/src/models/item_date_list.dart b/lib/src/models/item_date_list.dart
index 21a6068..254bc5e 100644
--- a/lib/src/models/item_date_list.dart
+++ b/lib/src/models/item_date_list.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:covid19cuba/src/utils/functions.dart';
import 'package:json_annotation/json_annotation.dart';
diff --git a/lib/src/models/item_date_list.g.dart b/lib/src/models/item_date_list.g.dart
index c5de717..d3b72a5 100644
--- a/lib/src/models/item_date_list.g.dart
+++ b/lib/src/models/item_date_list.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'item_date_list.dart';
diff --git a/lib/src/models/item_double_list.dart b/lib/src/models/item_double_list.dart
index 183aac5..0b4eea9 100644
--- a/lib/src/models/item_double_list.dart
+++ b/lib/src/models/item_double_list.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
part 'item_double_list.g.dart';
diff --git a/lib/src/models/item_double_list.g.dart b/lib/src/models/item_double_list.g.dart
index ce3b3b7..e84dde4 100644
--- a/lib/src/models/item_double_list.g.dart
+++ b/lib/src/models/item_double_list.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'item_double_list.dart';
diff --git a/lib/src/models/item_extended.dart b/lib/src/models/item_extended.dart
index 3fa9ab7..572fcdb 100644
--- a/lib/src/models/item_extended.dart
+++ b/lib/src/models/item_extended.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
part 'item_extended.g.dart';
diff --git a/lib/src/models/item_extended.g.dart b/lib/src/models/item_extended.g.dart
index 4c9b668..4644c84 100644
--- a/lib/src/models/item_extended.g.dart
+++ b/lib/src/models/item_extended.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'item_extended.dart';
diff --git a/lib/src/models/item_list.dart b/lib/src/models/item_list.dart
index b5805c0..6f550e7 100644
--- a/lib/src/models/item_list.dart
+++ b/lib/src/models/item_list.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
part 'item_list.g.dart';
diff --git a/lib/src/models/item_list.g.dart b/lib/src/models/item_list.g.dart
index 67b24a4..71161d3 100644
--- a/lib/src/models/item_list.g.dart
+++ b/lib/src/models/item_list.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'item_list.dart';
diff --git a/lib/src/models/item_municipality.dart b/lib/src/models/item_municipality.dart
index 7d93095..0c53e18 100644
--- a/lib/src/models/item_municipality.dart
+++ b/lib/src/models/item_municipality.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
part 'item_municipality.g.dart';
diff --git a/lib/src/models/item_municipality.g.dart b/lib/src/models/item_municipality.g.dart
index 6935903..e1a33d2 100644
--- a/lib/src/models/item_municipality.g.dart
+++ b/lib/src/models/item_municipality.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'item_municipality.dart';
diff --git a/lib/src/models/item_province.dart b/lib/src/models/item_province.dart
index c4aaace..56b4856 100644
--- a/lib/src/models/item_province.dart
+++ b/lib/src/models/item_province.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
part 'item_province.g.dart';
diff --git a/lib/src/models/item_province.g.dart b/lib/src/models/item_province.g.dart
index 10c7d37..2e77b20 100644
--- a/lib/src/models/item_province.g.dart
+++ b/lib/src/models/item_province.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'item_province.dart';
diff --git a/lib/src/models/item_string_list.dart b/lib/src/models/item_string_list.dart
index fea3c6c..7da3343 100644
--- a/lib/src/models/item_string_list.dart
+++ b/lib/src/models/item_string_list.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
part 'item_string_list.g.dart';
diff --git a/lib/src/models/item_string_list.g.dart b/lib/src/models/item_string_list.g.dart
index 7a603d8..f4c5c21 100644
--- a/lib/src/models/item_string_list.g.dart
+++ b/lib/src/models/item_string_list.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'item_string_list.dart';
diff --git a/lib/src/models/jt_new_model.dart b/lib/src/models/jt_new_model.dart
new file mode 100644
index 0000000..1cbdc25
--- /dev/null
+++ b/lib/src/models/jt_new_model.dart
@@ -0,0 +1,44 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
+import 'package:json_annotation/json_annotation.dart';
+
+part 'jt_new_model.g.dart';
+
+@JsonSerializable()
+class JTNewModel {
+ String id;
+ String link;
+ String title;
+ String author;
+ List published;
+ List updated;
+ String summary;
+ String abstract;
+
+ JTNewModel();
+
+ DateTime getUpdated() {
+ return getDate(updated);
+ }
+
+ DateTime getPublished() {
+ return getDate(published);
+ }
+
+ static DateTime getDate(List list) {
+ var year = list[0];
+ var month = list[1];
+ var day = list[2];
+ var hour = list[3];
+ var minutes = list[4];
+ var seconds = list[5];
+ return DateTime(year, month, day, hour, minutes, seconds);
+ }
+
+ factory JTNewModel.fromJson(Map json) =>
+ _$JTNewModelFromJson(json);
+
+ Map toJson() => _$JTNewModelToJson(this);
+}
diff --git a/lib/src/models/jt_new_model.g.dart b/lib/src/models/jt_new_model.g.dart
new file mode 100644
index 0000000..45ffb74
--- /dev/null
+++ b/lib/src/models/jt_new_model.g.dart
@@ -0,0 +1,34 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
+part of 'jt_new_model.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+JTNewModel _$JTNewModelFromJson(Map json) {
+ return JTNewModel()
+ ..id = json['id'] as String
+ ..link = json['link'] as String
+ ..title = json['title'] as String
+ ..author = json['author'] as String
+ ..published = (json['published'] as List)?.map((e) => e as int)?.toList()
+ ..updated = (json['updated'] as List)?.map((e) => e as int)?.toList()
+ ..summary = json['summary'] as String
+ ..abstract = json['abstract'] as String;
+}
+
+Map _$JTNewModelToJson(JTNewModel instance) =>
+ {
+ 'id': instance.id,
+ 'link': instance.link,
+ 'title': instance.title,
+ 'author': instance.author,
+ 'published': instance.published,
+ 'updated': instance.updated,
+ 'summary': instance.summary,
+ 'abstract': instance.abstract,
+ };
diff --git a/lib/src/models/jt_news_model.dart b/lib/src/models/jt_news_model.dart
new file mode 100644
index 0000000..ea19278
--- /dev/null
+++ b/lib/src/models/jt_news_model.dart
@@ -0,0 +1,21 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
+import 'package:json_annotation/json_annotation.dart';
+
+import 'package:covid19cuba/src/models/jt_new_model.dart';
+
+part 'jt_news_model.g.dart';
+
+@JsonSerializable()
+class JTNewsModel {
+ List news;
+
+ JTNewsModel();
+
+ factory JTNewsModel.fromJson(Map json) =>
+ _$JTNewsModelFromJson(json);
+
+ Map toJson() => _$JTNewsModelToJson(this);
+}
diff --git a/lib/src/models/jt_news_model.g.dart b/lib/src/models/jt_news_model.g.dart
new file mode 100644
index 0000000..cca859c
--- /dev/null
+++ b/lib/src/models/jt_news_model.g.dart
@@ -0,0 +1,23 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
+part of 'jt_news_model.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+JTNewsModel _$JTNewsModelFromJson(Map json) {
+ return JTNewsModel()
+ ..news = (json['news'] as List)
+ ?.map((e) =>
+ e == null ? null : JTNewModel.fromJson(e as Map))
+ ?.toList();
+}
+
+Map _$JTNewsModelToJson(JTNewsModel instance) =>
+ {
+ 'news': instance.news,
+ };
diff --git a/lib/src/models/jt_news_state_model.dart b/lib/src/models/jt_news_state_model.dart
new file mode 100644
index 0000000..28f998e
--- /dev/null
+++ b/lib/src/models/jt_news_state_model.dart
@@ -0,0 +1,38 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
+import 'dart:developer';
+
+import 'package:json_annotation/json_annotation.dart';
+import 'package:preferences/preference_service.dart';
+
+import 'package:covid19cuba/src/data_providers/data_providers.dart';
+import 'package:covid19cuba/src/utils/utils.dart';
+
+part 'jt_news_state_model.g.dart';
+
+@JsonSerializable()
+class JTNewsStateModel {
+ String cache;
+
+ JTNewsStateModel();
+
+ static Future> check() async {
+ try {
+ var state = await getJTNewsStateData();
+ var cacheNew = state.cache;
+ var cacheOld = PrefService.getString(Constants.prefCacheJTNewsHash) ?? "";
+ var cache = cacheNew != cacheOld;
+ return List()..add(cache);
+ } catch (e) {
+ log(e.toString());
+ return null;
+ }
+ }
+
+ factory JTNewsStateModel.fromJson(Map json) =>
+ _$JTNewsStateModelFromJson(json);
+
+ Map toJson() => _$JTNewsStateModelToJson(this);
+}
diff --git a/lib/src/models/jt_news_state_model.g.dart b/lib/src/models/jt_news_state_model.g.dart
new file mode 100644
index 0000000..1c70a48
--- /dev/null
+++ b/lib/src/models/jt_news_state_model.g.dart
@@ -0,0 +1,19 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
+part of 'jt_news_state_model.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+JTNewsStateModel _$JTNewsStateModelFromJson(Map json) {
+ return JTNewsStateModel()..cache = json['cache'] as String;
+}
+
+Map _$JTNewsStateModelToJson(JTNewsStateModel instance) =>
+ {
+ 'cache': instance.cache,
+ };
diff --git a/lib/src/models/list_of_tests_performed.dart b/lib/src/models/list_of_tests_performed.dart
index 845183d..4e34882 100644
--- a/lib/src/models/list_of_tests_performed.dart
+++ b/lib/src/models/list_of_tests_performed.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
import 'package:covid19cuba/src/models/models.dart';
diff --git a/lib/src/models/list_of_tests_performed.g.dart b/lib/src/models/list_of_tests_performed.g.dart
index 07ef8ee..df8b2c0 100644
--- a/lib/src/models/list_of_tests_performed.g.dart
+++ b/lib/src/models/list_of_tests_performed.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'list_of_tests_performed.dart';
diff --git a/lib/src/models/models.dart b/lib/src/models/models.dart
index 769a867..6ba5c66 100644
--- a/lib/src/models/models.dart
+++ b/lib/src/models/models.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
export 'cases_by_mode_of_contagion.dart';
export 'cases_by_nationality.dart';
export 'cases_by_sex.dart';
@@ -12,6 +16,8 @@ export 'distribution_of_cases.dart';
export 'effective_reproductive_number.dart';
export 'evolution_of_deaths_by_days.dart';
export 'evolution_of_recovered_by_days.dart';
+export 'evolution_of_cases_and_recovered_by_days.dart';
+export 'evolution_of_active_and_recovered_accumulated.dart';
export 'item.dart';
export 'item_code.dart';
export 'item_date_list.dart';
@@ -21,6 +27,9 @@ export 'item_list.dart';
export 'item_municipality.dart';
export 'item_province.dart';
export 'item_string_list.dart';
+export 'jt_new_model.dart';
+export 'jt_news_model.dart';
+export 'jt_news_state_model.dart';
export 'list_of_tests_performed.dart';
export 'moment.dart';
export 'municipality_model.dart';
diff --git a/lib/src/models/moment.dart b/lib/src/models/moment.dart
index 3323261..3844383 100644
--- a/lib/src/models/moment.dart
+++ b/lib/src/models/moment.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
import 'package:covid19cuba/src/utils/utils.dart';
diff --git a/lib/src/models/moment.g.dart b/lib/src/models/moment.g.dart
index 6d3f08c..8521d1a 100644
--- a/lib/src/models/moment.g.dart
+++ b/lib/src/models/moment.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'moment.dart';
diff --git a/lib/src/models/municipalities_model.dart b/lib/src/models/municipalities_model.dart
index 0890c19..bb515f0 100644
--- a/lib/src/models/municipalities_model.dart
+++ b/lib/src/models/municipalities_model.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
import 'package:covid19cuba/src/models/models.dart';
diff --git a/lib/src/models/municipalities_model.g.dart b/lib/src/models/municipalities_model.g.dart
index 84ea71e..92794e4 100644
--- a/lib/src/models/municipalities_model.g.dart
+++ b/lib/src/models/municipalities_model.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'municipalities_model.dart';
diff --git a/lib/src/models/municipality_model.dart b/lib/src/models/municipality_model.dart
index c22e77e..42b4835 100644
--- a/lib/src/models/municipality_model.dart
+++ b/lib/src/models/municipality_model.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
import 'package:covid19cuba/src/models/models.dart';
diff --git a/lib/src/models/municipality_model.g.dart b/lib/src/models/municipality_model.g.dart
index 6fb0b65..b57e8b8 100644
--- a/lib/src/models/municipality_model.g.dart
+++ b/lib/src/models/municipality_model.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'municipality_model.dart';
diff --git a/lib/src/models/pesquisador_model.dart b/lib/src/models/pesquisador_model.dart
index fee070c..1b8445e 100644
--- a/lib/src/models/pesquisador_model.dart
+++ b/lib/src/models/pesquisador_model.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
part 'pesquisador_model.g.dart';
diff --git a/lib/src/models/pesquisador_model.g.dart b/lib/src/models/pesquisador_model.g.dart
index 3f9bff5..7068293 100644
--- a/lib/src/models/pesquisador_model.g.dart
+++ b/lib/src/models/pesquisador_model.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'pesquisador_model.dart';
diff --git a/lib/src/models/province_model.dart b/lib/src/models/province_model.dart
index 3397390..b855b52 100644
--- a/lib/src/models/province_model.dart
+++ b/lib/src/models/province_model.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
import 'package:covid19cuba/src/models/models.dart';
diff --git a/lib/src/models/province_model.g.dart b/lib/src/models/province_model.g.dart
index e2bd8b7..351a715 100644
--- a/lib/src/models/province_model.g.dart
+++ b/lib/src/models/province_model.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'province_model.dart';
diff --git a/lib/src/models/provinces_model.dart b/lib/src/models/provinces_model.dart
index 7dcd7c9..f540bf8 100644
--- a/lib/src/models/provinces_model.dart
+++ b/lib/src/models/provinces_model.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
import 'package:covid19cuba/src/models/models.dart';
diff --git a/lib/src/models/provinces_model.g.dart b/lib/src/models/provinces_model.g.dart
index fbd6f68..6a97f57 100644
--- a/lib/src/models/provinces_model.g.dart
+++ b/lib/src/models/provinces_model.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'provinces_model.dart';
diff --git a/lib/src/models/state_model.dart b/lib/src/models/state_model.dart
index b073c23..d87c6d9 100644
--- a/lib/src/models/state_model.dart
+++ b/lib/src/models/state_model.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'dart:developer';
import 'package:json_annotation/json_annotation.dart';
diff --git a/lib/src/models/state_model.g.dart b/lib/src/models/state_model.g.dart
index 87e602a..9c835f1 100644
--- a/lib/src/models/state_model.g.dart
+++ b/lib/src/models/state_model.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'state_model.dart';
diff --git a/lib/src/models/stringency_index_cuba.dart b/lib/src/models/stringency_index_cuba.dart
index ac2b653..2ab0073 100644
--- a/lib/src/models/stringency_index_cuba.dart
+++ b/lib/src/models/stringency_index_cuba.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
import 'package:covid19cuba/src/models/models.dart';
diff --git a/lib/src/models/stringency_index_cuba.g.dart b/lib/src/models/stringency_index_cuba.g.dart
index e6ff15e..947fcce 100644
--- a/lib/src/models/stringency_index_cuba.g.dart
+++ b/lib/src/models/stringency_index_cuba.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'stringency_index_cuba.dart';
diff --git a/lib/src/models/test_behavior_comparison.dart b/lib/src/models/test_behavior_comparison.dart
index a39cae2..130d3a0 100644
--- a/lib/src/models/test_behavior_comparison.dart
+++ b/lib/src/models/test_behavior_comparison.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
part 'test_behavior_comparison.g.dart';
diff --git a/lib/src/models/test_behavior_comparison.g.dart b/lib/src/models/test_behavior_comparison.g.dart
index b275e55..860d489 100644
--- a/lib/src/models/test_behavior_comparison.g.dart
+++ b/lib/src/models/test_behavior_comparison.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'test_behavior_comparison.dart';
diff --git a/lib/src/models/tests_by_days.dart b/lib/src/models/tests_by_days.dart
index 0be5b9a..8332057 100644
--- a/lib/src/models/tests_by_days.dart
+++ b/lib/src/models/tests_by_days.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
import 'package:covid19cuba/src/models/models.dart';
diff --git a/lib/src/models/tests_by_days.g.dart b/lib/src/models/tests_by_days.g.dart
index 572dc9d..e25ca67 100644
--- a/lib/src/models/tests_by_days.g.dart
+++ b/lib/src/models/tests_by_days.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'tests_by_days.dart';
diff --git a/lib/src/models/tests_positive_percent.dart b/lib/src/models/tests_positive_percent.dart
index d5c1f3a..920b724 100644
--- a/lib/src/models/tests_positive_percent.dart
+++ b/lib/src/models/tests_positive_percent.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:json_annotation/json_annotation.dart';
import 'package:covid19cuba/src/models/models.dart';
diff --git a/lib/src/models/tests_positive_percent.g.dart b/lib/src/models/tests_positive_percent.g.dart
index d729cf0..bf4e6a6 100644
--- a/lib/src/models/tests_positive_percent.g.dart
+++ b/lib/src/models/tests_positive_percent.g.dart
@@ -1,4 +1,7 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
part of 'tests_positive_percent.dart';
diff --git a/lib/src/pages/changelog_page.dart b/lib/src/pages/changelog_page.dart
index 557304d..cd2b23e 100644
--- a/lib/src/pages/changelog_page.dart
+++ b/lib/src/pages/changelog_page.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'dart:async';
import 'dart:developer';
diff --git a/lib/src/pages/credits_page.dart b/lib/src/pages/credits_page.dart
index 0c49371..f292d78 100644
--- a/lib/src/pages/credits_page.dart
+++ b/lib/src/pages/credits_page.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'dart:developer';
import 'package:flutter/material.dart';
@@ -283,20 +287,37 @@ class CreditsPage extends StatelessWidget {
);
result.add(
- Container(
- padding: EdgeInsets.symmetric(horizontal: 20, vertical: 20),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Text(
- 'Copyright 2020',
- textAlign: TextAlign.center,
- style: TextStyle(color: Colors.white),
- ),
- Container(padding: EdgeInsets.all(2)),
- Icon(Icons.copyright, color: Colors.white),
- ],
+ GestureDetector(
+ child: Container(
+ padding: EdgeInsets.symmetric(horizontal: 20, vertical: 20),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ Text(
+ 'Copyright 2020',
+ textAlign: TextAlign.center,
+ style: TextStyle(color: Colors.white),
+ ),
+ Container(padding: EdgeInsets.all(2)),
+ Icon(Icons.copyright, color: Colors.white),
+ Container(padding: EdgeInsets.all(2)),
+ Text(
+ 'GPL-3.0',
+ textAlign: TextAlign.center,
+ style: TextStyle(color: Colors.white),
+ ),
+ ],
+ ),
),
+ onTap: () async {
+ const url =
+ 'https://raw.githubusercontent.com/covid19cuba/covid19cuba-app/master/LICENSE';
+ if (await canLaunch(url)) {
+ await launch(url);
+ } else {
+ log('Could not launch $url');
+ }
+ },
),
);
diff --git a/lib/src/pages/cuba_page.dart b/lib/src/pages/cuba_page.dart
index 357aa4b..f7b677e 100644
--- a/lib/src/pages/cuba_page.dart
+++ b/lib/src/pages/cuba_page.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'dart:async';
import 'dart:developer';
@@ -40,7 +44,7 @@ class CubaPageState extends State {
child: BlocBuilder(
builder: (context, state) {
return Scaffold(
- appBar: getAppBar(context, state),
+ appBar: getAppBarTabs(context, state),
drawer: getHomeDrawer(context, state),
body: getBody(context, state),
);
@@ -70,6 +74,22 @@ class CubaPageState extends State {
);
}
+ Widget getAppBarTabs(BuildContext context, HomeState state) {
+ return AppBar(
+ centerTitle: true,
+ title: Text(Constants.appName),
+ actions: [
+ IconButton(
+ icon: Icon(Icons.refresh),
+ color: Colors.white,
+ onPressed: () {
+ BlocProvider.of(context).add(FetchHomeEvent());
+ },
+ ),
+ ],
+ );
+ }
+
Widget getHomeDrawer(BuildContext context, HomeState state) {
return HomeDrawerWidget();
}
diff --git a/lib/src/pages/data_page.dart b/lib/src/pages/data_page.dart
new file mode 100644
index 0000000..913ac00
--- /dev/null
+++ b/lib/src/pages/data_page.dart
@@ -0,0 +1,44 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
+import 'package:flutter/material.dart';
+import 'package:flutter_bloc/flutter_bloc.dart';
+
+import 'package:covid19cuba/src/blocs/blocs.dart';
+import 'package:covid19cuba/src/utils/utils.dart';
+import 'package:covid19cuba/src/utils/constants.dart';
+import 'package:covid19cuba/src/widgets/widgets.dart';
+
+class DataPage extends StatelessWidget {
+ const DataPage({Key key}) : super(key: key);
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ appBar: AppBar(
+ elevation: 0,
+ title: Text(Constants.appName),
+ centerTitle: true,
+ actions: [
+ IconButton(
+ icon: Icon(Icons.refresh),
+ color: Colors.white,
+ onPressed: () {
+ BlocProvider.of(context).add(FetchHomeEvent());
+ },
+ ),
+ ],
+ ),
+ drawer: HomeDrawerWidget(),
+ body: Container(
+ child: Center(
+ child: Text(
+ 'En construcción',
+ style: TextStyle(fontSize: 22),
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/lib/src/pages/faqs_page.dart b/lib/src/pages/faqs_page.dart
index 814d7d0..7b55c76 100644
--- a/lib/src/pages/faqs_page.dart
+++ b/lib/src/pages/faqs_page.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'dart:developer';
import 'package:flutter_linkify/flutter_linkify.dart';
diff --git a/lib/src/pages/home_page.dart b/lib/src/pages/home_page.dart
index 68d3e7b..ab4d75c 100644
--- a/lib/src/pages/home_page.dart
+++ b/lib/src/pages/home_page.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
@@ -17,30 +21,45 @@ class HomePageState extends State
WebViewPage(),
WorldPage(),
CubaPage(),
- ProvinceListPage(),
- MunicipalityListPage(),
+ JTNewsPage(),
+ InfoPage(),
];
static const tabs = [
BottomNavigationBarItem(
icon: Icon(FontAwesomeIcons.notesMedical),
- title: Text('Pesquisa'),
+ title: Text(
+ 'Pesquisa',
+ style: TextStyle(fontSize: 12),
+ ),
),
BottomNavigationBarItem(
icon: Icon(FontAwesomeIcons.globe),
- title: Text('Mundo'),
+ title: Text(
+ 'Mundo',
+ style: TextStyle(fontSize: 12),
+ ),
),
BottomNavigationBarItem(
icon: Icon(FontAwesomeIcons.home),
- title: Text('Cuba'),
+ title: Text(
+ 'Cuba',
+ style: TextStyle(fontSize: 12),
+ ),
),
BottomNavigationBarItem(
- icon: Icon(FontAwesomeIcons.city),
- title: Text('Provincias'),
+ icon: Icon(FontAwesomeIcons.solidNewspaper),
+ title: Text(
+ 'Noticias',
+ style: TextStyle(fontSize: 12),
+ ),
),
BottomNavigationBarItem(
- icon: Icon(FontAwesomeIcons.building),
- title: Text('Municipios'),
+ icon: Icon(FontAwesomeIcons.solidQuestionCircle),
+ title: Text(
+ 'Consejos',
+ style: TextStyle(fontSize: 12),
+ ),
),
];
diff --git a/lib/src/pages/info_more_page.dart b/lib/src/pages/info_more_page.dart
new file mode 100644
index 0000000..916faaa
--- /dev/null
+++ b/lib/src/pages/info_more_page.dart
@@ -0,0 +1,264 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
+import 'package:flutter/material.dart';
+import 'package:flutter_svg/svg.dart';
+
+import 'package:covid19cuba/src/utils/utils.dart';
+import 'package:covid19cuba/src/widgets/widgets.dart';
+
+class InfoMorePage extends StatelessWidget {
+ @override
+ Widget build(BuildContext context) {
+ /*final width = MediaQuery.of(context).size.width;*/
+ return Scaffold(
+ appBar: AppBar(
+ title: Text('Información'),
+ centerTitle: true,
+ ),
+ //backgroundColor: Colors.grey.shade300,
+ body: SingleChildScrollView(
+ scrollDirection: Axis.vertical,
+ child: Container(
+ padding: EdgeInsets.only(bottom: 10),
+ child: Column(
+ children: [
+ SizedBox(
+ height: 15,
+ ),
+ InfoCard(
+ title: '¿Qué es la Covid-19?',
+ content:
+ 'La Covid-19 es la enfermedad infecciosa causada por el '
+ 'coronavirus descubierto más recientemente. '
+ 'Este nuevo virus y enfermedad eran desconocidos '
+ 'antes de que comenzara el brote en Wuhan, China, '
+ 'en diciembre de 2019. La Covid-19 es ahora una '
+ 'pandemia que afecta a muchos países a nivel '
+ 'mundial.',
+ ),
+ InfoCard(
+ title: '¿Cómo se propaga?',
+ content: 'Las personas pueden contraer la Covid-19 de otras '
+ 'personas que tienen el virus. La enfermedad se propaga '
+ 'principalmente de persona a persona a través de pequeñas '
+ 'gotas de la nariz o la boca, que se expulsan cuando una '
+ 'persona con Covid-19 tose, estornuda o habla. Estas gotas '
+ 'son relativamente pesadas, no viajan lejos y se hunden '
+ 'rápidamente en el suelo. Las personas pueden atrapar la '
+ 'Covid-19 si respiran estas gotas de una persona infectada '
+ 'con el virus. Por eso es importante mantenerse al menos a '
+ '1 metro (3 pies) de distancia de los demás. Estas gotitas '
+ 'pueden caer sobre objetos y superficies alrededor de la '
+ 'persona, como mesas, pomos y pasamanos. Las personas '
+ 'pueden infectarse al tocar estos objetos o superficies y '
+ 'luego tocarse los ojos, la nariz o la boca. Es por eso '
+ 'que es importante lavarse las manos regularmente con agua '
+ 'y jabón o limpiar con un desinfectante para manos a base '
+ 'de alcohol.',
+ ),
+ InfoCard(
+ title: 'Signos y síntomas',
+ content: 'Los síntomas más comunes de la Covid-19 son fiebre, '
+ 'tos seca y cansancio. Algunos pacientes pueden tener '
+ 'dolores y molestias, congestión nasal, dolor de garganta '
+ 'o diarrea. Estos síntomas generalmente son leves y '
+ 'comienzan gradualmente.',
+ ),
+ Center(
+ child: SingleChildScrollView(
+ scrollDirection: Axis.horizontal,
+ padding: EdgeInsets.all(5),
+ child: Row(
+ children: [
+ smallCardContainer(
+ 'assets/images/dolor_cabeza.svg',
+ 'Dolor\nde cabeza',
+ context,
+ ),
+ Container(
+ width: 5,
+ ),
+ smallCardContainer(
+ 'assets/images/dolor_garganta.svg',
+ 'Dolor\nde garganta',
+ context,
+ ),
+ Container(
+ width: 5,
+ ),
+ smallCardContainer(
+ 'assets/images/tos.svg',
+ 'Tos\n',
+ context,
+ ),
+ Container(
+ width: 5,
+ ),
+ smallCardContainer(
+ 'assets/images/fiebre.svg',
+ 'Fiebre\n',
+ context,
+ ),
+ Container(
+ width: 5,
+ ),
+ smallCardContainer(
+ 'assets/images/falta_aire.svg',
+ 'Dificultad\npara respirar',
+ context,
+ ),
+ ],
+ ),
+ ),
+ ),
+ InfoCard(
+ title: 'Tratamiento',
+ content: 'Hasta la fecha, no hay vacuna ni medicamentos '
+ 'antivirales específicos contra la Covid-19. Sin embargo, '
+ 'las personas, particularmente aquellas con enfermedades '
+ 'graves, pueden necesitar hospitalización para que puedan '
+ 'recibir un tratamiento que les salve la vida por '
+ 'complicaciones. La mayoría de los pacientes se recuperan '
+ 'gracias a esa atención.',
+ ),
+ Align(
+ alignment: Alignment.bottomLeft,
+ child: Padding(
+ padding: EdgeInsets.only(left: 15),
+ child: Text(
+ 'Prevención',
+ style: Constants.kTitleTextStyle,
+ textAlign: TextAlign.left,
+ ),
+ ),
+ ),
+ SingleChildScrollView(
+ scrollDirection: Axis.vertical,
+ child: Column(
+ children: [
+ SmallCard(
+ imgPath: 'assets/images/clean_hands.svg',
+ imgTitle: 'Lave sus manos',
+ desc: 'Lávese las manos con agua y jabón antes de '
+ 'tocar cualquier cosa, incluidos los ojos, la '
+ 'nariz y la boca.',
+ ),
+ SmallCard(
+ imgPath: 'assets/images/distance_keep_social.png',
+ imgTitle: 'Distancia social',
+ desc: 'Quédese en casa. Evite las multitudes y el '
+ 'contacto con otras personas o animales. Practique '
+ 'el distanciamiento social y evite las reuniones.',
+ ),
+ SmallCard(
+ imgPath: 'assets/images/man_mask.svg',
+ imgTitle: 'Use mascarilla',
+ desc: 'La mascarilla bloquea la emisión de gotas '
+ 'infectadas lo que ayuda a reducir la transmisión '
+ 'comunitaria del coronavirus.',
+ ),
+ SmallCard(
+ imgPath: 'assets/images/avoid_contact_handshake.png',
+ imgTitle: 'Evitar el apretón de manos',
+ desc: 'Evite los apretones de manos, choques de manos, '
+ 'contactos corporales y el contacto con otras '
+ 'superficies.',
+ ),
+ SmallCard(
+ imgPath: 'assets/images/cleaning_soap.svg',
+ imgTitle: 'Desinfecte sus manos',
+ desc: 'En caso de que no haya agua y jabón, use '
+ 'siempre un desinfectante para manos a base de '
+ 'alcohol siempre que toque algo.',
+ ),
+ SmallCard(
+ imgPath: 'assets/images/casa.png',
+ imgTitle: 'Quédate en casa',
+ desc: 'Si está enfermo, quédese en casa y si no tiene '
+ 'nada que hacer afuera, quédese en casa para '
+ 'salvar vidas.',
+ ),
+ ],
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ );
+ }
+}
+
+Widget smallCardContainer(String imgPath, String imgTitle, context) {
+ return Card(
+ child: Container(
+ margin: EdgeInsets.all(10),
+ child: Column(
+ children: [
+ Center(
+ child: imgPath.endsWith('.svg')
+ ? SvgPicture.asset(imgPath, height: 90)
+ : Image.asset(imgPath, height: 90),
+ ),
+ Container(height: 10),
+ Center(
+ child: Text(
+ imgTitle,
+ textAlign: TextAlign.center,
+ style: TextStyle(
+ fontWeight: FontWeight.w600,
+ fontFamily: 'Ubuntu',
+ fontSize: 13,
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+}
+
+class InfoCard extends StatelessWidget {
+ final String content;
+ final String title;
+
+ const InfoCard({Key key, this.content, this.title}) : super(key: key);
+
+ @override
+ Widget build(BuildContext context) {
+ return Column(
+ children: [
+ Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ children: [
+ Container(
+ padding: EdgeInsets.only(
+ left: 15,
+ ),
+ child: Center(
+ child: Text(
+ title,
+ style: Constants.kTitleTextStyle,
+ ),
+ ),
+ ),
+ ],
+ ),
+ Container(
+ margin: EdgeInsets.all(5),
+ child: Card(
+ child: Container(
+ margin: EdgeInsets.all(10),
+ child: Text(
+ content,
+ style: Constants.moreDescStyle,
+ ),
+ ),
+ ),
+ ),
+ ],
+ );
+ }
+}
diff --git a/lib/src/pages/info_page.dart b/lib/src/pages/info_page.dart
new file mode 100644
index 0000000..4cf3800
--- /dev/null
+++ b/lib/src/pages/info_page.dart
@@ -0,0 +1,277 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
+import 'package:flutter/material.dart';
+
+import 'package:flutter_svg/flutter_svg.dart';
+
+import 'package:covid19cuba/src/utils/utils.dart';
+import 'package:covid19cuba/src/pages/pages.dart';
+import 'package:covid19cuba/src/widgets/widgets.dart';
+
+class InfoPage extends StatefulWidget {
+ @override
+ InfoPageState createState() => InfoPageState();
+}
+
+class InfoPageState extends State {
+ final controller = ScrollController();
+ double offset = 0;
+
+ @override
+ void initState() {
+ super.initState();
+ controller.addListener(onScroll);
+ }
+
+ @override
+ void dispose() {
+ controller.dispose();
+ super.dispose();
+ }
+
+ void onScroll() {
+ setState(() {
+ offset = (controller.hasClients) ? controller.offset : 0;
+ });
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final width = MediaQuery.of(context).size.width;
+ return Scaffold(
+ backgroundColor: Colors.transparent,
+ appBar: AppBar(
+ elevation: 0,
+ title: Text(Constants.appName),
+ centerTitle: true,
+ ),
+ drawer: HomeDrawerWidget(),
+ body: SingleChildScrollView(
+ controller: controller,
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ InfoHeader(
+ image: 'assets/images/doctor.svg',
+ textTop: 'Conozca acerca',
+ textBottom: 'de la Covid-19',
+ offset: offset,
+ ),
+ Container(
+ margin: EdgeInsets.symmetric(horizontal: 10),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ children: [
+ Container(
+ margin: EdgeInsets.only(left: 5),
+ child: Text(
+ 'Síntomas principales',
+ style: Constants.kTitleTextStyle,
+ ),
+ ),
+ ],
+ ),
+ ),
+ Container(height: 10),
+ Container(
+ child: SingleChildScrollView(
+ padding: EdgeInsets.symmetric(vertical: 5, horizontal: 10),
+ scrollDirection: Axis.horizontal,
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisSize: MainAxisSize.max,
+ children: [
+ smallCardContainer(
+ 'assets/images/dolor_cabeza.svg',
+ 'Dolor\nde cabeza',
+ context,
+ ),
+ Container(
+ width: 5,
+ ),
+ smallCardContainer(
+ 'assets/images/dolor_garganta.svg',
+ 'Dolor\nde garganta',
+ context,
+ ),
+ Container(
+ width: 5,
+ ),
+ smallCardContainer(
+ 'assets/images/tos.svg',
+ 'Tos\n',
+ context,
+ ),
+ Container(
+ width: 5,
+ ),
+ smallCardContainer(
+ 'assets/images/fiebre.svg',
+ 'Fiebre\n',
+ context,
+ ),
+ Container(
+ width: 5,
+ ),
+ smallCardContainer(
+ 'assets/images/falta_aire.svg',
+ 'Dificultad\npara respirar',
+ context,
+ ),
+ ],
+ ),
+ ),
+ ),
+ Container(
+ margin: EdgeInsets.symmetric(horizontal: 10),
+ child: Card(
+ color: Constants.primaryColor,
+ child: Container(
+ margin: EdgeInsets.all(20),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ children: [
+ Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ 'No salga de casa\n'
+ 'Así detendremos a la Covid-19\n'
+ '#QuédateEnCasa',
+ style: TextStyle(
+ color: Colors.white,
+ fontSize: 16,
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ InkWell(
+ onTap: () {
+ Navigator.of(context).push(
+ MaterialPageRoute(
+ builder: (context) => InfoMorePage(),
+ ),
+ );
+ },
+ child: Container(
+ margin: EdgeInsets.only(top: 20),
+ padding: EdgeInsets.all(8),
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(8),
+ color: Colors.red,
+ ),
+ child: Text(
+ 'Saber más',
+ style: TextStyle(
+ color: Colors.white,
+ fontWeight: FontWeight.w800,
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ Container(width: 30),
+ Flexible(
+ child: Image.asset(
+ 'assets/images/casa.png',
+ width: width * 0.2,
+ fit: BoxFit.cover,
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ ),
+ Container(
+ margin: EdgeInsets.symmetric(horizontal: 10, vertical: 10),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ children: [
+ Container(
+ padding: EdgeInsets.only(left: 5),
+ child: Text(
+ 'Prevención',
+ style: Constants.kTitleTextStyle,
+ ),
+ ),
+ ],
+ ),
+ ),
+ Container(
+ child: SingleChildScrollView(
+ padding: EdgeInsets.symmetric(vertical: 5, horizontal: 10),
+ scrollDirection: Axis.horizontal,
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ children: [
+ smallCardContainer(
+ 'assets/images/clean_hands.svg',
+ 'Lave\nsus manos',
+ context,
+ ),
+ Container(
+ width: 5,
+ ),
+ smallCardContainer(
+ 'assets/images/man_mask.svg',
+ 'Use\nmascarilla',
+ context,
+ ),
+ Container(
+ width: 5,
+ ),
+ smallCardContainer(
+ 'assets/images/dont_face_touch.svg',
+ 'No se toque\nla cara',
+ context,
+ ),
+ Container(
+ width: 5,
+ ),
+ smallCardContainer(
+ 'assets/images/distance_keep_social.png',
+ 'Distancia\nsocial',
+ context,
+ ),
+ ],
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+
+ Widget smallCardContainer(String imgPath, String imgTitle, context) {
+ return Card(
+ child: Container(
+ margin: EdgeInsets.all(10),
+ child: Column(
+ children: [
+ Center(
+ child: imgPath.endsWith('.svg')
+ ? SvgPicture.asset(imgPath, height: 90)
+ : Image.asset(imgPath, height: 90),
+ ),
+ Container(height: 10),
+ Center(
+ child: Text(
+ imgTitle,
+ textAlign: TextAlign.center,
+ style: TextStyle(
+ fontWeight: FontWeight.w600,
+ fontFamily: 'Ubuntu',
+ fontSize: 13,
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+}
diff --git a/lib/src/pages/jt_news_page.dart b/lib/src/pages/jt_news_page.dart
new file mode 100644
index 0000000..6c842ab
--- /dev/null
+++ b/lib/src/pages/jt_news_page.dart
@@ -0,0 +1,371 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
+import 'dart:async';
+import 'dart:developer';
+
+import 'package:flutter/material.dart';
+import 'package:flutter_bloc/flutter_bloc.dart';
+import 'package:flutter_html/flutter_html.dart';
+import 'package:getflutter/getflutter.dart';
+import 'package:url_launcher/url_launcher.dart';
+
+import 'package:covid19cuba/src/blocs/blocs.dart';
+import 'package:covid19cuba/src/pages/pages.dart';
+import 'package:covid19cuba/src/utils/utils.dart';
+import 'package:covid19cuba/src/widgets/error_widget.dart' as ew;
+import 'package:covid19cuba/src/widgets/widgets.dart';
+
+class JTNewsPage extends StatefulWidget {
+ @override
+ State createState() => JTNewsPageState();
+}
+
+class JTNewsPageState extends State {
+ Completer refreshCompleter;
+
+ @override
+ void initState() {
+ super.initState();
+ refreshCompleter = Completer();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ try {
+ return BlocProvider(
+ create: (context) => JTNewsBloc(),
+ child: BlocListener(
+ listener: (context, state) {
+ if (state is LoadedJTNewsState) {
+ refreshCompleter?.complete();
+ refreshCompleter = Completer();
+ }
+ },
+ child: BlocBuilder(
+ builder: (context, state) {
+ return Scaffold(
+ appBar: getAppBar(context, state),
+ drawer: getHomeDrawer(context, state),
+ body: getBody(context, state),
+ );
+ },
+ ),
+ ),
+ );
+ } catch (e) {
+ log(e.toString());
+ return getError();
+ }
+ }
+
+ Widget getAppBar(BuildContext context, JTNewsState state) {
+ return AppBar(
+ centerTitle: true,
+ title: Text(Constants.appName),
+ actions: [
+ IconButton(
+ icon: Icon(Icons.refresh),
+ color: Colors.white,
+ onPressed: () {
+ BlocProvider.of(context).add(
+ FetchJTNewsEvent(),
+ );
+ },
+ ),
+ ],
+ );
+ }
+
+ Widget getHomeDrawer(BuildContext context, JTNewsState state) {
+ return HomeDrawerWidget();
+ }
+
+ Widget getBody(BuildContext context, JTNewsState state) {
+ if (state is InitialJTNewsState) {
+ BlocProvider.of(context).add(LoadJTNewsEvent());
+ }
+ if (state is LoadingJTNewsState) {
+ return LoadingWidget();
+ }
+ if (state is LoadedJTNewsState) {
+ return Container(
+ child: RefreshIndicator(
+ onRefresh: () {
+ BlocProvider.of(context).add(
+ RefreshJTNewsEvent(),
+ );
+ return refreshCompleter.future;
+ },
+ child: ListView(
+ children: state.data.news.map((item) {
+ return Container(
+ margin: EdgeInsets.only(left: 5, right: 5, top: 5, bottom: 5),
+ child: Card(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ GestureDetector(
+ child: Container(
+ margin: EdgeInsets.only(
+ top: 10,
+ left: 10,
+ right: 10,
+ bottom: 5,
+ ),
+ child: Text(
+ item.title,
+ textAlign: TextAlign.start,
+ style: TextStyle(
+ fontWeight: FontWeight.bold,
+ fontSize: 18,
+ color: Colors.red,
+ ),
+ ),
+ ),
+ onTap: () async {
+ if (await canLaunch(item.link)) {
+ await launch(item.link);
+ } else {
+ log('Could not launch $item.link');
+ }
+ },
+ ),
+ Container(
+ margin: EdgeInsets.symmetric(
+ horizontal: 10,
+ vertical: 5,
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Row(
+ children: [
+ Text(
+ 'Fuente: ',
+ textAlign: TextAlign.left,
+ style: TextStyle(
+ fontWeight: FontWeight.bold,
+ fontSize: 11,
+ color: Colors.grey,
+ ),
+ ),
+ Text(
+ 'Juventud Técnica',
+ textAlign: TextAlign.left,
+ style: TextStyle(
+ fontWeight: FontWeight.normal,
+ fontSize: 11,
+ color: Colors.grey,
+ ),
+ ),
+ ],
+ ),
+ Row(
+ children: [
+ Text(
+ 'Autor: ',
+ textAlign: TextAlign.left,
+ style: TextStyle(
+ fontWeight: FontWeight.bold,
+ fontSize: 11,
+ color: Colors.grey,
+ ),
+ ),
+ Text(
+ item.author,
+ textAlign: TextAlign.left,
+ style: TextStyle(
+ fontWeight: FontWeight.normal,
+ fontSize: 11,
+ color: Colors.grey,
+ ),
+ ),
+ ],
+ ),
+ Row(
+ children: [
+ Text(
+ 'Publicación: ',
+ textAlign: TextAlign.left,
+ style: TextStyle(
+ fontWeight: FontWeight.bold,
+ fontSize: 11,
+ color: Colors.grey,
+ ),
+ ),
+ Text(
+ item.getPublished().toStrPlus(time: true),
+ textAlign: TextAlign.left,
+ style: TextStyle(
+ fontWeight: FontWeight.normal,
+ fontSize: 11,
+ color: Colors.grey,
+ ),
+ ),
+ ],
+ ),
+ Row(
+ children: [
+ Text(
+ 'Actualización: ',
+ textAlign: TextAlign.left,
+ style: TextStyle(
+ fontWeight: FontWeight.bold,
+ fontSize: 11,
+ color: Colors.grey,
+ ),
+ ),
+ Text(
+ item.getUpdated().toStrPlus(time: true),
+ textAlign: TextAlign.left,
+ style: TextStyle(
+ fontWeight: FontWeight.normal,
+ fontSize: 11,
+ color: Colors.grey,
+ ),
+ ),
+ ],
+ ),
+ ],
+ ),
+ ),
+ Html(
+ data: item.abstract,
+ padding: EdgeInsets.all(10),
+ linkStyle: TextStyle(
+ color: Colors.red,
+ ),
+ onLinkTap: (url) async {
+ if (await canLaunch(url)) {
+ await launch(url);
+ } else {
+ log('Could not launch $url');
+ }
+ },
+ ),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.end,
+ children: [
+ InkWell(
+ onTap: () {
+ Navigator.of(context).push(
+ MaterialPageRoute(
+ builder: (context) => JTNewsPageMore(item),
+ ),
+ );
+ },
+ child: Container(
+ margin: EdgeInsets.only(bottom: 20, right: 20),
+ padding: EdgeInsets.all(8),
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(8),
+ color: Colors.red,
+ ),
+ child: Text(
+ 'Leer más',
+ style: TextStyle(
+ color: Colors.white,
+ fontWeight: FontWeight.bold,
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ],
+ ),
+ ),
+ );
+ }).toList(),
+ ),
+ ),
+ );
+ }
+ if (state is ErrorJTNewsState) {
+ return ew.ErrorWidget(
+ errorMessage: state.errorMessage,
+ onPressed: () {
+ BlocProvider.of(context).add(FetchJTNewsEvent());
+ },
+ onPressedCache: () {
+ BlocProvider.of(context).add(LoadJTNewsEvent(
+ showNotification: false,
+ ));
+ },
+ cache: state.cache,
+ );
+ }
+ return Container();
+ }
+
+ Widget getError() {
+ return Scaffold(
+ appBar: AppBar(
+ centerTitle: true,
+ title: Text(Constants.appName),
+ ),
+ drawer: HomeDrawerWidget(),
+ body: ListView(
+ children: [
+ Container(
+ margin: EdgeInsets.all(30),
+ child: Icon(
+ Icons.error_outline,
+ color: Constants.primaryColor,
+ size: 150,
+ ),
+ ),
+ Text(
+ 'Ha ocurrido un error',
+ textAlign: TextAlign.center,
+ style: TextStyle(
+ color: Constants.primaryColor,
+ fontWeight: FontWeight.bold,
+ fontSize: 30,
+ ),
+ ),
+ Container(
+ margin: EdgeInsets.all(20),
+ child: Container(
+ padding: EdgeInsets.all(10),
+ child: Text(
+ 'El equipo de desarrollo de la aplicación le pide disculpas '
+ 'y le invita al grupo de Telegram para que reporte el '
+ 'problema y así poder solucionarlo ayudando a los restantes '
+ 'usuarios. Gracias de antemano.',
+ textAlign: TextAlign.left,
+ style: TextStyle(
+ color: Constants.primaryColor,
+ fontWeight: FontWeight.w600,
+ fontSize: 16,
+ ),
+ ),
+ ),
+ ),
+ Container(
+ padding: EdgeInsets.symmetric(horizontal: 50),
+ child: GFButton(
+ text: 'Grupo de soporte en Telegram',
+ textColor: Constants.primaryColor,
+ color: Constants.primaryColor,
+ size: GFSize.LARGE,
+ shape: GFButtonShape.pills,
+ type: GFButtonType.outline2x,
+ fullWidthButton: true,
+ onPressed: () async {
+ const url = 'https://t.me/covid19cubadatachat';
+ if (await canLaunch(url)) {
+ await launch(url);
+ } else {
+ log('Could not launch $url');
+ }
+ },
+ ),
+ ),
+ ],
+ ),
+ );
+ }
+}
diff --git a/lib/src/pages/jt_news_page_more.dart b/lib/src/pages/jt_news_page_more.dart
new file mode 100644
index 0000000..562e2b8
--- /dev/null
+++ b/lib/src/pages/jt_news_page_more.dart
@@ -0,0 +1,180 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
+import 'dart:developer';
+
+import 'package:flutter/material.dart';
+import 'package:flutter_html/flutter_html.dart';
+import 'package:url_launcher/url_launcher.dart';
+
+import 'package:covid19cuba/src/models/models.dart';
+import 'package:covid19cuba/src/utils/utils.dart';
+
+class JTNewsPageMore extends StatelessWidget {
+ final JTNewModel item;
+
+ JTNewsPageMore(this.item);
+
+ Widget build(BuildContext context) {
+ return Scaffold(
+ appBar: AppBar(
+ centerTitle: true,
+ title: Text('Noticias'),
+ ),
+ body: ListView(
+ children: [
+ Container(
+ margin: EdgeInsets.only(left: 5, right: 5, top: 5, bottom: 5),
+ child: Card(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ GestureDetector(
+ child: Container(
+ margin: EdgeInsets.only(
+ top: 10,
+ left: 10,
+ right: 10,
+ bottom: 5,
+ ),
+ child: Text(
+ item.title,
+ textAlign: TextAlign.start,
+ style: TextStyle(
+ fontWeight: FontWeight.bold,
+ fontSize: 18,
+ color: Colors.red,
+ ),
+ ),
+ ),
+ onTap: () async {
+ if (await canLaunch(item.link)) {
+ await launch(item.link);
+ } else {
+ log('Could not launch $item.link');
+ }
+ },
+ ),
+ Container(
+ margin: EdgeInsets.symmetric(
+ horizontal: 10,
+ vertical: 5,
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Row(
+ children: [
+ Text(
+ 'Fuente: ',
+ textAlign: TextAlign.left,
+ style: TextStyle(
+ fontWeight: FontWeight.bold,
+ fontSize: 11,
+ color: Colors.grey,
+ ),
+ ),
+ Text(
+ 'Juventud Técnica',
+ textAlign: TextAlign.left,
+ style: TextStyle(
+ fontWeight: FontWeight.normal,
+ fontSize: 11,
+ color: Colors.grey,
+ ),
+ ),
+ ],
+ ),
+ Row(
+ children: [
+ Text(
+ 'Autor: ',
+ textAlign: TextAlign.left,
+ style: TextStyle(
+ fontWeight: FontWeight.bold,
+ fontSize: 11,
+ color: Colors.grey,
+ ),
+ ),
+ Text(
+ item.author,
+ textAlign: TextAlign.left,
+ style: TextStyle(
+ fontWeight: FontWeight.normal,
+ fontSize: 11,
+ color: Colors.grey,
+ ),
+ ),
+ ],
+ ),
+ Row(
+ children: [
+ Text(
+ 'Publicación: ',
+ textAlign: TextAlign.left,
+ style: TextStyle(
+ fontWeight: FontWeight.bold,
+ fontSize: 11,
+ color: Colors.grey,
+ ),
+ ),
+ Text(
+ item.getPublished().toStrPlus(time: true),
+ textAlign: TextAlign.left,
+ style: TextStyle(
+ fontWeight: FontWeight.normal,
+ fontSize: 11,
+ color: Colors.grey,
+ ),
+ ),
+ ],
+ ),
+ Row(
+ children: [
+ Text(
+ 'Actualización: ',
+ textAlign: TextAlign.left,
+ style: TextStyle(
+ fontWeight: FontWeight.bold,
+ fontSize: 11,
+ color: Colors.grey,
+ ),
+ ),
+ Text(
+ item.getUpdated().toStrPlus(time: true),
+ textAlign: TextAlign.left,
+ style: TextStyle(
+ fontWeight: FontWeight.normal,
+ fontSize: 11,
+ color: Colors.grey,
+ ),
+ ),
+ ],
+ ),
+ ],
+ ),
+ ),
+ Html(
+ data: item.summary,
+ padding: EdgeInsets.all(10),
+ linkStyle: TextStyle(
+ color: Colors.red,
+ ),
+ onLinkTap: (url) async {
+ if (await canLaunch(url)) {
+ await launch(url);
+ } else {
+ log('Could not launch $url');
+ }
+ },
+ ),
+ ],
+ ),
+ ),
+ ),
+ ],
+ ),
+ );
+ }
+}
diff --git a/lib/src/pages/municipality_item_page.dart b/lib/src/pages/municipality_item_page.dart
index 600e73f..4c5088c 100644
--- a/lib/src/pages/municipality_item_page.dart
+++ b/lib/src/pages/municipality_item_page.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'dart:async';
import 'dart:developer';
diff --git a/lib/src/pages/municipality_list_page.dart b/lib/src/pages/municipality_list_page.dart
index 34db6f8..503f3f6 100644
--- a/lib/src/pages/municipality_list_page.dart
+++ b/lib/src/pages/municipality_list_page.dart
@@ -1,8 +1,11 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:flutter/material.dart';
import 'package:covid19cuba/src/pages/pages.dart';
import 'package:covid19cuba/src/utils/utils.dart';
-import 'package:covid19cuba/src/widgets/widgets.dart';
class MunicipalityListPage extends StatefulWidget {
@override
@@ -31,92 +34,95 @@ class MunicipalityListPageState extends State {
@override
Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- elevation: 0,
- title: Text(Constants.appName),
- centerTitle: true,
- ),
- drawer: HomeDrawerWidget(),
- body: Column(
- children: [
- TextField(
- decoration: InputDecoration(
- hintText: 'Buscar ...',
- contentPadding: EdgeInsets.symmetric(horizontal: 20),
- ),
- controller: controller,
- autofocus: false,
+ return
+ // Scaffold(
+ // appBar: AppBar(
+ // elevation: 0,
+ // title: Text(Constants.appName),
+ // centerTitle: true,
+ // ),
+ // drawer: HomeDrawerWidget(),
+ // body:
+ Column(
+ children: [
+ TextField(
+ decoration: InputDecoration(
+ hintText: 'Buscar ...',
+ contentPadding: EdgeInsets.symmetric(horizontal: 20),
),
- Expanded(
- child: ListView.separated(
- itemBuilder: (context, index) {
- if (filter != null &&
- !Constants.municipalitiesNames.values
- .toList()[index]
- .toLowerCase()
- .contains(filter.toLowerCase())) {
- return Container();
- }
- var p = 10.0;
- return FlatButton(
- child: Container(
- padding: index == 0
- ? EdgeInsets.only(
- left: p, right: p, bottom: p, top: p * 2)
- : index == Constants.municipalitiesNames.length - 1
- ? EdgeInsets.only(
- left: p,
- right: p,
- bottom: p * 2,
- top: p,
- )
- : EdgeInsets.all(p),
- child: Text(
- Constants.municipalitiesNames.values.toList()[index],
- style: TextStyle(
- color: Constants.primaryColor,
- fontWeight: FontWeight.bold,
- ),
+ controller: controller,
+ autofocus: false,
+ ),
+ Expanded(
+ child: ListView.separated(
+ itemBuilder: (context, index) {
+ if (filter != null &&
+ !Constants.municipalitiesNames.values
+ .toList()[index]
+ .toLowerCase()
+ .contains(filter.toLowerCase())) {
+ return Container();
+ }
+ var p = 10.0;
+ return FlatButton(
+ child: Container(
+ padding: index == 0
+ ? EdgeInsets.only(
+ left: p, right: p, bottom: p, top: p * 2)
+ : index == Constants.municipalitiesNames.length - 1
+ ? EdgeInsets.only(
+ left: p,
+ right: p,
+ bottom: p * 2,
+ top: p,
+ )
+ : EdgeInsets.all(p),
+ child: Text(
+ Constants.municipalitiesNames.values.toList()[index],
+ style: TextStyle(
+ color: Constants.primaryColor,
+ fontWeight: FontWeight.bold,
),
),
- onPressed: () {
- setState(() {
- var municipality =
- Constants.municipalitiesNames.keys.toList()[index];
- if (municipality == null) {
- Navigator.pop(context);
- } else {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (context) => MunicipalityItemPage(
- municipality: municipality,
- ),
+ ),
+ onPressed: () {
+ setState(() {
+ var municipality =
+ Constants.municipalitiesNames.keys.toList()[index];
+ if (municipality == null) {
+ Navigator.pop(context);
+ } else {
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => MunicipalityItemPage(
+ municipality: municipality,
),
- );
- }
- });
- },
- );
- },
- separatorBuilder: (context, index) {
- if (filter != null &&
- !Constants.municipalitiesNames.values
- .toList()[index]
- .toLowerCase()
- .contains(filter.toLowerCase())) {
- return Container();
- }
- return Divider(
- color: Constants.primaryColor,
- );
- },
- itemCount: Constants.municipalitiesNames.length,
- ),
- )
- ],
- ),
- );
+ ),
+ );
+ }
+ });
+ },
+ );
+ },
+ separatorBuilder: (context, index) {
+ if (filter != null &&
+ !Constants.municipalitiesNames.values
+ .toList()[index]
+ .toLowerCase()
+ .contains(filter.toLowerCase())) {
+ return Container();
+ }
+ return Divider(
+ color: Constants.primaryColor,
+ );
+ },
+ itemCount: Constants.municipalitiesNames.length,
+ ),
+ )
+ ],
+ )
+ //)
+ ;
}
}
diff --git a/lib/src/pages/on_boarding_page.dart b/lib/src/pages/on_boarding_page.dart
index 6a8b23c..b398ff4 100644
--- a/lib/src/pages/on_boarding_page.dart
+++ b/lib/src/pages/on_boarding_page.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:flutter/material.dart';
import 'package:getflutter/getflutter.dart';
import 'package:introduction_screen/introduction_screen.dart';
diff --git a/lib/src/pages/pages.dart b/lib/src/pages/pages.dart
index a82add0..5b34c9a 100644
--- a/lib/src/pages/pages.dart
+++ b/lib/src/pages/pages.dart
@@ -1,7 +1,16 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
export 'changelog_page.dart';
export 'credits_page.dart';
export 'cuba_page.dart';
+export 'data_page.dart';
export 'home_page.dart';
+export 'info_page.dart';
+export 'info_more_page.dart';
+export 'jt_news_page.dart';
+export 'jt_news_page_more.dart';
export 'municipality_item_page.dart';
export 'municipality_list_page.dart';
export 'on_boarding_page.dart';
diff --git a/lib/src/pages/province_item_page.dart b/lib/src/pages/province_item_page.dart
index 4527869..57fae01 100644
--- a/lib/src/pages/province_item_page.dart
+++ b/lib/src/pages/province_item_page.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'dart:async';
import 'dart:developer';
diff --git a/lib/src/pages/province_list_page.dart b/lib/src/pages/province_list_page.dart
index 7c1b59d..32ce0fc 100644
--- a/lib/src/pages/province_list_page.dart
+++ b/lib/src/pages/province_list_page.dart
@@ -1,8 +1,11 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:flutter/material.dart';
import 'package:covid19cuba/src/pages/pages.dart';
import 'package:covid19cuba/src/utils/utils.dart';
-import 'package:covid19cuba/src/widgets/widgets.dart';
class ProvinceListPage extends StatefulWidget {
@override
@@ -31,92 +34,84 @@ class ProvinceListPageState extends State {
@override
Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- elevation: 0,
- title: Text(Constants.appName),
- centerTitle: true,
- ),
- drawer: HomeDrawerWidget(),
- body: Column(
- children: [
- TextField(
- decoration: InputDecoration(
- hintText: 'Buscar ...',
- contentPadding: EdgeInsets.symmetric(horizontal: 20),
- ),
- controller: controller,
- autofocus: false,
+ return Column(
+ children: [
+ TextField(
+ decoration: InputDecoration(
+ hintText: 'Buscar ...',
+ contentPadding: EdgeInsets.symmetric(horizontal: 20),
),
- Expanded(
- child: ListView.separated(
- itemBuilder: (context, index) {
- if (filter != null &&
- !Constants.provinceAbbreviations.values
- .toList()[index]
- .toLowerCase()
- .contains(filter.toLowerCase())) {
- return Container();
- }
- var p = 10.0;
- return FlatButton(
- child: Container(
- padding: index == 0
- ? EdgeInsets.only(
- left: p, right: p, bottom: p, top: p * 2)
- : index == Constants.provinceAbbreviations.length - 1
- ? EdgeInsets.only(
- left: p,
- right: p,
- bottom: p * 2,
- top: p,
- )
- : EdgeInsets.all(p),
- child: Text(
- Constants.provinceAbbreviations.values.toList()[index],
- style: TextStyle(
- color: Constants.primaryColor,
- fontWeight: FontWeight.bold,
- ),
+ controller: controller,
+ autofocus: false,
+ ),
+ Expanded(
+ child: ListView.separated(
+ itemBuilder: (context, index) {
+ if (filter != null &&
+ !Constants.provinceAbbreviations.values
+ .toList()[index]
+ .toLowerCase()
+ .contains(filter.toLowerCase())) {
+ return Container();
+ }
+ var p = 10.0;
+ return FlatButton(
+ child: Container(
+ padding: index == 0
+ ? EdgeInsets.only(
+ left: p, right: p, bottom: p, top: p * 2)
+ : index == Constants.provinceAbbreviations.length - 1
+ ? EdgeInsets.only(
+ left: p,
+ right: p,
+ bottom: p * 2,
+ top: p,
+ )
+ : EdgeInsets.all(p),
+ child: Text(
+ Constants.provinceAbbreviations.values.toList()[index],
+ style: TextStyle(
+ color: Constants.primaryColor,
+ fontWeight: FontWeight.bold,
),
),
- onPressed: () {
- setState(() {
- var province =
- Constants.provinceAbbreviations.keys.toList()[index];
- if (province == null) {
- Navigator.pop(context);
- } else {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (context) => ProvinceItemPage(
- province: province,
- ),
+ ),
+ onPressed: () {
+ setState(() {
+ var province =
+ Constants.provinceAbbreviations.keys.toList()[index];
+ if (province == null) {
+ Navigator.pop(context);
+ } else {
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => ProvinceItemPage(
+ province: province,
),
- );
- }
- });
- },
- );
- },
- separatorBuilder: (context, index) {
- if (filter != null &&
- !Constants.provinceAbbreviations.values
- .toList()[index]
- .toLowerCase()
- .contains(filter.toLowerCase())) {
- return Container();
- }
- return Divider(
- color: Constants.primaryColor,
- );
- },
- itemCount: Constants.provinceAbbreviations.length,
- ),
- )
- ],
- ),
+ ),
+ );
+ }
+ });
+ },
+ );
+ },
+ separatorBuilder: (context, index) {
+ if (filter != null &&
+ !Constants.provinceAbbreviations.values
+ .toList()[index]
+ .toLowerCase()
+ .contains(filter.toLowerCase())) {
+ return Container();
+ }
+ return Divider(
+ color: Constants.primaryColor,
+ );
+ },
+ itemCount: Constants.provinceAbbreviations.length,
+ ),
+ )
+ ],
);
}
}
diff --git a/lib/src/pages/settings_page.dart b/lib/src/pages/settings_page.dart
index 2314437..598533c 100644
--- a/lib/src/pages/settings_page.dart
+++ b/lib/src/pages/settings_page.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'dart:io';
import 'package:flutter/material.dart';
diff --git a/lib/src/pages/tips_page.dart b/lib/src/pages/tips_page.dart
index 0d2e95d..90a6dac 100644
--- a/lib/src/pages/tips_page.dart
+++ b/lib/src/pages/tips_page.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'dart:developer';
import 'package:flutter_linkify/flutter_linkify.dart';
diff --git a/lib/src/pages/update_page.dart b/lib/src/pages/update_page.dart
index ef18b01..da6290a 100644
--- a/lib/src/pages/update_page.dart
+++ b/lib/src/pages/update_page.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'dart:developer';
import 'package:getflutter/getflutter.dart';
diff --git a/lib/src/pages/webview_page.dart b/lib/src/pages/webview_page.dart
index 924be36..b792506 100644
--- a/lib/src/pages/webview_page.dart
+++ b/lib/src/pages/webview_page.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'dart:convert';
import 'package:covid19cuba/src/widgets/widgets.dart';
diff --git a/lib/src/pages/world_page.dart b/lib/src/pages/world_page.dart
index e72abd3..5e9c90b 100644
--- a/lib/src/pages/world_page.dart
+++ b/lib/src/pages/world_page.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'dart:async';
import 'dart:developer';
diff --git a/lib/src/utils/app_theme.dart b/lib/src/utils/app_theme.dart
index 40afb4f..f3c0adf 100644
--- a/lib/src/utils/app_theme.dart
+++ b/lib/src/utils/app_theme.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:flutter/material.dart';
import 'package:covid19cuba/src/utils/utils.dart';
diff --git a/lib/src/utils/background_fetch.dart b/lib/src/utils/background_fetch.dart
index e069051..eef3034 100644
--- a/lib/src/utils/background_fetch.dart
+++ b/lib/src/utils/background_fetch.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:background_fetch/background_fetch.dart';
// This task is executed almost every minimumFetchInterval minutes
diff --git a/lib/src/utils/colors.dart b/lib/src/utils/colors.dart
index c20fe4f..080160a 100644
--- a/lib/src/utils/colors.dart
+++ b/lib/src/utils/colors.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:charts_flutter/flutter.dart' as charts;
class ChartColors {
diff --git a/lib/src/utils/constants.dart b/lib/src/utils/constants.dart
index 8fe1c39..ccb5a92 100644
--- a/lib/src/utils/constants.dart
+++ b/lib/src/utils/constants.dart
@@ -1,7 +1,13 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:flutter/material.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
class Constants {
+ Constants._();
+
static const String appName = 'Covid19 Cuba Data';
static const String appLogo = 'assets/images/logo.png';
static const String diseaseName = 'Covid-19';
@@ -15,6 +21,66 @@ class Constants {
static const showMunicipalities = "covidData";
static const showProvinces = "covidData2";
+ // Colors
+ static const kBackgroundColor = Color(0xFFFEFEFE);
+ static const kTitleTextColor = Color(0xFF303030);
+ static const kBodyTextColor = Color(0xFF4B4B4B);
+ static const kTextLightColor = Color(0xFF959595);
+ static const kInfectedColor = Color(0xFFFF8748);
+ static const kDeathColor = Color(0xFFFF4848);
+ static const kRecoveredColor = Color(0xFF36C12C);
+ static const kPrimaryColor = Color(0xFF3382CC);
+
+ // Text Style
+ static const kHeadingTextStyle = TextStyle(
+ fontSize: 22,
+ fontWeight: FontWeight.w600,
+ );
+
+ static const kSubTextStyle = TextStyle(
+ fontSize: 16,
+ color: kTextLightColor,
+ );
+
+ static const kTitleTextStyle = TextStyle(
+ fontSize: 18,
+ color: kTitleTextColor,
+ fontWeight: FontWeight.bold,
+ );
+
+ static final TextStyle firstHeadingStyle = TextStyle(
+ color: Colors.white,
+ fontSize: 30,
+ fontWeight: FontWeight.w900,
+ );
+
+ static final TextStyle secondHeadingStyle = TextStyle(
+ color: Color(0xFF303030),
+ fontSize: 27,
+ fontWeight: FontWeight.w900,
+ );
+
+ static final TextStyle topTextStyle = TextStyle(
+ color: Colors.white,
+ fontSize: 20,
+ fontWeight: FontWeight.w400,
+ );
+
+ static final TextStyle headingTextStyle = TextStyle(
+ fontSize: 20,
+ fontWeight: FontWeight.w600,
+ color: Colors.black45,
+ );
+
+ static final TextStyle descStyle = TextStyle(
+ color: Colors.white,
+ fontSize: 16,
+ );
+
+ static final TextStyle moreDescStyle = TextStyle(
+ fontSize: 16,
+ );
+
//Shared preferences
static const String prefIsOnBoarding = 'isOnBoarding';
static const String prefCompareCountry = 'compareCountry';
@@ -23,13 +89,17 @@ class Constants {
static const String prefSetUpTasksMinutes = 'setUpTasksMinutes';
static const String prefVersionCode = 'versionCode';
static const String prefData = 'data';
+ static const String prefDataJTNews = 'dataJTNews';
static const String prefCacheHash = 'cacheHash';
+ static const String prefCacheJTNewsHash = 'cacheJTNewsHash';
static const String prefVersionLastSkip = 'versionLastSkip';
static const String prefFirstCacheNotification = 'firstCacheNotification';
static const String prefFirstVersionNotification = 'firstVersionNotification';
static const String prefFirstModificationNotification =
'firstModificationNotification';
static const String prefPesquisador = 'prefPesquisador';
+ static const String prefProvinceSelected = 'prefProvinceSelected';
+ static const String prefMunicipalitySelected = 'prefMunicipalitySelected';
//Connection Modes
static const int ConnectionModeIntranet = 0;
@@ -705,6 +775,13 @@ class Constants {
];
static const collaborators = >[
+ [
+ 'Daniel Alejandro Cárdenas Cabrera',
+ 'Estudiante de Ciencia de la Computación en la Univ. de La Habana. '
+ 'Integrante del grupo de Inteligencia Artificial de la Facultad de '
+ 'Matemática y Computación.',
+ 'https://github.com/DanielUH2019',
+ ],
[
'Luis Eduardo González',
'Ing. en Ciencias Informáticas. Graduado en la Universidad de '
diff --git a/lib/src/utils/exceptions.dart b/lib/src/utils/exceptions.dart
index 1c2a7b2..5faabce 100644
--- a/lib/src/utils/exceptions.dart
+++ b/lib/src/utils/exceptions.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
class BadRequestException implements Exception {
final String message;
diff --git a/lib/src/utils/functions.dart b/lib/src/utils/functions.dart
index 47f9f3b..7c0c245 100644
--- a/lib/src/utils/functions.dart
+++ b/lib/src/utils/functions.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'dart:convert';
import 'dart:developer';
@@ -63,7 +67,7 @@ extension DateTimeToString on DateTime {
return '${this.day}/${this.month}';
}
- String toStrPlus() {
+ String toStrPlus({time: false}) {
var months = [
'enero',
'febrero',
@@ -77,7 +81,10 @@ extension DateTimeToString on DateTime {
'noviembre',
'diciembre',
];
- return '${this.day} de ${months[this.month - 1]} del ${this.year}';
+ if (!time) {
+ return '${this.day} de ${months[this.month - 1]} del ${this.year}';
+ }
+ return '${this.hour % 12 < 10 ? '0' : ''}${this.hour % 12}:${this.minute < 10 ? '0' : ''}${this.minute} ${this.hour < 12 ? 'AM' : 'PM'} del ${this.day} de ${months[this.month - 1]} del ${this.year}';
}
}
diff --git a/lib/src/utils/notification_manager.dart b/lib/src/utils/notification_manager.dart
index 8e8d5ae..8578700 100644
--- a/lib/src/utils/notification_manager.dart
+++ b/lib/src/utils/notification_manager.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'dart:developer';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
diff --git a/lib/src/utils/notifications.dart b/lib/src/utils/notifications.dart
index f3188de..90b1846 100644
--- a/lib/src/utils/notifications.dart
+++ b/lib/src/utils/notifications.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'dart:developer';
import 'package:background_fetch/background_fetch.dart';
diff --git a/lib/src/utils/utils.dart b/lib/src/utils/utils.dart
index 5dd4f8e..9d8f28d 100644
--- a/lib/src/utils/utils.dart
+++ b/lib/src/utils/utils.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
export 'app_theme.dart';
export 'background_fetch.dart';
export 'colors.dart';
diff --git a/lib/src/widgets/comparison_widget.dart b/lib/src/widgets/comparison_widget.dart
index ab1e016..053450b 100644
--- a/lib/src/widgets/comparison_widget.dart
+++ b/lib/src/widgets/comparison_widget.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'dart:math';
import 'package:charts_flutter/flutter.dart' as charts;
@@ -22,8 +26,10 @@ class ComparisonWidget extends StatefulWidget {
}
class ComparisonWidgetState extends State {
- String selectedCountry = Constants.defaultCompareCountry;
+ String firstSelectedCountry = Constants.countryCuba;
+ String secondSelectedCountry = Constants.defaultCompareCountry;
String selectedOption = 'Confirmados';
+ bool firstSelector = false;
final List options = List()
..add('Confirmados')
@@ -37,12 +43,14 @@ class ComparisonWidgetState extends State {
ComparisonWidgetState({this.comparisonOfAccumulatedCases}) {
assert(comparisonOfAccumulatedCases != null);
- selectedCountry = PrefService.getString(Constants.prefCompareCountry) ??
- Constants.defaultCompareCountry;
+ secondSelectedCountry =
+ PrefService.getString(Constants.prefCompareCountry) ??
+ Constants.defaultCompareCountry;
if (!comparisonOfAccumulatedCases.countries.keys
- .contains(selectedCountry)) {
- selectedCountry = Constants.defaultCompareCountry;
- PrefService.setString(Constants.prefCompareCountry, selectedCountry);
+ .contains(secondSelectedCountry)) {
+ secondSelectedCountry = Constants.defaultCompareCountry;
+ PrefService.setString(
+ Constants.prefCompareCountry, secondSelectedCountry);
}
}
@@ -131,27 +139,27 @@ class ComparisonWidgetState extends State {
}
charts.NumericAxisSpec getNumericAxisSpec() {
- var lenCuba = getCountryAttribute(
- comparisonOfAccumulatedCases.countries[Constants.countryCuba],
+ var firstLen = getCountryAttribute(
+ comparisonOfAccumulatedCases.countries[firstSelectedCountry],
).length;
- var lenForeign = getCountryAttribute(
- comparisonOfAccumulatedCases.countries[selectedCountry],
+ var secondLen = getCountryAttribute(
+ comparisonOfAccumulatedCases.countries[secondSelectedCountry],
).length;
return charts.NumericAxisSpec(
- viewport: charts.NumericExtents(1, max(lenForeign, lenCuba)),
+ viewport: charts.NumericExtents(1, max(secondLen, firstLen)),
);
}
charts.NumericAxisSpec getNumericAxisSpecZoom() {
var length = getCountryAttribute(
- comparisonOfAccumulatedCases.countries[Constants.countryCuba],
+ comparisonOfAccumulatedCases.countries[firstSelectedCountry],
).length;
return charts.NumericAxisSpec(viewport: charts.NumericExtents(1, length));
}
List getSpecBehaviors() {
var length = getCountryAttribute(
- comparisonOfAccumulatedCases.countries[Constants.countryCuba],
+ comparisonOfAccumulatedCases.countries[firstSelectedCountry],
).length;
var behaviors = getBehaviors();
behaviors.addAll([
@@ -183,64 +191,64 @@ class ComparisonWidgetState extends State {
bool haveData() {
var length = getCountryAttribute(
- comparisonOfAccumulatedCases.countries[selectedCountry],
+ comparisonOfAccumulatedCases.countries[secondSelectedCountry],
).length;
return length != 0;
}
List> getSeries() {
- List listCuba = getCountryAttribute(
- comparisonOfAccumulatedCases.countries[Constants.countryCuba]);
- List listForeign = getCountryAttribute(
- comparisonOfAccumulatedCases.countries[selectedCountry]);
+ List firstList = getCountryAttribute(
+ comparisonOfAccumulatedCases.countries[firstSelectedCountry]);
+ List secondList = getCountryAttribute(
+ comparisonOfAccumulatedCases.countries[secondSelectedCountry]);
return [
charts.Series(
- id: comparisonOfAccumulatedCases.countries[selectedCountry].name,
- colorFn: (_, __) => ChartColors.blue,
+ id: comparisonOfAccumulatedCases.countries[firstSelectedCountry].name,
+ colorFn: (_, __) => ChartColors.red,
domainFn: (_, i) => i,
measureFn: (item, _) => item,
- data: listForeign,
+ data: firstList,
),
charts.Series(
- id: comparisonOfAccumulatedCases.countries[Constants.countryCuba].name,
- colorFn: (_, __) => ChartColors.red,
+ id: comparisonOfAccumulatedCases.countries[secondSelectedCountry].name,
+ colorFn: (_, __) => ChartColors.blue,
domainFn: (_, i) => i,
measureFn: (item, _) => item,
- data: listCuba,
+ data: secondList,
),
];
}
List> getZoomSeries() {
- List listCuba = getCountryAttribute(
- comparisonOfAccumulatedCases.countries[Constants.countryCuba]);
- List listForeign = getCountryAttribute(
- comparisonOfAccumulatedCases.countries[selectedCountry]);
+ List firstList = getCountryAttribute(
+ comparisonOfAccumulatedCases.countries[firstSelectedCountry]);
+ List secondList = getCountryAttribute(
+ comparisonOfAccumulatedCases.countries[secondSelectedCountry]);
return [
charts.Series(
- id: comparisonOfAccumulatedCases.countries[selectedCountry].name,
- colorFn: (_, __) => ChartColors.blue,
+ id: comparisonOfAccumulatedCases.countries[firstSelectedCountry].name,
+ colorFn: (_, __) => ChartColors.red,
domainFn: (_, i) => i,
measureFn: (item, _) => item,
- data: listForeign
- .take(
- min(listForeign.length, listCuba.length),
- )
- .toList(),
+ data: firstList,
),
charts.Series(
- id: comparisonOfAccumulatedCases.countries[Constants.countryCuba].name,
- colorFn: (_, __) => ChartColors.red,
+ id: comparisonOfAccumulatedCases.countries[secondSelectedCountry].name,
+ colorFn: (_, __) => ChartColors.blue,
domainFn: (_, i) => i,
measureFn: (item, _) => item,
- data: listCuba,
+ data: secondList
+ .take(
+ min(secondList.length, firstList.length),
+ )
+ .toList(),
),
];
}
- Widget _buildSelectedCountry(String iso3code) => Column(
+ Widget _buildsecondSelectedCountry(String iso3code) => Column(
children: [
Row(
children: [
@@ -283,7 +291,8 @@ class ComparisonWidgetState extends State {
child: CountryPickerDialog(
titlePadding: EdgeInsets.all(8.0),
semanticLabel: 'País seleccionado ' +
- comparisonOfAccumulatedCases.countries[selectedCountry].name,
+ comparisonOfAccumulatedCases
+ .countries[secondSelectedCountry].name,
searchCursorColor: Colors.pinkAccent,
searchInputDecoration: InputDecoration(hintText: 'Buscar...'),
searchEmptyView: Center(child: Text('No se encontró el país')),
@@ -295,7 +304,9 @@ class ComparisonWidgetState extends State {
country.iso3Code,
);
setState(() {
- selectedCountry = country.iso3Code;
+ firstSelector
+ ? firstSelectedCountry = country.iso3Code
+ : secondSelectedCountry = country.iso3Code;
});
},
itemFilter: (c) => comparisonOfAccumulatedCases.countries.keys
@@ -317,8 +328,8 @@ class ComparisonWidgetState extends State {
@override
Widget build(BuildContext context) {
- selectedCountry = PrefService.getString(Constants.prefCompareCountry) ??
- Constants.defaultCompareCountry;
+ //secondSelectedCountry = PrefService.getString(Constants.prefCompareCountry) ??
+ // Constants.defaultCompareCountry;
return Column(
children: [
Container(
@@ -329,7 +340,7 @@ class ComparisonWidgetState extends State {
children: [
Expanded(
child: Text(
- 'Comparación de Cuba',
+ 'Comparación entre países',
textAlign: TextAlign.center,
maxLines: 3,
style: TextStyle(
@@ -340,12 +351,22 @@ class ComparisonWidgetState extends State {
),
),
InfoDialogWidget(
- title: 'Comparación de Cuba',
+ title: 'Comparación entre países',
text: getFooter(),
)
],
),
),
+ Container(
+ margin: EdgeInsets.only(left: 35, right: 35),
+ child: ListTile(
+ onTap: (() {
+ firstSelector = true;
+ _openCountryPickerDialog();
+ }),
+ title: _buildsecondSelectedCountry(firstSelectedCountry),
+ ),
+ ),
Container(
margin: EdgeInsets.only(left: 20, right: 20, top: 10),
child: Center(
@@ -363,8 +384,11 @@ class ComparisonWidgetState extends State {
Container(
margin: EdgeInsets.only(left: 35, right: 35),
child: ListTile(
- onTap: _openCountryPickerDialog,
- title: _buildSelectedCountry(selectedCountry),
+ onTap: (() {
+ firstSelector = false;
+ _openCountryPickerDialog();
+ }),
+ title: _buildsecondSelectedCountry(secondSelectedCountry),
),
),
Container(
@@ -458,7 +482,7 @@ class ComparisonWidgetState extends State {
),
child: Center(
child: Text(
- 'Comparación en el período de Cuba',
+ 'Comparación en el período de ${comparisonOfAccumulatedCases.countries[firstSelectedCountry].name}',
textAlign: TextAlign.center,
style: TextStyle(
color: Constants.primaryColor,
diff --git a/lib/src/widgets/containerized_text_widget.dart b/lib/src/widgets/containerized_text_widget.dart
index cfb97ee..2867e6d 100644
--- a/lib/src/widgets/containerized_text_widget.dart
+++ b/lib/src/widgets/containerized_text_widget.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:flutter/material.dart';
class ContainerizedText extends StatelessWidget {
diff --git a/lib/src/widgets/cuba_widget.dart b/lib/src/widgets/cuba_widget.dart
index ca16651..a2c0b48 100644
--- a/lib/src/widgets/cuba_widget.dart
+++ b/lib/src/widgets/cuba_widget.dart
@@ -1,237 +1,143 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:flutter/material.dart';
+import 'package:preferences/preference_service.dart';
+import 'package:search_choices/search_choices.dart';
import 'package:covid19cuba/src/utils/utils.dart';
import 'package:covid19cuba/src/models/models.dart';
import 'package:covid19cuba/src/widgets/widgets.dart';
-class CubaWidget extends StatelessWidget {
+class CubaWidget extends StatefulWidget {
final DataModel data;
const CubaWidget({this.data}) : assert(data != null);
+ @override
+ CubaWidgetState createState() => CubaWidgetState();
+}
+
+class CubaWidgetState extends State {
+ String province;
+ String municipality;
+ List provinces;
+
+ CubaWidgetState() {
+ province = PrefService.getString(Constants.prefProvinceSelected);
+ municipality = PrefService.getString(Constants.prefMunicipalitySelected);
+ provinces = Constants.provinceAbbreviations.entries.map((item) {
+ return DropdownMenuItem(
+ child: Text(item.value),
+ value: item.key,
+ );
+ }).toList();
+ }
+
+ Widget titleWidget(title) {
+ return Container(
+ margin: EdgeInsets.only(left: 10, right: 10, top: 20),
+ child: Center(
+ child: Text(
+ title,
+ textAlign: TextAlign.center,
+ style: TextStyle(
+ fontSize: 22,
+ fontWeight: FontWeight.bold,
+ color: Constants.primaryColor,
+ ),
+ ),
+ ),
+ );
+ }
+
@override
Widget build(BuildContext context) {
- return ListView(
- children: [
- Container(
- color: Constants.primaryColor,
- child:
- ResumeWidget(resume: data.all.resume, updated: data.all.updated),
- ),
- Container(
- margin: EdgeInsets.only(left: 5, right: 5, top: 5),
- child: Card(
- color: Colors.red,
- child: NoteWidget(note: data.all.note),
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 5, right: 5, top: 5),
- child: Card(
- child: MapWebViewWidget(
- mapData: data.all.mapData, eventsData: data.all.events),
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 5, right: 5, top: 5),
- child: Card(
- child: PieSexWidget(casesBySex: data.all.casesBySex),
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 5, right: 5, top: 5),
- child: Card(
- child: PieContagionWidget(
- casesByModeOfContagion: data.all.casesByModeOfContagion,
- ),
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 5, right: 5, top: 5),
- child: Card(
- child: DistributionOfCasesWidget(
- distributionOfCases: data.all.distributionOfCases,
- ),
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 5, right: 5, top: 5),
- child: Card(
- child: EvolutionCasesWidget(
- evolutionOfCasesByDays: data.all.evolutionOfCasesByDays,
- ),
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 5, right: 5, top: 5),
- child: Card(
- child: EvolutionRecoveredWidget(
- evolutionOfRecoveredByDays: data.all.evolutionOfRecoveredByDays,
- ),
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 5, right: 5, top: 5),
- child: Card(
- child: EvolutionDeathWidget(
- evolutionOfDeathsByDays: data.all.evolutionOfDeathsByDays,
- ),
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 5, right: 5, top: 5),
- child: Card(
- child: DistributionAgeGroupsDiagnosedWidget(
- distributionByAgeRanges: data.all.distributionByAgeRanges,
+ var municipalities = province == null
+ ? List()
+ : Constants.municipalitiesNames.entries
+ .where(
+ (x) => x.value.startsWith(
+ Constants.provinceAbbreviations[province],
),
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 5, right: 5, top: 5),
- child: Card(
- child: PieCasesNationalityWidget(
- casesByNationality: data.all.casesByNationality,
- ),
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 5, right: 5, top: 5),
- child: Card(
- child: DistributionNationalityDiagnosedWidget(
- distributionByNationalityOfForeignCases:
- data.all.distributionByNationalityOfForeignCases,
- ),
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 5, right: 5, top: 5),
- child: Card(
- child: PieTestsPercentWidget(
- listOfTestsPerformed: data.all.listOfTestsPerformed,
- ),
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 5, right: 5, top: 5),
- child: Card(
- child: TestEvolutionWidget(testsByDays: data.all.testsByDays),
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 5, right: 5, top: 5),
- child: Card(
- child: TestsPositivePercentWidget(
- testsPositivePercent: data.all.testsPositivePercent,
- ),
- ),
- ),
- Container(
- margin: data.all.effectiveReproductiveNumber == null
- ? EdgeInsets.all(0)
- : EdgeInsets.only(left: 5, right: 5, top: 5),
- child: data.all.effectiveReproductiveNumber == null
- ? Container()
- : Card(
- child: EffectiveReproductiveNumberWidget(
- effectiveReproductiveNumber:
- data.all.effectiveReproductiveNumber,
- ),
+ )
+ .map((item) {
+ return DropdownMenuItem(
+ child: Text(
+ item.value.substring(
+ Constants.provinceAbbreviations[province].length + 3,
),
- ),
- Container(
- margin: EdgeInsets.only(left: 5, right: 5, top: 5),
- child: Card(
- child: StringencyIndexCubaWidget(
- stringencyIndexCuba: data.all.stringencyIndexCuba,
- ),
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 5, right: 5, top: 5),
- child: Card(
- child: Container(
- child: TableData(
- title: 'Provincias Afectadas',
- headers: [
- 'Provincias',
- 'Casos',
- '% del total',
- 'Tasa (por 100 mil hab.)',
- ],
- values: [
- data.all.affectedProvinces
- .map(
- (x) => x.name,
- )
- .toList(),
- data.all.affectedProvinces
- .map(
- (x) => x.value.toString(),
- )
- .toList(),
- data.all.affectedProvinces
- .map(
- (x) =>
- (x.value * 100 / x.total).toStringAsFixed(2) + '%',
- )
- .toList(),
- data.all.affectedProvinces
- .map(
- (x) => (x.value * 100000 / x.population)
- .toStringAsFixed(2),
- )
- .toList(),
- ],
- ),
- ),
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 5, right: 5, top: 5),
- child: Card(
- child: Container(
- child: TableData(
- title: 'TOP Municipios Afectados',
- headers: ['Municipios', 'Casos', '% del total'],
- values: [
- data.all.affectedMunicipalities
- .map(
- (x) => '${x.name} (${x.province})',
- )
- .take(10)
- .toList(),
- data.all.affectedMunicipalities
- .map(
- (x) => x.value.toString(),
- )
- .take(10)
- .toList(),
- data.all.affectedMunicipalities
- .map(
- (x) =>
- (x.value * 100 / x.total).toStringAsFixed(2) + '%',
- )
- .take(10)
- .toList(),
- ],
),
- ),
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 5, right: 5, top: 5),
- child: Card(
- child: ProvincesComparisonWidget(provinces: data.provinces),
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 5, right: 5, top: 5),
- child: Card(
- child: MunicipalitiesComparisonWidget(data: data),
- ),
- ),
- Container(padding: EdgeInsets.all(5)),
- ],
- );
+ value: item.key,
+ );
+ }).toList();
+ var list = List();
+ list.add(UpdateWidget(updated: widget.data.all.updated));
+ var filters = List();
+ filters.add(SearchChoices.single(
+ items: provinces,
+ value: province,
+ onChanged: (value) {
+ PrefService.setString(Constants.prefProvinceSelected, value);
+ PrefService.setString(Constants.prefMunicipalitySelected, null);
+ setState(() {
+ province = value;
+ municipality = null;
+ });
+ },
+ hint: Container(
+ margin: EdgeInsets.all(10),
+ child: Text('Seleccione una provincia'),
+ ),
+ searchHint: 'Seleccione una provincia',
+ closeButton: (sel) => 'Cerrar',
+ isExpanded: true,
+ isCaseSensitiveSearch: false,
+ ));
+ filters.add(SearchChoices.single(
+ items: municipalities,
+ value: municipality,
+ onChanged: (value) {
+ PrefService.setString(Constants.prefProvinceSelected, province);
+ PrefService.setString(Constants.prefMunicipalitySelected, value);
+ setState(() {
+ municipality = value;
+ });
+ },
+ hint: Container(
+ margin: EdgeInsets.all(10),
+ child: Text('Seleccione un municipio'),
+ ),
+ searchHint: 'Seleccione un municipio',
+ closeButton: (sel) => 'Cerrar',
+ isExpanded: true,
+ isCaseSensitiveSearch: false,
+ readOnly: province == null,
+ ));
+ list.add(Container(
+ margin: EdgeInsets.only(left: 5, right: 5, top: 5),
+ child: Card(
+ child: Container(
+ margin: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
+ child: Column(
+ children: filters,
+ ),
+ ),
+ ),
+ ));
+ if (province == null) {
+ list.add(NationalWidget(data: widget.data));
+ list.insert(1, titleWidget('Cuba'));
+ } else if (municipality == null) {
+ list.add(ProvinceWidget(data: widget.data, province: province));
+ list.insert(1, titleWidget(Constants.provinceAbbreviations[province]));
+ } else {
+ list.add(MunicipalityWidget(
+ data: widget.data.getMunicipality(municipality).all,
+ ));
+ list.insert(1, titleWidget(Constants.municipalitiesCodes[municipality]));
+ }
+ return ListView(children: list);
}
}
diff --git a/lib/src/widgets/curves_evolution.dart b/lib/src/widgets/curves_evolution.dart
index f6590ff..194593b 100644
--- a/lib/src/widgets/curves_evolution.dart
+++ b/lib/src/widgets/curves_evolution.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'dart:math';
import 'package:charts_flutter/flutter.dart' as charts;
@@ -81,7 +85,7 @@ class CurvesEvolutionWidgetState extends State {
children: [
Expanded(
child: Text(
- 'Evolución de la epidemia (paises seleccionados)',
+ 'Evolución de la epidemia (países seleccionados)',
textAlign: TextAlign.center,
maxLines: 3,
style: TextStyle(
@@ -92,7 +96,7 @@ class CurvesEvolutionWidgetState extends State {
),
),
InfoDialogWidget(
- title: 'Evolución de la epidemia (paises seleccionados)',
+ title: 'Evolución de la epidemia (países seleccionados)',
text: 'El gráfico muestra a partir de 30 casos, en escala '
'logarítmica y agrupados cada siete días, los casos '
'nuevos por el total de casos confirmados de cada país. '
diff --git a/lib/src/widgets/distribution_age_groups_diagnosed_widget.dart b/lib/src/widgets/distribution_age_groups_diagnosed_widget.dart
index 23860d1..9e459b1 100644
--- a/lib/src/widgets/distribution_age_groups_diagnosed_widget.dart
+++ b/lib/src/widgets/distribution_age_groups_diagnosed_widget.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:charts_flutter/flutter.dart' as charts;
import 'package:flutter/material.dart';
diff --git a/lib/src/widgets/distribution_nationality_diagnosed_widget.dart b/lib/src/widgets/distribution_nationality_diagnosed_widget.dart
index 8e936f2..975e0ad 100644
--- a/lib/src/widgets/distribution_nationality_diagnosed_widget.dart
+++ b/lib/src/widgets/distribution_nationality_diagnosed_widget.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:charts_flutter/flutter.dart' as charts;
import 'package:flutter/material.dart';
@@ -20,7 +24,6 @@ class DistributionNationalityDiagnosedWidget extends StatelessWidget {
}
String dialogText = '';
for (var item in distributionByNationalityOfForeignCases) {
- print(item.code + ' = ' + item.name);
dialogText += '\n' + item.code + ' = ' + item.name;
}
diff --git a/lib/src/widgets/distribution_of_cases_widget.dart b/lib/src/widgets/distribution_of_cases_widget.dart
index 2737ee9..8b88f57 100644
--- a/lib/src/widgets/distribution_of_cases_widget.dart
+++ b/lib/src/widgets/distribution_of_cases_widget.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:charts_flutter/flutter.dart' as charts;
import 'package:flutter/material.dart';
diff --git a/lib/src/widgets/effective_reproductive_number_widget.dart b/lib/src/widgets/effective_reproductive_number_widget.dart
index afc5a3f..99f9304 100644
--- a/lib/src/widgets/effective_reproductive_number_widget.dart
+++ b/lib/src/widgets/effective_reproductive_number_widget.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:charts_flutter/flutter.dart' as charts;
import 'package:flutter/material.dart';
diff --git a/lib/src/widgets/error_widget.dart b/lib/src/widgets/error_widget.dart
index 920d427..8108ea6 100644
--- a/lib/src/widgets/error_widget.dart
+++ b/lib/src/widgets/error_widget.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:flutter/material.dart';
import 'package:getflutter/getflutter.dart';
diff --git a/lib/src/widgets/evolution_active_recovered_widget.dart b/lib/src/widgets/evolution_active_recovered_widget.dart
new file mode 100644
index 0000000..af0dfe0
--- /dev/null
+++ b/lib/src/widgets/evolution_active_recovered_widget.dart
@@ -0,0 +1,100 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
+import 'package:charts_flutter/flutter.dart' as charts;
+import 'package:flutter/material.dart';
+
+import 'package:covid19cuba/src/utils/utils.dart';
+import 'package:covid19cuba/src/models/models.dart';
+
+class EvolutionActiveRecoveredWidget extends StatelessWidget {
+ final EvolutionOfActiveAndRecoveredAccumulated
+ evolutionOfActiveAndRecoveredAccumulated;
+
+ const EvolutionActiveRecoveredWidget(
+ {this.evolutionOfActiveAndRecoveredAccumulated})
+ : assert(evolutionOfActiveAndRecoveredAccumulated != null);
+
+ @override
+ Widget build(BuildContext context) {
+ return Column(
+ children: [
+ Container(
+ margin: EdgeInsets.only(
+ left: 20,
+ right: 20,
+ top: 20,
+ ),
+ child: Center(
+ child: Text(
+ 'Evolución por días de casos activos y altas acumuladas',
+ textAlign: TextAlign.center,
+ style: TextStyle(
+ color: Constants.primaryColor,
+ fontWeight: FontWeight.bold,
+ fontSize: 18,
+ ),
+ ),
+ ),
+ ),
+ Container(
+ padding: EdgeInsets.all(10),
+ height: 400,
+ child: charts.TimeSeriesChart(
+ [
+ charts.Series(
+ id: evolutionOfActiveAndRecoveredAccumulated.active.name,
+ colorFn: (_, __) => ChartColors.red,
+ domainFn: (_, i) =>
+ evolutionOfActiveAndRecoveredAccumulated.date.values[i],
+ measureFn: (item, _) => item,
+ data: evolutionOfActiveAndRecoveredAccumulated.active.values,
+ ),
+ charts.Series(
+ id: evolutionOfActiveAndRecoveredAccumulated.recovered.name,
+ colorFn: (_, __) => ChartColors.blueLight,
+ domainFn: (_, i) =>
+ evolutionOfActiveAndRecoveredAccumulated.date.values[i],
+ measureFn: (item, _) => item,
+ data: evolutionOfActiveAndRecoveredAccumulated.recovered.values,
+ ),
+ ],
+ animate: false,
+ defaultInteractions: true,
+ defaultRenderer: charts.LineRendererConfig(
+ includePoints: true,
+ ),
+ behaviors: [
+ charts.ChartTitle(
+ 'Fecha',
+ behaviorPosition: charts.BehaviorPosition.bottom,
+ titleStyleSpec: charts.TextStyleSpec(fontSize: 11),
+ titleOutsideJustification:
+ charts.OutsideJustification.middleDrawArea,
+ ),
+ charts.ChartTitle(
+ 'Altas',
+ behaviorPosition: charts.BehaviorPosition.start,
+ titleStyleSpec: charts.TextStyleSpec(fontSize: 11),
+ titleOutsideJustification:
+ charts.OutsideJustification.middleDrawArea,
+ ),
+ charts.SeriesLegend(
+ position: charts.BehaviorPosition.bottom,
+ desiredMaxColumns: 1,
+ showMeasures: true,
+ ),
+ charts.LinePointHighlighter(
+ showHorizontalFollowLine:
+ charts.LinePointHighlighterFollowLineType.all,
+ showVerticalFollowLine:
+ charts.LinePointHighlighterFollowLineType.nearest,
+ ),
+ ],
+ ),
+ ),
+ ],
+ );
+ }
+}
diff --git a/lib/src/widgets/evolution_cases_recovered_widget.dart b/lib/src/widgets/evolution_cases_recovered_widget.dart
new file mode 100644
index 0000000..b38650d
--- /dev/null
+++ b/lib/src/widgets/evolution_cases_recovered_widget.dart
@@ -0,0 +1,98 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
+import 'package:charts_flutter/flutter.dart' as charts;
+import 'package:flutter/material.dart';
+
+import 'package:covid19cuba/src/utils/utils.dart';
+import 'package:covid19cuba/src/models/models.dart';
+
+class EvolutionCasesRecoveredWidget extends StatelessWidget {
+ final EvolutionOfCasesAndRecoveredByDays evolutionOfCasesAndRecoveredByDays;
+
+ const EvolutionCasesRecoveredWidget({this.evolutionOfCasesAndRecoveredByDays})
+ : assert(evolutionOfCasesAndRecoveredByDays != null);
+
+ @override
+ Widget build(BuildContext context) {
+ return Column(
+ children: [
+ Container(
+ margin: EdgeInsets.only(
+ left: 20,
+ right: 20,
+ top: 20,
+ ),
+ child: Center(
+ child: Text(
+ 'Evolución por días de casos y altas diarias',
+ textAlign: TextAlign.center,
+ style: TextStyle(
+ color: Constants.primaryColor,
+ fontWeight: FontWeight.bold,
+ fontSize: 18,
+ ),
+ ),
+ ),
+ ),
+ Container(
+ padding: EdgeInsets.all(10),
+ height: 400,
+ child: charts.TimeSeriesChart(
+ [
+ charts.Series(
+ id: evolutionOfCasesAndRecoveredByDays.diagnosed.name,
+ colorFn: (_, __) => ChartColors.red,
+ domainFn: (_, i) =>
+ evolutionOfCasesAndRecoveredByDays.date.values[i],
+ measureFn: (item, _) => item,
+ data: evolutionOfCasesAndRecoveredByDays.diagnosed.values,
+ ),
+ charts.Series(
+ id: evolutionOfCasesAndRecoveredByDays.recovered.name,
+ colorFn: (_, __) => ChartColors.blueLight,
+ domainFn: (_, i) =>
+ evolutionOfCasesAndRecoveredByDays.date.values[i],
+ measureFn: (item, _) => item,
+ data: evolutionOfCasesAndRecoveredByDays.recovered.values,
+ ),
+ ],
+ animate: false,
+ defaultInteractions: true,
+ defaultRenderer: charts.LineRendererConfig(
+ includePoints: true,
+ ),
+ behaviors: [
+ charts.ChartTitle(
+ 'Fecha',
+ behaviorPosition: charts.BehaviorPosition.bottom,
+ titleStyleSpec: charts.TextStyleSpec(fontSize: 11),
+ titleOutsideJustification:
+ charts.OutsideJustification.middleDrawArea,
+ ),
+ charts.ChartTitle(
+ 'Altas',
+ behaviorPosition: charts.BehaviorPosition.start,
+ titleStyleSpec: charts.TextStyleSpec(fontSize: 11),
+ titleOutsideJustification:
+ charts.OutsideJustification.middleDrawArea,
+ ),
+ charts.SeriesLegend(
+ position: charts.BehaviorPosition.bottom,
+ desiredMaxColumns: 1,
+ showMeasures: true,
+ ),
+ charts.LinePointHighlighter(
+ showHorizontalFollowLine:
+ charts.LinePointHighlighterFollowLineType.all,
+ showVerticalFollowLine:
+ charts.LinePointHighlighterFollowLineType.nearest,
+ ),
+ ],
+ ),
+ ),
+ ],
+ );
+ }
+}
diff --git a/lib/src/widgets/evolution_cases_widget.dart b/lib/src/widgets/evolution_cases_widget.dart
index 62dbbac..9c5f65a 100644
--- a/lib/src/widgets/evolution_cases_widget.dart
+++ b/lib/src/widgets/evolution_cases_widget.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:charts_flutter/flutter.dart' as charts;
import 'package:flutter/material.dart';
diff --git a/lib/src/widgets/evolution_death_widget.dart b/lib/src/widgets/evolution_death_widget.dart
index 3486427..df82d51 100644
--- a/lib/src/widgets/evolution_death_widget.dart
+++ b/lib/src/widgets/evolution_death_widget.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:charts_flutter/flutter.dart' as charts;
import 'package:flutter/material.dart';
diff --git a/lib/src/widgets/evolution_recovered_widget.dart b/lib/src/widgets/evolution_recovered_widget.dart
index caf68ed..2e832b5 100644
--- a/lib/src/widgets/evolution_recovered_widget.dart
+++ b/lib/src/widgets/evolution_recovered_widget.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:charts_flutter/flutter.dart' as charts;
import 'package:flutter/material.dart';
diff --git a/lib/src/widgets/home_drawer_widget.dart b/lib/src/widgets/home_drawer_widget.dart
index 45c0c25..983b6e2 100644
--- a/lib/src/widgets/home_drawer_widget.dart
+++ b/lib/src/widgets/home_drawer_widget.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'dart:developer';
import 'package:flutter/material.dart';
@@ -129,6 +133,23 @@ class HomeDrawerWidgetState extends State {
);
}
+ Widget infoItem() {
+ return createDrawerItem(
+ context,
+ icon: Icons.info,
+ text: 'Información',
+ onTap: () {
+ Navigator.of(context).pop();
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => InfoPage(),
+ ),
+ );
+ },
+ );
+ }
+
Widget casesTableItem() {
return createDrawerItem(
context,
diff --git a/lib/src/widgets/info_dialog_widget.dart b/lib/src/widgets/info_dialog_widget.dart
index ff5cc42..05d0662 100644
--- a/lib/src/widgets/info_dialog_widget.dart
+++ b/lib/src/widgets/info_dialog_widget.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'dart:developer';
import 'package:flutter/material.dart';
@@ -15,7 +19,7 @@ class InfoDialogWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return GestureDetector(
- child: Icon(Icons.info),
+ child: Icon(Icons.info, color: Constants.primaryColor.withOpacity(0.54)),
onTap: () {
showDialog(
context: context,
@@ -50,10 +54,16 @@ class InfoDialogWidget extends StatelessWidget {
),
actions: [
FlatButton(
- child: Text('Cerrar'),
- onPressed: () {
- Navigator.pop(context);
- }),
+ child: Text(
+ 'Cerrar',
+ style: TextStyle(
+ color: Constants.primaryColor,
+ ),
+ ),
+ onPressed: () {
+ Navigator.pop(context);
+ },
+ ),
],
);
},
diff --git a/lib/src/widgets/info_header.dart b/lib/src/widgets/info_header.dart
new file mode 100644
index 0000000..893d2d7
--- /dev/null
+++ b/lib/src/widgets/info_header.dart
@@ -0,0 +1,98 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
+import 'package:flutter/material.dart';
+import 'package:flutter_custom_clippers/flutter_custom_clippers.dart';
+import 'package:flutter_svg/flutter_svg.dart';
+
+import 'package:covid19cuba/src/utils/constants.dart';
+
+class InfoHeader extends StatefulWidget {
+ final String image;
+ final String textTop;
+ final String textBottom;
+ final double offset;
+ const InfoHeader(
+ {Key key, this.image, this.textTop, this.textBottom, this.offset})
+ : super(key: key);
+
+ @override
+ _InfoHeaderState createState() => _InfoHeaderState();
+}
+
+class _InfoHeaderState extends State {
+ @override
+ Widget build(BuildContext context) {
+ return ClipPath(
+ clipper: DiagonalPathClipperOne(),
+ child: Container(
+ padding: EdgeInsets.only(left: 40, top: 5, right: 20),
+ height: 170,
+ width: double.infinity,
+ decoration: BoxDecoration(
+ gradient: LinearGradient(
+ begin: Alignment.topCenter,
+ end: Alignment.bottomCenter,
+ colors: [
+ Constants.primaryColor,
+ Constants.primaryColor,
+ ],
+ ),
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.end,
+ children: [
+ SizedBox(height: 20),
+ Expanded(
+ child: Stack(
+ children: [
+ Positioned(
+ top: (widget.offset < 0) ? 0 : widget.offset,
+ child: SvgPicture.asset(
+ widget.image,
+ width: 135,
+ fit: BoxFit.fitWidth,
+ alignment: Alignment.topCenter,
+ ),
+ ),
+ Positioned(
+ top: 20 - widget.offset / 2,
+ left: 140,
+ width: 160.0,
+ child: Text(
+ "${widget.textTop}\n${widget.textBottom}",
+ style: Constants.kHeadingTextStyle.copyWith(
+ color: Colors.white,
+ ),
+ textAlign: TextAlign.end,
+ ),
+ ),
+ Container(), // I dont know why it can't work without container
+ ],
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+}
+
+class MyClipper extends CustomClipper {
+ @override
+ Path getClip(Size size) {
+ var path = Path();
+ path.lineTo(0, size.height - 80);
+ path.quadraticBezierTo(
+ size.width / 2, size.height, size.width, size.height - 80);
+ path.lineTo(size.width, 0);
+ path.close();
+ return path;
+ }
+
+ @override
+ bool shouldReclip(CustomClipper oldClipper) {
+ return false;
+ }
+}
diff --git a/lib/src/widgets/loading_widget.dart b/lib/src/widgets/loading_widget.dart
index 1e8553f..c75b78c 100644
--- a/lib/src/widgets/loading_widget.dart
+++ b/lib/src/widgets/loading_widget.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:flutter/material.dart';
class LoadingWidget extends StatelessWidget {
diff --git a/lib/src/widgets/map_widget.dart b/lib/src/widgets/map_widget.dart
index 760e391..a75c252 100644
--- a/lib/src/widgets/map_widget.dart
+++ b/lib/src/widgets/map_widget.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'dart:convert';
import 'package:flutter/cupertino.dart';
@@ -123,7 +127,7 @@ class MapWebViewWidgetState extends State {
InfoDialogWidget(
title: 'Distribución por Provincias',
text:
- 'El cuadrado representa aquellos que por distintas razones '
+ 'El cuadrado representa aquellos que por distintas razones '
'no tengan localización conocida.',
)
],
diff --git a/lib/src/widgets/municipalities_comparison_widget.dart b/lib/src/widgets/municipalities_comparison_widget.dart
index d4b3e3e..1efb394 100644
--- a/lib/src/widgets/municipalities_comparison_widget.dart
+++ b/lib/src/widgets/municipalities_comparison_widget.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:charts_flutter/flutter.dart' as charts;
import 'package:flutter/material.dart';
diff --git a/lib/src/widgets/municipality_widget.dart b/lib/src/widgets/municipality_widget.dart
index c815d08..1d470cc 100644
--- a/lib/src/widgets/municipality_widget.dart
+++ b/lib/src/widgets/municipality_widget.dart
@@ -1,6 +1,9 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:flutter/material.dart';
-import 'package:covid19cuba/src/utils/utils.dart';
import 'package:covid19cuba/src/models/models.dart';
import 'package:covid19cuba/src/widgets/widgets.dart';
@@ -11,11 +14,13 @@ class MunicipalityWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return ListView(
+ return Column(
children: [
Container(
- color: Constants.primaryColor,
- child: ResumeWidget(resume: data.resume, updated: data.updated),
+ margin: EdgeInsets.only(left: 5, right: 5, top: 5),
+ child: Card(
+ child: ResumeWidget(resume: data.resume),
+ ),
),
] +
(data.resume.map((a) => a.value).reduce((a, b) => a + b) == 0
diff --git a/lib/src/widgets/national_widget.dart b/lib/src/widgets/national_widget.dart
new file mode 100644
index 0000000..186bde9
--- /dev/null
+++ b/lib/src/widgets/national_widget.dart
@@ -0,0 +1,263 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
+import 'package:flutter/material.dart';
+
+import 'package:covid19cuba/src/models/models.dart';
+import 'package:covid19cuba/src/widgets/widgets.dart';
+
+class NationalWidget extends StatelessWidget {
+ final DataModel data;
+
+ const NationalWidget({this.data}) : assert(data != null);
+
+ @override
+ Widget build(BuildContext context) {
+ return Column(
+ children: [
+ Container(
+ margin: EdgeInsets.only(left: 5, right: 5, top: 5),
+ child: Card(
+ child: ResumeWidget(resume: data.all.resume),
+ ),
+ ),
+ Container(
+ margin: data.all.note == null || data.all.note == ''
+ ? EdgeInsets.all(0)
+ : EdgeInsets.only(left: 5, right: 5, top: 5),
+ child: Card(
+ color: Colors.red,
+ child: NoteWidget(note: data.all.note),
+ ),
+ ),
+ Container(
+ margin: EdgeInsets.only(left: 5, right: 5, top: 5),
+ child: Card(
+ child: MapWebViewWidget(
+ mapData: data.all.mapData,
+ eventsData: data.all.events,
+ ),
+ ),
+ ),
+ Container(
+ margin: EdgeInsets.only(left: 5, right: 5, top: 5),
+ child: Card(
+ child: PieSexWidget(casesBySex: data.all.casesBySex),
+ ),
+ ),
+ Container(
+ margin: EdgeInsets.only(left: 5, right: 5, top: 5),
+ child: Card(
+ child: PieContagionWidget(
+ casesByModeOfContagion: data.all.casesByModeOfContagion,
+ ),
+ ),
+ ),
+ Container(
+ margin: EdgeInsets.only(left: 5, right: 5, top: 5),
+ child: Card(
+ child: EvolutionCasesWidget(
+ evolutionOfCasesByDays: data.all.evolutionOfCasesByDays,
+ ),
+ ),
+ ),
+ Container(
+ margin: EdgeInsets.only(left: 5, right: 5, top: 5),
+ child: Card(
+ child: EvolutionRecoveredWidget(
+ evolutionOfRecoveredByDays: data.all.evolutionOfRecoveredByDays,
+ ),
+ ),
+ ),
+ Container(
+ margin: EdgeInsets.only(left: 5, right: 5, top: 5),
+ child: Card(
+ child: EvolutionDeathWidget(
+ evolutionOfDeathsByDays: data.all.evolutionOfDeathsByDays,
+ ),
+ ),
+ ),
+ Container(
+ margin: EdgeInsets.only(left: 5, right: 5, top: 5),
+ child: Card(
+ child: DistributionOfCasesWidget(
+ distributionOfCases: data.all.distributionOfCases,
+ ),
+ ),
+ ),
+ Container(
+ margin: EdgeInsets.only(left: 5, right: 5, top: 5),
+ child: Card(
+ child: EvolutionCasesRecoveredWidget(
+ evolutionOfCasesAndRecoveredByDays:
+ data.all.evolutionOfCasesAndRecoveredByDays,
+ ),
+ ),
+ ),
+ Container(
+ margin: EdgeInsets.only(left: 5, right: 5, top: 5),
+ child: Card(
+ child: EvolutionActiveRecoveredWidget(
+ evolutionOfActiveAndRecoveredAccumulated:
+ data.all.evolutionOfActiveAndRecoveredAccumulated,
+ ),
+ ),
+ ),
+ Container(
+ margin: EdgeInsets.only(left: 5, right: 5, top: 5),
+ child: Card(
+ child: DistributionAgeGroupsDiagnosedWidget(
+ distributionByAgeRanges: data.all.distributionByAgeRanges,
+ ),
+ ),
+ ),
+ Container(
+ margin: EdgeInsets.only(left: 5, right: 5, top: 5),
+ child: Card(
+ child: PieCasesNationalityWidget(
+ casesByNationality: data.all.casesByNationality,
+ ),
+ ),
+ ),
+ Container(
+ margin: EdgeInsets.only(left: 5, right: 5, top: 5),
+ child: Card(
+ child: DistributionNationalityDiagnosedWidget(
+ distributionByNationalityOfForeignCases:
+ data.all.distributionByNationalityOfForeignCases,
+ ),
+ ),
+ ),
+ Container(
+ margin: EdgeInsets.only(left: 5, right: 5, top: 5),
+ child: Card(
+ child: PieTestsPercentWidget(
+ listOfTestsPerformed: data.all.listOfTestsPerformed,
+ ),
+ ),
+ ),
+ Container(
+ margin: EdgeInsets.only(left: 5, right: 5, top: 5),
+ child: Card(
+ child: TestEvolutionWidget(testsByDays: data.all.testsByDays),
+ ),
+ ),
+ Container(
+ margin: EdgeInsets.only(left: 5, right: 5, top: 5),
+ child: Card(
+ child: TestsPositivePercentWidget(
+ testsPositivePercent: data.all.testsPositivePercent,
+ ),
+ ),
+ ),
+ Container(
+ margin: data.all.effectiveReproductiveNumber == null
+ ? EdgeInsets.all(0)
+ : EdgeInsets.only(left: 5, right: 5, top: 5),
+ child: data.all.effectiveReproductiveNumber == null
+ ? Container()
+ : Card(
+ child: EffectiveReproductiveNumberWidget(
+ effectiveReproductiveNumber:
+ data.all.effectiveReproductiveNumber,
+ ),
+ ),
+ ),
+ Container(
+ margin: EdgeInsets.only(left: 5, right: 5, top: 5),
+ child: Card(
+ child: StringencyIndexCubaWidget(
+ stringencyIndexCuba: data.all.stringencyIndexCuba,
+ ),
+ ),
+ ),
+ Container(
+ margin: EdgeInsets.only(left: 5, right: 5, top: 5),
+ child: Card(
+ child: Container(
+ child: TableData(
+ title: 'Provincias Afectadas',
+ headers: [
+ 'Provincias',
+ 'Casos',
+ '% del total',
+ 'Tasa (por 100 mil hab.)',
+ ],
+ values: [
+ data.all.affectedProvinces
+ .map(
+ (x) => x.name,
+ )
+ .toList(),
+ data.all.affectedProvinces
+ .map(
+ (x) => x.value.toString(),
+ )
+ .toList(),
+ data.all.affectedProvinces
+ .map(
+ (x) =>
+ (x.value * 100 / x.total).toStringAsFixed(2) + '%',
+ )
+ .toList(),
+ data.all.affectedProvinces
+ .map(
+ (x) => (x.value * 100000 / x.population)
+ .toStringAsFixed(2),
+ )
+ .toList(),
+ ],
+ ),
+ ),
+ ),
+ ),
+ Container(
+ margin: EdgeInsets.only(left: 5, right: 5, top: 5),
+ child: Card(
+ child: Container(
+ child: TableData(
+ title: 'TOP Municipios Afectados',
+ headers: ['Municipios', 'Casos', '% del total'],
+ values: [
+ data.all.affectedMunicipalities
+ .map(
+ (x) => '${x.name} (${x.province})',
+ )
+ .take(10)
+ .toList(),
+ data.all.affectedMunicipalities
+ .map(
+ (x) => x.value.toString(),
+ )
+ .take(10)
+ .toList(),
+ data.all.affectedMunicipalities
+ .map(
+ (x) =>
+ (x.value * 100 / x.total).toStringAsFixed(2) + '%',
+ )
+ .take(10)
+ .toList(),
+ ],
+ ),
+ ),
+ ),
+ ),
+ Container(
+ margin: EdgeInsets.only(left: 5, right: 5, top: 5),
+ child: Card(
+ child: ProvincesComparisonWidget(provinces: data.provinces),
+ ),
+ ),
+ Container(
+ margin: EdgeInsets.only(left: 5, right: 5, top: 5),
+ child: Card(
+ child: MunicipalitiesComparisonWidget(data: data),
+ ),
+ ),
+ Container(padding: EdgeInsets.all(5)),
+ ],
+ );
+ }
+}
diff --git a/lib/src/widgets/note_widget.dart b/lib/src/widgets/note_widget.dart
index 3e52e07..1c2cfab 100644
--- a/lib/src/widgets/note_widget.dart
+++ b/lib/src/widgets/note_widget.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:flutter/material.dart';
class NoteWidget extends StatelessWidget {
diff --git a/lib/src/widgets/pie_cases_nationality.dart b/lib/src/widgets/pie_cases_nationality.dart
index 200104b..e8f418e 100644
--- a/lib/src/widgets/pie_cases_nationality.dart
+++ b/lib/src/widgets/pie_cases_nationality.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:charts_flutter/flutter.dart' as charts;
import 'package:flutter/material.dart';
diff --git a/lib/src/widgets/pie_contagion_widget.dart b/lib/src/widgets/pie_contagion_widget.dart
index 8d9af66..f595a2e 100644
--- a/lib/src/widgets/pie_contagion_widget.dart
+++ b/lib/src/widgets/pie_contagion_widget.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:charts_flutter/flutter.dart' as charts;
import 'package:flutter/material.dart';
diff --git a/lib/src/widgets/pie_sex_widget.dart b/lib/src/widgets/pie_sex_widget.dart
index bc1c27e..2954cab 100644
--- a/lib/src/widgets/pie_sex_widget.dart
+++ b/lib/src/widgets/pie_sex_widget.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:charts_flutter/flutter.dart' as charts;
import 'package:flutter/material.dart';
diff --git a/lib/src/widgets/pie_tests_percent_widget.dart b/lib/src/widgets/pie_tests_percent_widget.dart
index 0a6d180..ba93ec1 100644
--- a/lib/src/widgets/pie_tests_percent_widget.dart
+++ b/lib/src/widgets/pie_tests_percent_widget.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:charts_flutter/flutter.dart' as charts;
import 'package:flutter/material.dart';
diff --git a/lib/src/widgets/presentation_widget.dart b/lib/src/widgets/presentation_widget.dart
index 090ea1a..5dbf60f 100644
--- a/lib/src/widgets/presentation_widget.dart
+++ b/lib/src/widgets/presentation_widget.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
diff --git a/lib/src/widgets/province_map_widget.dart b/lib/src/widgets/province_map_widget.dart
index 77bd7f2..c4bf9c6 100644
--- a/lib/src/widgets/province_map_widget.dart
+++ b/lib/src/widgets/province_map_widget.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'dart:convert';
import 'package:flutter/foundation.dart';
diff --git a/lib/src/widgets/province_widget.dart b/lib/src/widgets/province_widget.dart
index d202c5f..e6c52f2 100644
--- a/lib/src/widgets/province_widget.dart
+++ b/lib/src/widgets/province_widget.dart
@@ -1,6 +1,9 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:flutter/material.dart';
-import 'package:covid19cuba/src/utils/utils.dart';
import 'package:covid19cuba/src/models/models.dart';
import 'package:covid19cuba/src/widgets/widgets.dart';
@@ -30,13 +33,12 @@ class ProvinceWidgetState extends State {
@override
Widget build(BuildContext context) {
- return ListView(
+ return Column(
children: [
Container(
- color: Constants.primaryColor,
- child: ResumeWidget(
- resume: provinceData.resume,
- updated: provinceData.updated,
+ margin: EdgeInsets.only(left: 5, right: 5, top: 5),
+ child: Card(
+ child: ResumeWidget(resume: provinceData.resume),
),
),
Container(
diff --git a/lib/src/widgets/provinces_comparison_widget.dart b/lib/src/widgets/provinces_comparison_widget.dart
index a052a3f..84f6410 100644
--- a/lib/src/widgets/provinces_comparison_widget.dart
+++ b/lib/src/widgets/provinces_comparison_widget.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:charts_flutter/flutter.dart' as charts;
import 'package:flutter/material.dart';
diff --git a/lib/src/widgets/replica_widget.dart b/lib/src/widgets/replica_widget.dart
index 4a3db86..b94cf38 100644
--- a/lib/src/widgets/replica_widget.dart
+++ b/lib/src/widgets/replica_widget.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'dart:developer';
import 'package:flutter/material.dart';
diff --git a/lib/src/widgets/resume_widget.dart b/lib/src/widgets/resume_widget.dart
index d03713e..9db2089 100644
--- a/lib/src/widgets/resume_widget.dart
+++ b/lib/src/widgets/resume_widget.dart
@@ -1,34 +1,26 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
+import 'package:covid19cuba/src/utils/utils.dart';
import 'package:flutter/material.dart';
import 'package:covid19cuba/src/models/models.dart';
-import 'package:covid19cuba/src/utils/utils.dart';
class ResumeWidget extends StatelessWidget {
final List- resume;
- final DateTime updated;
- const ResumeWidget({
- this.resume,
- this.updated,
- }) : assert(resume != null, updated != null);
+ const ResumeWidget({this.resume}) : assert(resume != null);
@override
Widget build(BuildContext context) {
var borderSide = BorderSide(
- color: Colors.white,
- width: 2,
+ color: Constants.primaryColor,
+ width: 1,
);
return Column(
children:
[
Table(
- border: TableBorder(
- top: BorderSide(
- color: Colors.white,
- width: 4,
- ),
- horizontalInside: borderSide,
- bottom: borderSide,
- ),
children: [
TableRow(
children: [
@@ -37,18 +29,19 @@ class ResumeWidget extends StatelessWidget {
margin: EdgeInsets.all(15),
child: Center(
child: Text(
- 'Actualización del ${updated.toStrPlus()}',
+ 'Resumen',
textAlign: TextAlign.center,
style: TextStyle(
- color: Colors.white,
+ color: Constants.primaryColor,
fontWeight: FontWeight.bold,
+ fontSize: 18,
),
),
),
),
),
],
- )
+ ),
],
),
Table(
@@ -59,7 +52,6 @@ class ResumeWidget extends StatelessWidget {
border: TableBorder(
top: borderSide,
horizontalInside: borderSide,
- bottom: borderSide,
),
children: resume.map((item) {
return TableRow(
@@ -72,7 +64,7 @@ class ResumeWidget extends StatelessWidget {
item.name,
textAlign: TextAlign.center,
style: TextStyle(
- color: Colors.white,
+ color: Constants.primaryColor,
fontWeight: FontWeight.bold,
),
),
@@ -87,7 +79,7 @@ class ResumeWidget extends StatelessWidget {
item.value.toString(),
textAlign: TextAlign.center,
style: TextStyle(
- color: Colors.white,
+ color: Constants.primaryColor,
fontWeight: FontWeight.bold,
),
),
diff --git a/lib/src/widgets/small_card_widget.dart b/lib/src/widgets/small_card_widget.dart
new file mode 100644
index 0000000..b247409
--- /dev/null
+++ b/lib/src/widgets/small_card_widget.dart
@@ -0,0 +1,61 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
+import 'package:flutter/material.dart';
+import 'package:flutter_svg/flutter_svg.dart';
+
+class SmallCard extends StatelessWidget {
+ final String imgPath;
+ final String imgTitle;
+ final String desc;
+
+ const SmallCard({Key key, this.imgPath, this.imgTitle, this.desc})
+ : super(key: key);
+
+ @override
+ Widget build(BuildContext context) {
+ final width = MediaQuery.of(context).size.width;
+ return Container(
+ margin: EdgeInsets.symmetric(horizontal: 5, vertical: 2),
+ child: Card(
+ child: Container(
+ margin: EdgeInsets.symmetric(vertical: 5),
+ child: Row(
+ children: [
+ Container(
+ width: width / 2.5,
+ padding: EdgeInsets.all(10),
+ child: imgPath.endsWith('.svg')
+ ? SvgPicture.asset(imgPath, height: 90)
+ : Image.asset(imgPath, height: 90),
+ ),
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Container(
+ margin: EdgeInsets.only(right: 10, top: 10, bottom: 5),
+ child: Text(
+ imgTitle,
+ style: TextStyle(
+ fontSize: 18,
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ ),
+ Container(
+ margin: EdgeInsets.only(right: 10, top: 5, bottom: 10),
+ child: Text(desc),
+ ),
+ ],
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/lib/src/widgets/stringency_index_cuba_widget.dart b/lib/src/widgets/stringency_index_cuba_widget.dart
index 5dbcadf..ffb699c 100644
--- a/lib/src/widgets/stringency_index_cuba_widget.dart
+++ b/lib/src/widgets/stringency_index_cuba_widget.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:charts_flutter/flutter.dart' as charts;
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
diff --git a/lib/src/widgets/tables_widget.dart b/lib/src/widgets/tables_widget.dart
index 3ad67ff..329c5e9 100644
--- a/lib/src/widgets/tables_widget.dart
+++ b/lib/src/widgets/tables_widget.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:flutter/material.dart';
import 'package:covid19cuba/src/utils/utils.dart';
diff --git a/lib/src/widgets/test_behavior_comparison_widget.dart b/lib/src/widgets/test_behavior_comparison_widget.dart
index da2fc50..1da6922 100644
--- a/lib/src/widgets/test_behavior_comparison_widget.dart
+++ b/lib/src/widgets/test_behavior_comparison_widget.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:charts_flutter/flutter.dart' as charts;
import 'package:flutter/material.dart';
import 'package:getflutter/getflutter.dart';
@@ -93,7 +97,7 @@ class TestBehaviorComparisonWidgetState
InfoDialogWidget(
title: 'Comparación respecto al comportamiento de los Tests '
'realizados',
- text: 'El gráfico permite comparar a Cuba con distintos paises '
+ text: 'El gráfico permite comparar a Cuba con distintos países '
'respecto, a la vez, el porciento de detección de '
'contagiados en base al total de tests realizados y el '
'número de tests por millón de habitantes.\n\n'
diff --git a/lib/src/widgets/test_evolution_widget.dart b/lib/src/widgets/test_evolution_widget.dart
index 3267686..0747b3b 100644
--- a/lib/src/widgets/test_evolution_widget.dart
+++ b/lib/src/widgets/test_evolution_widget.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:charts_flutter/flutter.dart' as charts;
import 'package:flutter/material.dart';
diff --git a/lib/src/widgets/tests_positive_percent_widget.dart b/lib/src/widgets/tests_positive_percent_widget.dart
index a74ac13..67d0867 100644
--- a/lib/src/widgets/tests_positive_percent_widget.dart
+++ b/lib/src/widgets/tests_positive_percent_widget.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:charts_flutter/flutter.dart' as charts;
import 'package:flutter/material.dart';
diff --git a/lib/src/widgets/top_20_accumulated_countries_widget.dart b/lib/src/widgets/top_20_accumulated_countries_widget.dart
deleted file mode 100644
index 91e6735..0000000
--- a/lib/src/widgets/top_20_accumulated_countries_widget.dart
+++ /dev/null
@@ -1,233 +0,0 @@
-import 'package:flutter/material.dart';
-
-import 'package:covid19cuba/src/models/models.dart';
-import 'package:covid19cuba/src/utils/utils.dart';
-import 'package:covid19cuba/src/widgets/widgets.dart';
-
-class Top20CountriesWidget extends StatelessWidget {
- final List top20AccumulatedCountries;
- final DateTime updated;
-
- const Top20CountriesWidget({this.top20AccumulatedCountries, this.updated})
- : assert(top20AccumulatedCountries != null, updated != null);
-
- @override
- Widget build(BuildContext context) {
- var borderSide = BorderSide(
- color: Constants.primaryColor,
- width: 1,
- );
- if (top20AccumulatedCountries == null ||
- top20AccumulatedCountries.length == 0) {
- return Container();
- }
- Map col = {
- 0: FlexColumnWidth(0.3),
- 1: FlexColumnWidth(1),
- 2: FlexColumnWidth(1),
- };
- var index = 0;
- return Column(
- children: [
- Container(
- margin: EdgeInsets.only(
- left: 20,
- right: 20,
- top: 20,
- ),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Expanded(
- child: Text(
- 'Top 20 de países con más casos acumulados',
- textAlign: TextAlign.center,
- maxLines: 3,
- style: TextStyle(
- color: Constants.primaryColor,
- fontWeight: FontWeight.bold,
- fontSize: 18,
- ),
- ),
- ),
- InfoDialogWidget(
- title: 'Top 20 de países con más casos acumulados',
- text: 'Datos de los países tomados '
- 'de\nhttps://github.com/pomber/covid19\ny '
- 'actualizado el '
- '${updated.toStrPlus()}',
- )
- ],
- ),
- ),
- Container(
- margin: EdgeInsets.only(bottom: 10),
- child: Table(
- columnWidths: col,
- border: TableBorder(horizontalInside: borderSide),
- children: [
- TableRow(
- children: [
- TableCell(
- child: Container(
- margin: EdgeInsets.all(5),
- child: Text(
- '#',
- style: TextStyle(
- color: Constants.primaryColor,
- fontWeight: FontWeight.bold,
- fontSize: 11,
- ),
- ),
- ),
- ),
- TableCell(
- child: Container(
- alignment: Alignment.centerLeft,
- margin: EdgeInsets.all(5),
- child: Text(
- 'País',
- style: TextStyle(
- color: Constants.primaryColor,
- fontWeight: FontWeight.bold,
- fontSize: 11,
- ),
- ),
- ),
- ),
- TableCell(
- child: Container(
- margin: EdgeInsets.all(5),
- child: Center(
- child: Text(
- 'Casos',
- style: TextStyle(
- color: Constants.primaryColor,
- fontWeight: FontWeight.bold,
- fontSize: 11,
- ),
- ),
- ),
- ),
- ),
- TableCell(
- child: Container(
- margin: EdgeInsets.all(5),
- child: Center(
- child: Text(
- 'Recuperados',
- style: TextStyle(
- color: Constants.primaryColor,
- fontWeight: FontWeight.bold,
- fontSize: 11,
- ),
- ),
- ),
- ),
- ),
- TableCell(
- child: Container(
- margin: EdgeInsets.all(5),
- child: Center(
- child: Text(
- 'Fallecidos',
- style: TextStyle(
- color: Constants.primaryColor,
- fontWeight: FontWeight.bold,
- fontSize: 11,
- ),
- ),
- ),
- ),
- ),
- ],
- )
- ] +
- top20AccumulatedCountries.map(
- (item) {
- index += 1;
- return TableRow(
- children: [
- TableCell(
- child: Container(
- margin: EdgeInsets.all(5),
- child: Text(
- '$index',
- style: TextStyle(
- color: Constants.primaryColor,
- fontWeight: FontWeight.normal,
- fontSize: 11,
- ),
- ),
- ),
- ),
- TableCell(
- child: Container(
- alignment: Alignment.centerLeft,
- margin: EdgeInsets.all(5),
- child: Text(
- item.name,
- style: TextStyle(
- color: Constants.primaryColor,
- fontWeight: FontWeight.normal,
- fontSize: 11,
- ),
- ),
- ),
- ),
- TableCell(
- child: Container(
- margin: EdgeInsets.all(5),
- child: Center(
- child: Text(
- '${item.confirmed}',
- style: TextStyle(
- color: Constants.primaryColor,
- fontWeight: FontWeight.normal,
- fontSize: 11,
- ),
- ),
- ),
- ),
- ),
- TableCell(
- child: Container(
- margin: EdgeInsets.all(5),
- child: Center(
- child: Text(
- '${item.recovered}',
- style: TextStyle(
- color: Constants.primaryColor,
- fontWeight: FontWeight.normal,
- fontSize: 11,
- ),
- ),
- ),
- ),
- ),
- TableCell(
- child: Container(
- margin: EdgeInsets.all(5),
- child: Center(
- child: Text(
- '${item.deaths}',
- style: TextStyle(
- color: Constants.primaryColor,
- fontWeight: FontWeight.normal,
- fontSize: 11,
- ),
- ),
- ),
- ),
- ),
- ],
- );
- },
- ).toList(),
- ),
- ),
- ],
- );
- }
-}
diff --git a/lib/src/widgets/touchable_url_widget.dart b/lib/src/widgets/touchable_url_widget.dart
index de05418..c5c4c27 100644
--- a/lib/src/widgets/touchable_url_widget.dart
+++ b/lib/src/widgets/touchable_url_widget.dart
@@ -1,3 +1,7 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:flutter/material.dart';
import 'package:covid19cuba/src/utils/utils.dart';
diff --git a/lib/src/widgets/update_widget.dart b/lib/src/widgets/update_widget.dart
new file mode 100644
index 0000000..9968610
--- /dev/null
+++ b/lib/src/widgets/update_widget.dart
@@ -0,0 +1,58 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
+import 'package:flutter/material.dart';
+
+import 'package:covid19cuba/src/utils/utils.dart';
+
+class UpdateWidget extends StatelessWidget {
+ final DateTime updated;
+
+ UpdateWidget({this.updated}) : assert(updated != null);
+
+ @override
+ Widget build(BuildContext context) {
+ return Container(
+ color: Constants.primaryColor,
+ child: Table(
+ border: TableBorder(
+ top: BorderSide(
+ color: Colors.white,
+ width: 4,
+ ),
+ horizontalInside: BorderSide(
+ color: Colors.white,
+ width: 2,
+ ),
+ bottom: BorderSide(
+ color: Colors.white,
+ width: 2,
+ ),
+ ),
+ children: [
+ TableRow(
+ children: [
+ TableCell(
+ child: Container(
+ margin: EdgeInsets.all(15),
+ child: Center(
+ child: Text(
+ 'Actualización del '
+ '${updated.toStrPlus()}',
+ textAlign: TextAlign.center,
+ style: TextStyle(
+ color: Colors.white,
+ fontWeight: FontWeight.bold,
+ ),
+ ),
+ ),
+ ),
+ ),
+ ],
+ )
+ ],
+ ),
+ );
+ }
+}
diff --git a/lib/src/widgets/widgets.dart b/lib/src/widgets/widgets.dart
index f654e00..6af5942 100644
--- a/lib/src/widgets/widgets.dart
+++ b/lib/src/widgets/widgets.dart
@@ -1,17 +1,26 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
export 'comparison_widget.dart';
export 'containerized_text_widget.dart';
export 'curves_evolution.dart';
+export 'cuba_widget.dart';
+export 'update_widget.dart';
export 'distribution_age_groups_diagnosed_widget.dart';
export 'distribution_nationality_diagnosed_widget.dart';
export 'distribution_of_cases_widget.dart';
export 'effective_reproductive_number_widget.dart';
export 'error_widget.dart';
+export 'evolution_active_recovered_widget.dart';
export 'evolution_cases_widget.dart';
+export 'evolution_cases_recovered_widget.dart';
export 'evolution_recovered_widget.dart';
export 'evolution_death_widget.dart';
export 'home_drawer_widget.dart';
-export 'cuba_widget.dart';
+export 'national_widget.dart';
export 'info_dialog_widget.dart';
+export 'info_header.dart';
export 'loading_widget.dart';
export 'map_widget.dart';
export 'municipality_widget.dart';
@@ -27,11 +36,12 @@ export 'province_widget.dart';
export 'provinces_comparison_widget.dart';
export 'replica_widget.dart';
export 'resume_widget.dart';
+export 'small_card_widget.dart';
export 'stringency_index_cuba_widget.dart';
export 'tables_widget.dart';
export 'test_behavior_comparison_widget.dart';
export 'test_evolution_widget.dart';
export 'tests_positive_percent_widget.dart';
-export 'top_20_accumulated_countries_widget.dart';
+export 'world_countries_widget.dart';
export 'touchable_url_widget.dart';
export 'world_widget.dart';
diff --git a/lib/src/widgets/world_countries_widget.dart b/lib/src/widgets/world_countries_widget.dart
new file mode 100644
index 0000000..aef6d8c
--- /dev/null
+++ b/lib/src/widgets/world_countries_widget.dart
@@ -0,0 +1,278 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
+import 'dart:developer';
+
+import 'package:flutter/material.dart';
+import 'package:flutter_linkify/flutter_linkify.dart';
+import 'package:url_launcher/url_launcher.dart';
+
+import 'package:covid19cuba/src/models/models.dart';
+import 'package:covid19cuba/src/utils/utils.dart';
+
+class WorldCountriesWidget extends StatefulWidget {
+ final List worldCountries;
+ final DateTime updated;
+
+ WorldCountriesWidget({this.worldCountries, this.updated})
+ : assert(worldCountries != null, updated != null);
+
+ @override
+ WorldCountriesWidgetState createState() => WorldCountriesWidgetState(
+ worldCountries: worldCountries, updated: updated);
+}
+
+class WorldCountriesWidgetState extends State {
+ List worldCountries;
+ final DateTime updated;
+ var rowsPerPage = PaginatedDataTable.defaultRowsPerPage;
+
+ var isConfirmedSorted = true;
+ var isRecoveredSorted = false;
+ var isDeathsSorted = false;
+
+ var sortColumnIndex = 1;
+ var sortAscending = true;
+
+ WorldCountriesWidgetState({this.worldCountries, this.updated})
+ : assert(worldCountries != null, updated != null);
+
+ @override
+ Widget build(BuildContext context) {
+ if (worldCountries == null || worldCountries.length == 0) {
+ return Container();
+ }
+ return PaginatedDataTable(
+ actions: [
+ IconButton(
+ icon: Icon(Icons.info, color: Constants.primaryColor),
+ onPressed: () {
+ showDialog(
+ context: context,
+ builder: (BuildContext context) {
+ return AlertDialog(
+ title: Text('Acumulados por países'),
+ content: Container(
+ margin: EdgeInsets.only(
+ top: 10,
+ bottom: 10,
+ ),
+ child: Linkify(
+ text: 'Datos de los países tomados '
+ 'de\nhttps://github.com/pomber/covid19\ny '
+ 'actualizado el '
+ '${updated.toStrPlus()}',
+ options: LinkifyOptions(humanize: true),
+ textAlign: TextAlign.left,
+ style: TextStyle(
+ color: Constants.primaryColor,
+ fontSize: 14,
+ ),
+ linkStyle: TextStyle(
+ color: Colors.red,
+ fontSize: 14,
+ ),
+ onOpen: (link) async {
+ if (await canLaunch(link.url)) {
+ await launch(link.url);
+ } else {
+ log('Could not launch $link');
+ }
+ },
+ ),
+ ),
+ actions: [
+ FlatButton(
+ child: Text(
+ 'Cerrar',
+ style: TextStyle(
+ color: Constants.primaryColor,
+ ),
+ ),
+ onPressed: () {
+ Navigator.pop(context);
+ },
+ ),
+ ],
+ );
+ },
+ );
+ },
+ )
+ ],
+ sortColumnIndex: sortColumnIndex,
+ sortAscending: sortAscending,
+ header: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Expanded(
+ child: Text(
+ 'Acumulados por países',
+ textAlign: TextAlign.center,
+ maxLines: 3,
+ style: TextStyle(
+ color: Constants.primaryColor,
+ fontWeight: FontWeight.bold,
+ fontSize: 18,
+ ),
+ ),
+ ),
+ ],
+ ),
+ columns: [
+ DataColumn(
+ label: Text('País'),
+ numeric: false,
+ ),
+ DataColumn(
+ label: Text(
+ 'Casos ',
+ ),
+ numeric: true,
+ onSort: ((a, b) {
+ setState(() {
+ if (isConfirmedSorted) {
+ isConfirmedSorted = false;
+ sortAscending = false;
+ worldCountries
+ .sort((x, y) => x.confirmed.compareTo(y.confirmed));
+ } else {
+ isConfirmedSorted = true;
+ sortAscending = true;
+ worldCountries
+ .sort((x, y) => y.confirmed.compareTo(x.confirmed));
+ }
+ sortColumnIndex = 1;
+ });
+ })),
+ DataColumn(
+ label: Text('Recuperados '),
+ numeric: true,
+ onSort: ((a, b) {
+ setState(() {
+ if (isRecoveredSorted) {
+ isRecoveredSorted = false;
+ sortAscending = false;
+ worldCountries
+ .sort((x, y) => x.recovered.compareTo(y.recovered));
+ } else {
+ isRecoveredSorted = true;
+ sortAscending = true;
+ worldCountries
+ .sort((x, y) => y.recovered.compareTo(x.recovered));
+ }
+ sortColumnIndex = 2;
+ });
+ })),
+ DataColumn(
+ label: Text('Fallecidos '),
+ numeric: true,
+ onSort: (a, b) {
+ setState(
+ () {
+ if (isDeathsSorted) {
+ isDeathsSorted = false;
+ sortAscending = false;
+ worldCountries.sort((x, y) => x.deaths.compareTo(y.deaths));
+ } else {
+ isDeathsSorted = true;
+ sortAscending = true;
+ worldCountries.sort((x, y) => y.deaths.compareTo(x.deaths));
+ }
+ sortColumnIndex = 3;
+ },
+ );
+ },
+ ),
+ ],
+ source: DataTableSourceImplemented(
+ top20AccumulatedCountries: worldCountries,
+ ),
+ columnSpacing: 1.5,
+ horizontalMargin: 3.5,
+ rowsPerPage: rowsPerPage,
+ );
+ }
+}
+
+class DataTableSourceImplemented extends DataTableSource {
+ List top20AccumulatedCountries;
+
+ DataTableSourceImplemented({this.top20AccumulatedCountries})
+ : assert(top20AccumulatedCountries != null);
+
+ @override
+ DataRow getRow(int index) => DataRow.byIndex(
+ index: index,
+ cells: [
+ DataCell(
+ Container(
+ margin: EdgeInsets.all(5),
+ child: Text(
+ '${top20AccumulatedCountries[index].name}',
+ style: TextStyle(
+ color: Constants.primaryColor,
+ fontWeight: FontWeight.normal,
+ fontSize: 11,
+ ),
+ ),
+ ),
+ ),
+ DataCell(
+ Container(
+ margin: EdgeInsets.all(5),
+ child: Container(
+ child: Text(
+ '${top20AccumulatedCountries[index].confirmed}',
+ textAlign: TextAlign.center,
+ style: TextStyle(
+ color: Constants.primaryColor,
+ fontWeight: FontWeight.normal,
+ fontSize: 11),
+ ),
+ ),
+ ),
+ ),
+ DataCell(
+ Container(
+ margin: EdgeInsets.all(5),
+ child: Container(
+ child: Text(
+ '${top20AccumulatedCountries[index].recovered}',
+ style: TextStyle(
+ color: Constants.primaryColor,
+ fontWeight: FontWeight.normal,
+ fontSize: 11),
+ ),
+ ),
+ ),
+ ),
+ DataCell(
+ Container(
+ margin: EdgeInsets.all(5),
+ child: Container(
+ padding: EdgeInsets.only(right: 10),
+ child: Text(
+ '${top20AccumulatedCountries[index].deaths}',
+ style: TextStyle(
+ color: Constants.primaryColor,
+ fontWeight: FontWeight.normal,
+ fontSize: 11),
+ ),
+ ),
+ ),
+ ),
+ ],
+ );
+
+ @override
+ bool get isRowCountApproximate => false;
+
+ @override
+ int get rowCount => top20AccumulatedCountries.length;
+
+ @override
+ int get selectedRowCount => 0;
+}
diff --git a/lib/src/widgets/world_widget.dart b/lib/src/widgets/world_widget.dart
index 507cb76..f119223 100644
--- a/lib/src/widgets/world_widget.dart
+++ b/lib/src/widgets/world_widget.dart
@@ -1,6 +1,9 @@
+// Copyright (C) 2020 covid19cuba
+// Use of this source code is governed by a GNU GPL 3 license that can be
+// found in the LICENSE file.
+
import 'package:flutter/material.dart';
-import 'package:covid19cuba/src/utils/utils.dart';
import 'package:covid19cuba/src/models/models.dart';
import 'package:covid19cuba/src/widgets/widgets.dart';
@@ -13,15 +16,11 @@ class WorldWidget extends StatelessWidget {
Widget build(BuildContext context) {
return ListView(
children: [
+ UpdateWidget(updated: data.all.updated),
Container(
- color: Constants.primaryColor,
- child: ResumeWidget(
- resume: List- (),
- updated: data.all.updated,
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 5, right: 5, top: 5),
+ margin: data.all.note == null || data.all.note == ''
+ ? EdgeInsets.all(0)
+ : EdgeInsets.only(left: 5, right: 5, top: 5),
child: Card(
color: Colors.red,
child: NoteWidget(note: data.all.note),
@@ -59,13 +58,9 @@ class WorldWidget extends StatelessWidget {
),
Container(
margin: EdgeInsets.only(left: 5, right: 5, top: 5),
- child: Card(
- child: Container(
- child: Top20CountriesWidget(
- top20AccumulatedCountries: data.all.top20AccumulatedCountries,
- updated: data.all.comparisonOfAccumulatedCases.updated,
- ),
- ),
+ child: WorldCountriesWidget(
+ worldCountries: data.all.worldCountries,
+ updated: data.all.comparisonOfAccumulatedCases.updated,
),
),
Container(padding: EdgeInsets.all(5)),
diff --git a/pubspec.lock b/pubspec.lock
index c9bac20..c60bccf 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -237,6 +237,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
+ flutter_custom_clippers:
+ dependency: "direct main"
+ description:
+ name: flutter_custom_clippers
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.1.1"
+ flutter_html:
+ dependency: "direct main"
+ description:
+ name: flutter_html
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.11.1"
flutter_launcher_icons:
dependency: "direct main"
description:
@@ -265,6 +279,11 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
+ flutter_localizations:
+ dependency: "direct main"
+ description: flutter
+ source: sdk
+ version: "0.0.0"
flutter_native_splash:
dependency: "direct dev"
description:
@@ -272,6 +291,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.9"
+ flutter_svg:
+ dependency: "direct main"
+ description:
+ name: flutter_svg
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.17.4"
flutter_web_plugins:
dependency: transitive
description: flutter
@@ -466,6 +492,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.4"
+ path_drawing:
+ dependency: transitive
+ description:
+ name: path_drawing
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.4.1"
+ path_parsing:
+ dependency: transitive
+ description:
+ name: path_parsing
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.1.4"
pedantic:
dependency: transitive
description:
@@ -543,6 +583,13 @@ packages:
relative: true
source: path
version: "1.0.5-fix"
+ search_choices:
+ dependency: "direct main"
+ description:
+ name: search_choices
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.0.15"
searchable_dropdown:
dependency: "direct main"
description:
diff --git a/pubspec.yaml b/pubspec.yaml
index 15b2366..7ae63ae 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,7 +1,7 @@
name: covid19cuba
description: Mobile application of Covid19 Cuba Data project implemented with Flutter.
-version: 0.7.1+12
+version: 0.8.0+13
environment:
sdk: ">=2.6.0 <3.0.0"
@@ -36,6 +36,12 @@ dependencies:
flutter_linkify: ^3.1.2
searchable_dropdown: ^1.1.3
timezone: ^0.5.7
+ flutter_html: ^0.11.1
+ flutter_svg: ^0.17.4
+ flutter_custom_clippers: ^1.1.1
+ flutter_localizations:
+ sdk: flutter
+ search_choices: ^1.0.15
dev_dependencies:
flutter_native_splash: ^0.1.9
@@ -59,7 +65,11 @@ flutter:
- assets/map.html
- assets/map2.html
- assets/js/municipios.js
+ fonts:
+ - family: Ubuntu
+ fonts:
+ - asset: fonts/Ubuntu/Ubuntu-Regular.ttf
flutter_native_splash:
image: assets/images/icon.jpg
- color: "1c1340"
\ No newline at end of file
+ color: "1c1340"