Skip to content

Commit 394976a

Browse files
committed
Add explanation to phases section
1 parent 610ec88 commit 394976a

File tree

5 files changed

+110
-4
lines changed

5 files changed

+110
-4
lines changed

lib/src/models/phases/phases.dart

+8
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ class Phases extends Model {
1515
List<PhasesItem> phases;
1616
Map<String, PhasesCategory> categories;
1717
Map<String, PhasesMeasure> measures;
18+
@JsonKey(name: 'intro_explanation')
19+
String introExplanation;
20+
@JsonKey(name: 'button_explanation')
21+
String buttonExplanation;
22+
@JsonKey(name: 'title_explanation')
23+
String titleExplanation;
24+
@JsonKey(name: 'content_explanation')
25+
String contentExplanation;
1826

1927
Phases();
2028

lib/src/models/phases/phases.g.dart

+9-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/pages/phases_page.dart

+77-2
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ import "package:collection/collection.dart";
88
import 'package:covid19cuba/src/blocs/blocs.dart';
99
import 'package:covid19cuba/src/models/phases/phases.dart';
1010
import 'package:covid19cuba/src/models/phases/phases_item.dart';
11-
import 'package:covid19cuba/src/models/phases/phases_measure.dart';
1211
import 'package:covid19cuba/src/models/phases/phases_state.dart';
1312
import 'package:covid19cuba/src/pages/pages.dart';
1413
import 'package:covid19cuba/src/utils/utils.dart';
1514
import 'package:flutter/material.dart';
1615
import 'package:flutter_bloc/flutter_bloc.dart';
16+
import 'package:flutter_markdown/flutter_markdown.dart';
1717
import 'package:getflutter/getflutter.dart';
1818
import 'package:separated_column/separated_column.dart';
1919
import 'package:url_launcher/url_launcher.dart';
@@ -63,7 +63,82 @@ class PhasesWidgetState extends State<PhasesWidget> {
6363
return ListView(
6464
children: <Widget>[
6565
Container(
66-
margin: EdgeInsets.fromLTRB(10, 10, 10, 2.5),
66+
margin: EdgeInsets.only(left: 10, right: 10, top: 5),
67+
child: Card(
68+
color: Constants.primaryColor,
69+
child: Container(
70+
margin: EdgeInsets.all(20),
71+
child: Column(
72+
crossAxisAlignment: CrossAxisAlignment.end,
73+
children: <Widget>[
74+
Text(
75+
phases.introExplanation,
76+
style: TextStyle(
77+
color: Colors.white,
78+
fontWeight: FontWeight.bold,
79+
),
80+
),
81+
InkWell(
82+
onTap: () {
83+
showDialog(
84+
context: context,
85+
builder: (BuildContext context) {
86+
return AlertDialog(
87+
scrollable: true,
88+
actionsPadding: EdgeInsets.all(0),
89+
title: Text(phases.titleExplanation),
90+
content: Container(
91+
margin: EdgeInsets.only(
92+
top: 10,
93+
bottom: 10,
94+
),
95+
child: MarkdownBody(
96+
data: phases.contentExplanation,
97+
),
98+
),
99+
actions: <Widget>[
100+
FlatButton(
101+
child: Text(
102+
'Cerrar',
103+
style: TextStyle(
104+
color: Constants.primaryColor,
105+
),
106+
),
107+
onPressed: () {
108+
Navigator.pop(context);
109+
},
110+
),
111+
],
112+
);
113+
},
114+
);
115+
},
116+
child: Container(
117+
margin: EdgeInsets.only(top: 10),
118+
padding: EdgeInsets.symmetric(
119+
horizontal: 20,
120+
vertical: 10,
121+
),
122+
decoration: BoxDecoration(
123+
borderRadius: BorderRadius.circular(8),
124+
color: Colors.red,
125+
),
126+
child: Text(
127+
phases.buttonExplanation,
128+
style: TextStyle(
129+
color: Colors.white,
130+
fontWeight: FontWeight.w800,
131+
),
132+
),
133+
),
134+
)
135+
],
136+
),
137+
),
138+
),
139+
),
140+
Container(
141+
margin: EdgeInsets.fromLTRB(10, 2.5, 10, 2.5),
67142
child: Card(
68143
color: Colors.grey[50],
69144
child: Container(

pubspec.lock

+15-1
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,13 @@ packages:
312312
description: flutter
313313
source: sdk
314314
version: "0.0.0"
315+
flutter_markdown:
316+
dependency: "direct main"
317+
description:
318+
name: flutter_markdown
319+
url: "https://pub.dartlang.org"
320+
source: hosted
321+
version: "0.4.2"
315322
flutter_native_splash:
316323
dependency: "direct dev"
317324
description:
@@ -478,6 +485,13 @@ packages:
478485
url: "https://pub.dartlang.org"
479486
source: hosted
480487
version: "0.11.4"
488+
markdown:
489+
dependency: transitive
490+
description:
491+
name: markdown
492+
url: "https://pub.dartlang.org"
493+
source: hosted
494+
version: "2.1.5"
481495
matcher:
482496
dependency: transitive
483497
description:
@@ -912,4 +926,4 @@ packages:
912926
version: "2.2.1"
913927
sdks:
914928
dart: ">=2.7.0 <3.0.0"
915-
flutter: ">=1.16.0 <2.0.0"
929+
flutter: ">=1.17.0 <2.0.0"

pubspec.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ dependencies:
5555
fluttercontactpicker: ^2.4.2
5656
collection: ^1.14.12
5757
separated_column: ^1.0.1+2
58+
flutter_markdown: ^0.4.2
5859

5960
dev_dependencies:
6061
flutter_native_splash: ^0.1.9

0 commit comments

Comments
 (0)