-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
789 additions
and
8 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// 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/data_providers/data_providers.dart'; | ||
import 'package:covid19cuba/src/models/phases/phases.dart'; | ||
import 'package:covid19cuba/src/models/phases/phases_state.dart'; | ||
import 'package:covid19cuba/src/utils/utils.dart'; | ||
|
||
class PhasesProvider extends DataProvider<Phases, PhasesState> { | ||
@override | ||
String get urlDataCU => | ||
'https://cusobu.nat.cu/covid/api/v2/phases.json'; | ||
|
||
@override | ||
String get urlDataIO => | ||
'https://covid19cuba.github.io/covid19cubadata.github.io/api/v2/phases.json'; | ||
|
||
@override | ||
String get urlDataStateCU => | ||
'https://cusobu.nat.cu/covid/api/v2/phases_state.json'; | ||
|
||
@override | ||
String get urlDataStateIO => | ||
'https://covid19cuba.github.io/covid19cubadata.github.io/api/v2/phases_state.json'; | ||
|
||
@override | ||
String get prefData => Constants.prefPhases; | ||
|
||
@override | ||
String get prefHash => Constants.prefPhasesState; | ||
|
||
@override | ||
Phases dataFromJson(Map<String, dynamic> data) => | ||
Phases.fromJson(data); | ||
|
||
@override | ||
PhasesState dataStateFromJson(Map<String, dynamic> data) => | ||
PhasesState.fromJson(data); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// 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/model.dart'; | ||
import 'package:covid19cuba/src/models/phases/phases_category.dart'; | ||
import 'package:covid19cuba/src/models/phases/phases_item.dart'; | ||
import 'package:covid19cuba/src/models/phases/phases_measure.dart'; | ||
import 'package:json_annotation/json_annotation.dart'; | ||
|
||
part 'phases.g.dart'; | ||
|
||
@JsonSerializable() | ||
class Phases extends Model { | ||
List<PhasesItem> phases; | ||
Map<String, PhasesCategory> categories; | ||
Map<String, PhasesMeasure> measures; | ||
|
||
Phases(); | ||
|
||
factory Phases.fromJson(Map<String, dynamic> json) => _$PhasesFromJson(json); | ||
|
||
Map<String, dynamic> toJson() => _$PhasesToJson(this); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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'; | ||
|
||
part 'phases_category.g.dart'; | ||
|
||
@JsonSerializable() | ||
class PhasesCategory { | ||
String name; | ||
@JsonKey(required: false) | ||
String parent; | ||
|
||
PhasesCategory(); | ||
|
||
factory PhasesCategory.fromJson(Map<String, dynamic> json) => | ||
_$PhasesCategoryFromJson(json); | ||
|
||
Map<String, dynamic> toJson() => _$PhasesCategoryToJson(this); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// 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 'phases_item.g.dart'; | ||
|
||
@JsonSerializable() | ||
class PhasesItem { | ||
int order; | ||
String name; | ||
List<String> provinces; | ||
List<String> measures; | ||
|
||
PhasesItem(); | ||
|
||
factory PhasesItem.fromJson(Map<String, dynamic> json) => | ||
_$PhasesItemFromJson(json); | ||
|
||
Map<String, dynamic> toJson() => _$PhasesItemToJson(this); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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'; | ||
|
||
part 'phases_measure.g.dart'; | ||
|
||
@JsonSerializable() | ||
class PhasesMeasure { | ||
String text; | ||
String category; | ||
List<int> phases; | ||
|
||
PhasesMeasure(); | ||
|
||
factory PhasesMeasure.fromJson(Map<String, dynamic> json) => | ||
_$PhasesMeasureFromJson(json); | ||
|
||
Map<String, dynamic> toJson() => _$PhasesMeasureToJson(this); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// 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/model.dart'; | ||
import 'package:json_annotation/json_annotation.dart'; | ||
|
||
part 'phases_state.g.dart'; | ||
|
||
@JsonSerializable() | ||
class PhasesState extends CacheModel { | ||
PhasesState(); | ||
|
||
factory PhasesState.fromJson(Map<String, dynamic> json) => | ||
_$PhasesStateFromJson(json); | ||
|
||
Map<String, dynamic> toJson() => _$PhasesStateToJson(this); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.