Browse Source

Sprint 2 Complete

JorgeIan 3 years ago
parent
commit
0f458bc1e0

+ 2
- 0
fast_med_flutter/lib/routes/model/event.dart View File

@@ -1,5 +1,7 @@
1 1
 import 'package:firebase_helpers/firebase_helpers.dart';
2 2
 
3
+//Variables para cada evento
4
+
3 5
 class EventModel extends DatabaseItem{
4 6
   final String id;
5 7
   final String title;

+ 8
- 73
fast_med_flutter/lib/ui/pages/add_event.dart View File

@@ -1,9 +1,9 @@
1 1
 import 'package:fast_med_flutter/model/event.dart';
2 2
 import 'package:flutter/material.dart';
3 3
 import 'package:fast_med_flutter/res/event_firestore_service.dart';
4
-import 'package:http/http.dart' as http;
5 4
 import 'dart:async';
6
-import 'dart:convert';
5
+
6
+//File donde definimos los eventos del area de citas
7 7
 
8 8
 class AddEventPage extends StatefulWidget {
9 9
   final EventModel note;
@@ -14,39 +14,32 @@ class AddEventPage extends StatefulWidget {
14 14
   _AddEventPageState createState() => _AddEventPageState();
15 15
 }
16 16
 
17
+//Definimos los controler de los eventos
18
+
17 19
 class _AddEventPageState extends State<AddEventPage> {
18 20
   TextStyle style = TextStyle(fontFamily: 'Montserrat', fontSize: 20.0);
19 21
   TextEditingController _title;
20 22
   TextEditingController _description;
21
-  TextEditingController _number;
22
-  TextEditingController _name;
23 23
   TextEditingController _reason;
24
-  TextEditingController _date;
25
-  TextEditingController _time;
26 24
 
27 25
   DateTime _eventDate;
28
-  DateTime _eventTime;
29 26
   DateTime selectedDate = DateTime.now();
30 27
   List data;
31 28
   final _formKey = GlobalKey<FormState>();
32 29
   final _key = GlobalKey<ScaffoldState>();
33 30
   bool processing;
34 31
 
32
+  //Controles donde escribimos el evento
35 33
   @override
36 34
   void initState() {
37 35
     super.initState();
38 36
     _title = TextEditingController(text: widget.note != null ? widget.note.title : "");
39 37
     _description = TextEditingController(text:  widget.note != null ? widget.note.description : "");
40
-    //_name = TextEditingController(text:  widget.note != null ? widget.note.name : "");
41
-    //_number = TextEditingController(text:  widget.note != null ? widget.note.number : "");
42
-   // _reason = TextEditingController(text:  widget.note != null ? widget.note.reason : "");
43
-    //_date = TextEditingController(text:  widget.note != null ?  widget.note.eventDate;
44 38
     _eventDate = DateTime.now();
45
-    //_eventTime = Time.now();
46 39
     processing = false;
47 40
   }
48 41
 
49
-
42
+//Construimos el UI para crear la cita
50 43
   @override
51 44
   Widget build(BuildContext context) {
52 45
     return Scaffold(
@@ -60,32 +53,8 @@ class _AddEventPageState extends State<AddEventPage> {
60 53
           alignment: Alignment.center,
61 54
           child: ListView(
62 55
             children: <Widget>[
63
-              Padding(
64
-                padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
65
-                child: TextFormField(
66
-                  controller: _name,
67
-                  validator: (value) =>
68
-                      (value.isEmpty) ? "Favor Anotar Nombre del Paciente" : null,
69
-                  style: style,
70
-                  decoration: InputDecoration(
71
-                      labelText: "Nombre completo del paciente",
72
-                      filled: true,
73
-                      fillColor: Colors.white,
74
-                      border: OutlineInputBorder(borderRadius: BorderRadius.circular(10))),
75
-                ),
76
-              ),
77
-              Padding(
78
-                padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
79
-                child: TextFormField(
80
-                  controller: _number,
81
-                  validator: (value) =>
82
-                  (value.isEmpty) ? "Favor Anotar Numero de Telefono" : null,
83
-                  style: style,
84
-                  decoration: InputDecoration(
85
-                      labelText: "Numero de Telefono",
86
-                      border: OutlineInputBorder(borderRadius: BorderRadius.circular(10))),
87
-                ),
88
-              ),
56
+
57
+              //Area Donde el Paciente Anotara Su Cita
89 58
               Padding(
90 59
                 padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
91 60
                 child: TextFormField(
@@ -114,22 +83,6 @@ class _AddEventPageState extends State<AddEventPage> {
114 83
                 },
115 84
               ),
116 85
 
117
-              ListTile(
118
-                title: Text("Time (HH: mm)"),
119
-                subtitle: Text("${_eventDate.hour} - ${_eventDate.minute} - ${_eventDate.second}"),
120
-                onTap: ()async{
121
-                 final selectedTime = await _selectTime(context);
122
-                 if (selectedTime == null) return;
123
-                  print(selectedTime);
124
-
125
-                setState(() {
126
-                this.selectedDate = DateTime(
127
-                selectedTime.hour,
128
-                selectedTime.minute,
129
-                );
130
-                    });
131
-                  }
132
-                  ),
133 86
               SizedBox(height: 10.0),
134 87
               processing
135 88
                   ? Center(child: CircularProgressIndicator())
@@ -150,10 +103,8 @@ class _AddEventPageState extends State<AddEventPage> {
150 103
 
151 104
 
152 105
                           "title": _title.text,
153
-                          "number": _number.text,
154 106
                           "reason": _reason.text,
155 107
                           "event_date": widget.note.eventDate,
156
-                          //"time": widget.note.DateTime,
157 108
                           });
158 109
                         }else{
159 110
                           await eventDBS.createItem(EventModel(
@@ -192,19 +143,3 @@ class _AddEventPageState extends State<AddEventPage> {
192 143
     super.dispose();
193 144
   }
194 145
 }
195
-
196
-Future<TimeOfDay> _selectTime(BuildContext context) {
197
-  final now = DateTime.now();
198
-
199
-  return showTimePicker(
200
-    context: context,
201
-    initialTime: TimeOfDay(hour: now.hour, minute: now.minute),
202
-  );
203
-}
204
-
205
-Future<DateTime> _selectDateTime(BuildContext context) => showDatePicker(
206
-  context: context,
207
-  initialDate: DateTime.now().add(Duration(seconds: 1)),
208
-  firstDate: DateTime.now(),
209
-  lastDate: DateTime(2100),
210
-);