diff --git a/assets/images/medical_services.png b/assets/images/medical_services.png new file mode 100644 index 0000000..8131f00 Binary files /dev/null and b/assets/images/medical_services.png differ diff --git a/assets/images/stair.png b/assets/images/stair.png new file mode 100644 index 0000000..64e8418 Binary files /dev/null and b/assets/images/stair.png differ diff --git a/lib/src/blocs/general_bloc.dart b/lib/src/blocs/general_bloc.dart index b9d9fb6..855b2e3 100644 --- a/lib/src/blocs/general_bloc.dart +++ b/lib/src/blocs/general_bloc.dart @@ -23,6 +23,8 @@ import 'package:covid19cuba/src/models/faqs/faqs_state.dart'; import 'package:covid19cuba/src/models/model.dart'; import 'package:covid19cuba/src/models/news/news.dart'; import 'package:covid19cuba/src/models/news/news_state.dart'; +import 'package:covid19cuba/src/models/phases/phases.dart'; +import 'package:covid19cuba/src/models/phases/phases_state.dart'; import 'package:covid19cuba/src/models/protocols/protocols.dart'; import 'package:covid19cuba/src/models/protocols/protocols_state.dart'; import 'package:covid19cuba/src/models/tips/tips.dart'; @@ -77,6 +79,12 @@ class GeneralBloc ); } + static GeneralBloc getPhasesBloc() { + return GeneralBloc( + provider: PhasesProvider(), + ); + } + static GeneralBloc getProtocolsBloc() { return GeneralBloc( provider: ProtocolsProvider(), diff --git a/lib/src/data_providers/data_providers.dart b/lib/src/data_providers/data_providers.dart index 122895b..e386259 100644 --- a/lib/src/data_providers/data_providers.dart +++ b/lib/src/data_providers/data_providers.dart @@ -9,5 +9,6 @@ export 'state_provider.dart'; export 'about_us_provider.dart'; export 'faqs_provider.dart'; export 'bulletins_provider.dart'; +export 'phases_provider.dart'; export 'data_provider.dart'; export 'tips_provider.dart'; diff --git a/lib/src/data_providers/phases_provider.dart b/lib/src/data_providers/phases_provider.dart new file mode 100644 index 0000000..922fc4f --- /dev/null +++ b/lib/src/data_providers/phases_provider.dart @@ -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 { + @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 data) => + Phases.fromJson(data); + + @override + PhasesState dataStateFromJson(Map data) => + PhasesState.fromJson(data); +} diff --git a/lib/src/models/phases/phases.dart b/lib/src/models/phases/phases.dart new file mode 100644 index 0000000..f9c4ed6 --- /dev/null +++ b/lib/src/models/phases/phases.dart @@ -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 phases; + Map categories; + Map measures; + + Phases(); + + factory Phases.fromJson(Map json) => _$PhasesFromJson(json); + + Map toJson() => _$PhasesToJson(this); +} diff --git a/lib/src/models/phases/phases.g.dart b/lib/src/models/phases/phases.g.dart new file mode 100644 index 0000000..c69d329 --- /dev/null +++ b/lib/src/models/phases/phases.g.dart @@ -0,0 +1,32 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'phases.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Phases _$PhasesFromJson(Map json) { + return Phases() + ..phases = (json['phases'] as List) + ?.map((e) => + e == null ? null : PhasesItem.fromJson(e as Map)) + ?.toList() + ..categories = (json['categories'] as Map)?.map( + (k, e) => MapEntry( + k, + e == null + ? null + : PhasesCategory.fromJson(e as Map)), + ) + ..measures = (json['measures'] as Map)?.map( + (k, e) => MapEntry(k, + e == null ? null : PhasesMeasure.fromJson(e as Map)), + ); +} + +Map _$PhasesToJson(Phases instance) => { + 'phases': instance.phases, + 'categories': instance.categories, + 'measures': instance.measures, + }; diff --git a/lib/src/models/phases/phases_category.dart b/lib/src/models/phases/phases_category.dart new file mode 100644 index 0000000..4669e85 --- /dev/null +++ b/lib/src/models/phases/phases_category.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'; + +part 'phases_category.g.dart'; + +@JsonSerializable() +class PhasesCategory { + String name; + @JsonKey(required: false) + String parent; + + PhasesCategory(); + + factory PhasesCategory.fromJson(Map json) => + _$PhasesCategoryFromJson(json); + + Map toJson() => _$PhasesCategoryToJson(this); +} diff --git a/lib/src/models/phases/phases_category.g.dart b/lib/src/models/phases/phases_category.g.dart new file mode 100644 index 0000000..1674abd --- /dev/null +++ b/lib/src/models/phases/phases_category.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'phases_category.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PhasesCategory _$PhasesCategoryFromJson(Map json) { + return PhasesCategory() + ..name = json['name'] as String + ..parent = json['parent'] as String; +} + +Map _$PhasesCategoryToJson(PhasesCategory instance) => + { + 'name': instance.name, + 'parent': instance.parent, + }; diff --git a/lib/src/models/phases/phases_item.dart b/lib/src/models/phases/phases_item.dart new file mode 100644 index 0000000..71701a9 --- /dev/null +++ b/lib/src/models/phases/phases_item.dart @@ -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 provinces; + List measures; + + PhasesItem(); + + factory PhasesItem.fromJson(Map json) => + _$PhasesItemFromJson(json); + + Map toJson() => _$PhasesItemToJson(this); +} diff --git a/lib/src/models/phases/phases_item.g.dart b/lib/src/models/phases/phases_item.g.dart new file mode 100644 index 0000000..dbd5352 --- /dev/null +++ b/lib/src/models/phases/phases_item.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'phases_item.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PhasesItem _$PhasesItemFromJson(Map json) { + return PhasesItem() + ..order = json['order'] as int + ..name = json['name'] as String + ..provinces = (json['provinces'] as List)?.map((e) => e as String)?.toList() + ..measures = (json['measures'] as List)?.map((e) => e as String)?.toList(); +} + +Map _$PhasesItemToJson(PhasesItem instance) => + { + 'order': instance.order, + 'name': instance.name, + 'provinces': instance.provinces, + 'measures': instance.measures, + }; diff --git a/lib/src/models/phases/phases_measure.dart b/lib/src/models/phases/phases_measure.dart new file mode 100644 index 0000000..7d6d16f --- /dev/null +++ b/lib/src/models/phases/phases_measure.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'; + +part 'phases_measure.g.dart'; + +@JsonSerializable() +class PhasesMeasure { + String text; + String category; + List phases; + + PhasesMeasure(); + + factory PhasesMeasure.fromJson(Map json) => + _$PhasesMeasureFromJson(json); + + Map toJson() => _$PhasesMeasureToJson(this); +} diff --git a/lib/src/models/phases/phases_measure.g.dart b/lib/src/models/phases/phases_measure.g.dart new file mode 100644 index 0000000..65f3450 --- /dev/null +++ b/lib/src/models/phases/phases_measure.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'phases_measure.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PhasesMeasure _$PhasesMeasureFromJson(Map json) { + return PhasesMeasure() + ..text = json['text'] as String + ..category = json['category'] as String + ..phases = (json['phases'] as List)?.map((e) => e as int)?.toList(); +} + +Map _$PhasesMeasureToJson(PhasesMeasure instance) => + { + 'text': instance.text, + 'category': instance.category, + 'phases': instance.phases, + }; diff --git a/lib/src/models/phases/phases_state.dart b/lib/src/models/phases/phases_state.dart new file mode 100644 index 0000000..e1a2245 --- /dev/null +++ b/lib/src/models/phases/phases_state.dart @@ -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 json) => + _$PhasesStateFromJson(json); + + Map toJson() => _$PhasesStateToJson(this); +} diff --git a/lib/src/models/phases/phases_state.g.dart b/lib/src/models/phases/phases_state.g.dart new file mode 100644 index 0000000..614f2f8 --- /dev/null +++ b/lib/src/models/phases/phases_state.g.dart @@ -0,0 +1,16 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'phases_state.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PhasesState _$PhasesStateFromJson(Map json) { + return PhasesState()..cache = json['cache'] as String; +} + +Map _$PhasesStateToJson(PhasesState instance) => + { + 'cache': instance.cache, + }; diff --git a/lib/src/pages/notifications_settings.dart b/lib/src/pages/notifications_settings.dart index d3429b2..b74b286 100644 --- a/lib/src/pages/notifications_settings.dart +++ b/lib/src/pages/notifications_settings.dart @@ -113,7 +113,6 @@ class NotificationSettingsState extends State { } void showDialog({@required BuildContext context, bool start = true}) { - DateTime now = DateTime.now(); showTimePicker( context: context, initialTime: diff --git a/lib/src/pages/pages.dart b/lib/src/pages/pages.dart index b1e1513..adac02e 100644 --- a/lib/src/pages/pages.dart +++ b/lib/src/pages/pages.dart @@ -19,6 +19,7 @@ export 'news_page_more.dart'; export 'municipality_item_page.dart'; export 'municipality_list_page.dart'; export 'on_boarding_page.dart'; +export 'phases_page.dart'; export 'phone_details_page.dart'; export 'province_item_page.dart'; export 'province_list_page.dart'; diff --git a/lib/src/pages/phases_page.dart b/lib/src/pages/phases_page.dart new file mode 100644 index 0000000..5d7cbfc --- /dev/null +++ b/lib/src/pages/phases_page.dart @@ -0,0 +1,274 @@ +// 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:collection/collection.dart"; +import 'package:covid19cuba/src/blocs/blocs.dart'; +import 'package:covid19cuba/src/models/phases/phases.dart'; +import 'package:covid19cuba/src/models/phases/phases_item.dart'; +import 'package:covid19cuba/src/models/phases/phases_measure.dart'; +import 'package:covid19cuba/src/models/phases/phases_state.dart'; +import 'package:covid19cuba/src/pages/pages.dart'; +import 'package:covid19cuba/src/utils/utils.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:getflutter/getflutter.dart'; +import 'package:separated_column/separated_column.dart'; +import 'package:url_launcher/url_launcher.dart'; + +class PhasesPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return BlocProvider( + create: (context) => GeneralBloc.getPhasesBloc(), + child: PhasesPageWidget(), + ); + } +} + +class PhasesPageWidget extends PageWidget { + PhasesPageWidget() : super(getWidgetLoaded, title: 'Fases de Desescalada'); + + static Widget getWidgetLoaded( + BuildContext context, + LoadedGeneralState state, + ) { + return PhasesWidget(phases: state.data); + } +} + +class PhasesWidget extends StatefulWidget { + final Phases phases; + + const PhasesWidget({Key key, this.phases}) : super(key: key); + + @override + PhasesWidgetState createState() => PhasesWidgetState(phases); +} + +class PhasesWidgetState extends State { + final Phases phases; + var index = 0; + + PhasesWidgetState(this.phases); + + PhasesItem get phase => phases.phases[index]; + + @override + Widget build(BuildContext context) { + return ListView( + children: [ + Container( + margin: EdgeInsets.fromLTRB(10, 10, 10, 2.5), + child: Card( + color: Colors.grey[50], + child: Container( + margin: EdgeInsets.symmetric(horizontal: 10, vertical: 5), + child: Center( + child: Container( + margin: EdgeInsets.symmetric(horizontal: 10, vertical: 5), + child: Text( + 'Fase en la que se encuentran las provincias', + textAlign: TextAlign.center, + style: TextStyle( + color: Constants.primaryColor, + fontSize: 16, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + ), + ), + ), + Column( + children: + phases.phases.where((x) => x.provinces.length > 0).map((item) { + return Container( + margin: EdgeInsets.symmetric(horizontal: 10, vertical: 2.5), + width: MediaQuery.of(context).size.width, + child: Card( + color: Colors.grey[50], + child: Container( + margin: EdgeInsets.all(5), + child: Wrap( + alignment: WrapAlignment.start, + crossAxisAlignment: WrapCrossAlignment.center, + children: [ + Card( + elevation: 0, + child: Container( + margin: EdgeInsets.all(7), + child: Text( + item.name, + style: TextStyle( + color: Colors.white, + fontSize: 16, + fontWeight: FontWeight.bold, + ), + ), + ), + color: getColor(item), + ) + ] + + item.provinces.map((e) { + return Card( + elevation: 0, + child: Container( + margin: EdgeInsets.all(5), + child: Text( + e, + style: TextStyle( + color: Colors.white, + fontSize: 14, + ), + ), + ), + color: Colors.grey, + ); + }).toList()), + ), + ), + ); + }).toList(), + ), + Container( + margin: EdgeInsets.fromLTRB(10, 20, 10, 2.5), + child: Card( + color: Colors.grey[50], + child: Column(children: [ + Center( + child: Container( + margin: EdgeInsets.all(5), + child: Text( + 'Seleccione la fase', + style: TextStyle( + color: Constants.primaryColor, + fontSize: 16, + ), + ), + ), + ), + Slider.adaptive( + value: index + 1.0, + onChanged: (value) { + setState(() { + index = value.toInt() - 1; + }); + }, + activeColor: Constants.primaryColor, + min: 1, + max: phases.phases.length.toDouble(), + divisions: phases.phases.length - 1, + label: phase.name, + ) + ]), + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 10, vertical: 2.5), + child: Card( + color: Colors.grey[50], + child: Container( + margin: EdgeInsets.symmetric(horizontal: 10, vertical: 5), + child: Center( + child: Container( + margin: EdgeInsets.symmetric(horizontal: 10, vertical: 5), + child: Text( + 'Medidas de la ${phase.name} separadas por categoría', + textAlign: TextAlign.center, + style: TextStyle( + color: Constants.primaryColor, + fontSize: 16, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + ), + ), + ), + Column( + children: groupBy( + phase.measures.map((String id) => phases.measures[id]), + (x) => x.category).entries.map((item) { + return Container( + margin: EdgeInsets.symmetric(horizontal: 10, vertical: 5), + child: Card( + child: GFAccordion( + collapsedTitlebackgroundColor: Colors.white, + expandedTitlebackgroundColor: Colors.white, + contentbackgroundColor: Colors.white, + textStyle: TextStyle( + color: Constants.primaryColor, + fontSize: 14, + fontWeight: FontWeight.w600, + ), + collapsedIcon: Icon( + Icons.keyboard_arrow_down, + color: Constants.primaryColor, + ), + expandedIcon: Icon( + Icons.keyboard_arrow_up, + color: Constants.primaryColor, + ), + title: phases.categories[item.key].name, + contentChild: SeparatedColumn( + children: item.value.map((value) { + return Tooltip( + child: Container( + margin: EdgeInsets.symmetric(vertical: 10), + child: Text(value.text), + ), + message: 'Fases: ' + + value.phases.toString().substring( + 1, value.phases.toString().length - 1), + ); + }).toList(), + separatorBuilder: (_, __) { + return Divider( + color: Constants.primaryColor, + ); + }, + ), + ), + ), + ); + }).toList(), + ), + GestureDetector( + child: Container( + margin: EdgeInsets.all(20), + child: Center( + child: Text('Fuente: Cubadebate'), + ), + ), + onTap: () async { + final url = + 'http://www.cubadebate.cu/noticias/2020/06/22/medidas-a-implementar-en-las-tres-fases-de-la-primera-etapa-de-recuperacion-pos-covid-19-pdf'; + if (await canLaunch(url)) { + await launch(url); + } else { + log('Could not launch $url'); + } + }, + ), + ], + ); + } + + static Color getColor(PhasesItem item) { + switch (item.order) { + case 1: + return Colors.red; + case 2: + return Colors.orange; + case 3: + return Colors.amberAccent; + default: + return Colors.white; + } + } +} diff --git a/lib/src/pages/protocols_page.dart b/lib/src/pages/protocols_page.dart index 085da9c..284a9b0 100644 --- a/lib/src/pages/protocols_page.dart +++ b/lib/src/pages/protocols_page.dart @@ -147,7 +147,10 @@ class ProtocolsWidgetState extends State { margin: EdgeInsets.symmetric(horizontal: 10, vertical: 5), child: Text( 'Protocolo Versión ${protocol.version}', - style: TextStyle(color: Constants.primaryColor, fontSize: 20), + style: TextStyle( + color: Constants.primaryColor, + fontSize: 20, + ), ), ), ), diff --git a/lib/src/utils/call_to_action.dart b/lib/src/utils/call_to_action.dart index 7394f3e..bf9be04 100644 --- a/lib/src/utils/call_to_action.dart +++ b/lib/src/utils/call_to_action.dart @@ -5,6 +5,7 @@ import 'dart:math'; import 'package:covid19cuba/src/pages/pages.dart'; +import 'package:covid19cuba/src/pages/protocols_page.dart'; import 'package:covid19cuba/src/utils/utils.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -156,6 +157,205 @@ Widget getWidget(BuildContext context) { ), ), ), + Container( + margin: EdgeInsets.only(left: 5, right: 5, top: 5), + child: Card( + color: Constants.primaryColor, + child: Container( + margin: EdgeInsets.all(20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + 'Infórmese sobre los protocolos de actuación que contribuyen ' + 'a la prevención, control y manejo de los casos relacionados ' + 'con la enfermedad.', + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + InkWell( + onTap: () { + Navigator.of(context).push( + MaterialPageRoute( + builder: (context) => ProtocolsPage(), + ), + ); + }, + child: Container( + margin: EdgeInsets.only(top: 10), + padding: EdgeInsets.symmetric( + horizontal: 20, + vertical: 10, + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + color: Colors.red, + ), + child: Text( + 'Ver protocolos', + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.w800, + ), + ), + ), + ) + ], + ), + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5, right: 5, top: 5), + child: Card( + color: Constants.primaryColor, + child: Container( + margin: EdgeInsets.all(20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + 'Acceda a los boletines especiales enfocados en la ' + 'Covid-19 del Centro de Estudios Demográficos (CEDEM) de la ' + 'Universidad de La Habana.', + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + InkWell( + onTap: () { + Navigator.of(context).push( + MaterialPageRoute( + builder: (context) => BulletinsPage(), + ), + ); + }, + child: Container( + margin: EdgeInsets.only(top: 10), + padding: EdgeInsets.symmetric( + horizontal: 20, + vertical: 10, + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + color: Colors.red, + ), + child: Text( + 'Acceder a los boletines', + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.w800, + ), + ), + ), + ) + ], + ), + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5, right: 5, top: 5), + child: Card( + color: Constants.primaryColor, + child: Container( + margin: EdgeInsets.all(20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + 'Puede descargar la información utilizada en la aplicación ' + 'desde la sección de Descargas.', + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + InkWell( + onTap: () { + Navigator.of(context).push( + MaterialPageRoute( + builder: (context) => DownloadsPage(), + ), + ); + }, + child: Container( + margin: EdgeInsets.only(top: 10), + padding: EdgeInsets.symmetric( + horizontal: 20, + vertical: 10, + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + color: Colors.red, + ), + child: Text( + 'Ir a Descargas', + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.w800, + ), + ), + ), + ) + ], + ), + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5, right: 5, top: 5), + child: Card( + color: Constants.primaryColor, + child: Container( + margin: EdgeInsets.all(20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + 'Verifique las medidas a implementar en la etapa de ' + 'recuperación post Covid-19 y cuál es la fase en la ' + 'que se encuentran las provincias.', + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + InkWell( + onTap: () { + Navigator.of(context).push( + MaterialPageRoute( + builder: (context) => BulletinsPage(), + ), + ); + }, + child: Container( + margin: EdgeInsets.only(top: 10), + padding: EdgeInsets.symmetric( + horizontal: 20, + vertical: 10, + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + color: Colors.red, + ), + child: Text( + 'Ver información sobre las medidas', + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.w800, + ), + ), + ), + ) + ], + ), + ), + ), + ), ]; var random = Random(); var pos = random.nextInt(widgets.length); diff --git a/lib/src/utils/constants.dart b/lib/src/utils/constants.dart index 06257dc..aea28e5 100644 --- a/lib/src/utils/constants.dart +++ b/lib/src/utils/constants.dart @@ -129,6 +129,8 @@ class Constants { static const String prefTipsState = 'prefTipsState'; static const String prefFaqs = 'prefFaqs'; static const String prefFaqsState = 'prefFaqsState'; + static const String prefPhases = 'prefPhases'; + static const String prefPhasesState = 'prefPhasesState'; static const String prefProtocols = 'prefProtocols'; static const String prefProtocolsState = 'prefProtocolsState'; diff --git a/lib/src/widgets/home_drawer_widget.dart b/lib/src/widgets/home_drawer_widget.dart index beccc87..f8237f5 100644 --- a/lib/src/widgets/home_drawer_widget.dart +++ b/lib/src/widgets/home_drawer_widget.dart @@ -50,6 +50,7 @@ class HomeDrawerWidgetState extends State { bulletinsDrawerItem(), downloadsDrawerItem(), protocolsDrawerItem(), + contactPhasesItem(), contactRegistrationItem(), usefulPhonesItem(), tipsItem(), @@ -87,6 +88,7 @@ class HomeDrawerWidgetState extends State { Widget createDrawerItem( BuildContext context, { IconData icon, + String iconPath, String text, GestureTapCallback onTap, Widget extra, @@ -94,10 +96,18 @@ class HomeDrawerWidgetState extends State { return ListTile( title: Row( children: [ - Icon( - icon, - color: Colors.white, - ), + if (icon != null) + Icon( + icon, + color: Colors.white, + ), + if (iconPath != null) + Image.asset( + iconPath, + width: 24, + height: 24, + fit: BoxFit.fill, + ), Expanded( child: Padding( padding: EdgeInsets.only(left: 15), @@ -344,6 +354,23 @@ class HomeDrawerWidgetState extends State { ); } + Widget contactPhasesItem() { + return createDrawerItem( + context, + iconPath: 'assets/images/stair.png', + text: 'Fases de Desescalada', + onTap: () { + Navigator.of(context).pop(); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PhasesPage(), + ), + ); + }, + ); + } + Widget usefulPhonesItem() { return createDrawerItem( context, @@ -432,7 +459,7 @@ class HomeDrawerWidgetState extends State { Widget protocolsDrawerItem() { return createDrawerItem( context, - icon: Icons.straighten, + iconPath: 'assets/images/medical_services.png', text: 'Protocolos', onTap: () { Navigator.of(context).pop(); diff --git a/pubspec.lock b/pubspec.lock index 1157ead..b190b8d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -156,7 +156,7 @@ packages: source: hosted version: "3.3.0" collection: - dependency: transitive + dependency: "direct main" description: name: collection url: "https://pub.dartlang.org" @@ -688,6 +688,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.3" + separated_column: + dependency: "direct main" + description: + name: separated_column + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1+2" share: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 031b75a..4b9cd37 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -53,6 +53,8 @@ dependencies: webview_flutter: path: ./webview_flutter fluttercontactpicker: ^2.4.2 + collection: ^1.14.12 + separated_column: ^1.0.1+2 dev_dependencies: flutter_native_splash: ^0.1.9