JorgeIan 3 years ago
parent
commit
58fef12b8a

+ 0
- 6
fast_med_flutter/lib/res/event_firestore_service.dart View File

@@ -1,6 +0,0 @@
1
-import 'package:firebase_helpers/firebase_helpers.dart';
2
-import '../model/event.dart';
3
-
4
-DatabaseService<EventModel> eventDBS = DatabaseService<EventModel>
5
-  ("events",fromDS: (id,data) => EventModel.fromDS(id, data), toMap:
6
-    (event) => event.toMap());

+ 309
- 128
fast_med_flutter/lib/routes/calendario.dart View File

@@ -1,31 +1,23 @@
1 1
 import 'package:flutter/material.dart';
2
-import 'package:fast_med_flutter/ui/pages/add_event.dart';
3
-import 'package:fast_med_flutter/ui/pages/view_event.dart';
2
+import 'package:intl/date_symbol_data_local.dart';
4 3
 import 'package:table_calendar/table_calendar.dart';
5
-import 'dart:convert';
6
-import 'package:shared_preferences/shared_preferences.dart';
7
-//import 'package:firebase_core/firebase_core.dart';
8
-import 'dart:async';
9
-import 'package:http/http.dart' as http;
10
-
11
-import 'model/event.dart';
12
-
13
-void main() async{
14
-
15
-  var url = 'https://ada.uprrp.edu/~jorge.lopez19/FastMed/API/InsertEvent.php';
16
-  WidgetsFlutterBinding.ensureInitialized();
17
-  //==final data = await http.post(url, body: {
18
-    //"name": name.text,
19
-    //"reason": reason.text,
20
-    //"date": date.text,
21
-    //"time": time.text,
22
- // }
23
-  //);
24
-  runApp(Calendario());
25
-}
26 4
 
5
+// Dias de Citas No Disponibles
6
+final Map<DateTime, List> _holidays = {
7
+  DateTime(2020, 11, 6): ['No Hay Citas'],
8
+  DateTime(2020, 11, 3): ['Dia Elecciones'],
9
+  DateTime(2020,12,25): ['Chrismas'],
10
+  DateTime(2020,12,31): ['Despedida del anyo nuevo'],
11
+
12
+};
13
+
14
+//Iniciar la Seccion de las Citas
15
+void main() {
16
+  initializeDateFormatting().then((_) => runApp(Calendario()));
17
+}
27 18
 
28 19
 
20
+//Inicio del Area de las Citas Disponibles
29 21
 class Calendario extends StatelessWidget {
30 22
   @override
31 23
   Widget build(BuildContext context) {
@@ -34,142 +26,331 @@ class Calendario extends StatelessWidget {
34 26
       theme: ThemeData(
35 27
         primarySwatch: Colors.blue,
36 28
       ),
37
-      home: MyHomePage(),
38
-      routes: {
39
-        "add_event": (_) => AddEventPage(),
40
-      },
29
+      home: MyHomePage(title: 'Citas Disponibles'),
41 30
     );
42 31
   }
43 32
 }
44 33
 
34
+class MyHomePage extends StatefulWidget {
35
+  MyHomePage({Key key, this.title}) : super(key: key);
45 36
 
37
+  final String title;
46 38
 
47
-class MyHomePage extends StatefulWidget {
48 39
   @override
49 40
   _MyHomePageState createState() => _MyHomePageState();
50 41
 }
51 42
 
52
-class _MyHomePageState extends State<MyHomePage> {
53
-  CalendarController _controller;
54
-  Map<DateTime, List<dynamic>> _events;
55
-  List<dynamic> _selectedEvents;
43
+//Definimos los controladores del Calendario
44
+class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
45
+  Map<DateTime, List> _events;
46
+  List _selectedEvents;
47
+  AnimationController _animationController;
48
+  CalendarController _calendarController;
49
+  Map<DateTime,List<dynamic>> _events2;
56 50
 
51
+//Definimos el dia elegido
57 52
   @override
58 53
   void initState() {
59 54
     super.initState();
60
-    _controller = CalendarController();
61
-    _events = {};
62
-    _selectedEvents = [];
55
+    final _selectedDay = DateTime.now();
56
+
57
+    _events = {
58
+    //Ejemplos de Citas Previamente Hechas de Prueba Para los Recordatorios
59
+      _selectedDay.add(Duration(days: 3)): Set.from([ 'Cita Cardiologo', 'Cita Dentista']).toList(),
60
+      _selectedDay.add(Duration(days: 22)): ['Cita Cardiologo', 'Cita Dentista'],
61
+
62
+    };
63
+    //Dias de Citas Seleccionados como Recordatorio
64
+    _selectedEvents = _events[_selectedDay] ?? [];
65
+    _calendarController = CalendarController();
66
+    _events2 = {};
67
+
68
+    _animationController = AnimationController(
69
+      vsync: this,
70
+      duration: const Duration(milliseconds: 400),
71
+    );
72
+
73
+    _animationController.forward();
74
+  }
75
+
76
+  Map<String,dynamic> encodeMap(Map<DateTime,dynamic> map) {
77
+    Map<String,dynamic> newMap = {};
78
+    map.forEach((key,value) {
79
+      newMap[key.toString()] = map[key];
80
+    });
81
+    return newMap;
63 82
   }
64 83
 
65
-  Map<DateTime, List<dynamic>> _groupEvents(List<EventModel> events) {
66
-    Map<DateTime,List<dynamic>> data = {};
67
-    events.forEach((event) {
68
-      DateTime date = DateTime(event.eventDate.year, event.eventDate.month,
69
-          event.eventDate.day, 12);
70
-      if(data[date] == null) data[date] = [];
71
-      data[date].add(event);
84
+  Map<DateTime,dynamic> decodeMap(Map<String,dynamic> map) {
85
+    Map<DateTime,dynamic> newMap = {};
86
+    map.forEach((key,value) {
87
+      newMap[DateTime.parse(key)] = map[key];
72 88
     });
73
-    return data;
89
+    return newMap;
74 90
   }
75 91
 
76 92
 
77 93
 
78 94
   @override
95
+  void dispose() {
96
+    _animationController.dispose();
97
+    _calendarController.dispose();
98
+    super.dispose();
99
+  }
100
+//Acciones definidas cuando se elige un dia en particular para ver si esta disponible o no
101
+  void _onDaySelected(DateTime day, List events, List holidays) {
102
+    print('CALLBACK: _onDaySelected');
103
+    setState(() {
104
+      _selectedEvents = events;
105
+    });
106
+  }
107
+
108
+  void _onVisibleDaysChanged(DateTime first, DateTime last, CalendarFormat format) {
109
+    print('CALLBACK: _onVisibleDaysChanged');
110
+  }
111
+
112
+  void _onCalendarCreated(DateTime first, DateTime last, CalendarFormat format) {
113
+    print('CALLBACK: _onCalendarCreated');
114
+  }
115
+//Definimos el "look" del area de las citas
116
+  @override
79 117
   Widget build(BuildContext context) {
80 118
     return Scaffold(
81 119
       appBar: AppBar(
82
-        title: Text('Citas Disponibles'),
120
+        title: Text(widget.title),
121
+      ),
122
+      body: Column(
123
+        mainAxisSize: MainAxisSize.max,
124
+        children: <Widget>[
125
+
126
+          _buildTableCalendar(
127
+
128
+          ),
129
+          // _buildTableCalendarWithBuilders(),
130
+          const SizedBox(height: 8.0),
131
+          _buildButtons(),
132
+          const SizedBox(height: 8.0),
133
+          Expanded(child: _buildEventList()),
134
+        ],
135
+      ),
136
+    );
137
+  }
138
+
139
+  // Simple configuracion de la Tabla de Calendario usando estilos
140
+  Widget _buildTableCalendar() {
141
+    return TableCalendar(
142
+      calendarController: _calendarController,
143
+      events: _events,
144
+      holidays: _holidays,
145
+      startingDayOfWeek: StartingDayOfWeek.monday,
146
+      calendarStyle: CalendarStyle(
147
+        selectedColor: Colors.lightBlueAccent,
148
+        todayColor: Colors.blueAccent,
149
+        markersColor: Colors.brown,
150
+        outsideDaysVisible: false,
83 151
       ),
84
-      body: StreamBuilder<List<EventModel>>(
85
-        // stream: eventDBS.streamList(),
86
-          builder: (context, snapshot) {
87
-            if (snapshot.hasData) {
88
-              List<EventModel> allEvents = snapshot.data;
89
-              if (allEvents.isNotEmpty) {
90
-                _events = _groupEvents(allEvents);
91
-              }
92
-            }
93
-
94
-            return SingleChildScrollView(
95
-              child: Column(
96
-                crossAxisAlignment: CrossAxisAlignment.start,
97
-                children: <Widget>[
98
-                  TableCalendar(
99
-                    events: _events,
100
-                    initialCalendarFormat: CalendarFormat.month,
101
-                    calendarStyle: CalendarStyle(
102
-                        canEventMarkersOverflow: true,
103
-                        todayColor: Colors.orange,
104
-                        selectedColor: Theme
105
-                            .of(context)
106
-                            .primaryColor,
107
-                        todayStyle: TextStyle(
108
-                            fontWeight: FontWeight.bold,
109
-                            fontSize: 18.0,
110
-                            color: Colors.white)),
111
-                    headerStyle: HeaderStyle(
112
-                      centerHeaderTitle: true,
113
-                      formatButtonDecoration: BoxDecoration(
114
-                        color: Colors.orange,
115
-                        borderRadius: BorderRadius.circular(20.0),
116
-                      ),
117
-                      formatButtonTextStyle: TextStyle(color: Colors.white),
118
-                      formatButtonShowsNext: false,
119
-                    ),
120
-                    startingDayOfWeek: StartingDayOfWeek.monday,
121
-
122
-                    builders: CalendarBuilders(
123
-                      selectedDayBuilder: (context, date, events) =>
124
-                          Container(
125
-                              margin: const EdgeInsets.all(4.0),
126
-                              alignment: Alignment.center,
127
-                              decoration: BoxDecoration(
128
-                                  color: Theme
129
-                                      .of(context)
130
-                                      .primaryColor,
131
-                                  borderRadius: BorderRadius.circular(10.0)),
132
-                              child: Text(
133
-                                date.day.toString(),
134
-                                style: TextStyle(color: Colors.white),
135
-                              )),
136
-                      todayDayBuilder: (context, date, events) =>
137
-                          Container(
138
-                              margin: const EdgeInsets.all(4.0),
139
-                              alignment: Alignment.center,
140
-                              decoration: BoxDecoration(
141
-                                  color: Colors.orange,
142
-                                  borderRadius: BorderRadius.circular(10.0)),
143
-                              child: Text(
144
-                                date.day.toString(),
145
-                                style: TextStyle(color: Colors.white),
146
-                              )),
147
-                    ),
148
-                    calendarController: _controller,
149
-                  ),
150
-                  ..._selectedEvents.map((event) =>
151
-                      ListTile(
152
-                        title: Text(event.title),
153
-                        onTap: () {
154
-                          Navigator.push(
155
-                              context,
156
-                              MaterialPageRoute(
157
-                                  builder: (_) =>
158
-                                      EventDetailsPage(
159
-                                        event: event,
160
-                                      )));
161
-                        },
162
-                      )),
163
-                ],
152
+      headerStyle: HeaderStyle(
153
+        formatButtonTextStyle: TextStyle().copyWith(color: Colors.white, fontSize: 15.0),
154
+        formatButtonDecoration: BoxDecoration(
155
+          color: Colors.lightBlue,
156
+          borderRadius: BorderRadius.circular(16.0),
157
+        ),
158
+      ),
159
+      onDaySelected: _onDaySelected,
160
+      onVisibleDaysChanged: _onVisibleDaysChanged,
161
+      onCalendarCreated: _onCalendarCreated,
162
+    );
163
+  }
164
+  // Configuraciones detalladas del area de citas como definir dias, meses, etc.
165
+  Widget buildTableCalendarWithBuilders() {
166
+    return TableCalendar(
167
+      locale: 'pl_PL',
168
+      calendarController: _calendarController,
169
+      events: _events,
170
+      holidays: _holidays,
171
+      initialCalendarFormat: CalendarFormat.month,
172
+      formatAnimation: FormatAnimation.slide,
173
+      startingDayOfWeek: StartingDayOfWeek.sunday,
174
+      availableGestures: AvailableGestures.all,
175
+      availableCalendarFormats: const {
176
+        CalendarFormat.month: '',
177
+        CalendarFormat.week: '',
178
+      },
179
+      //Colores de los dias seleccionados
180
+      calendarStyle: CalendarStyle(
181
+        outsideDaysVisible: false,
182
+        weekendStyle: TextStyle().copyWith(color: Colors.blue),
183
+        holidayStyle: TextStyle().copyWith(color: Colors.blue),
184
+      ),
185
+      daysOfWeekStyle: DaysOfWeekStyle(
186
+        weekendStyle: TextStyle().copyWith(color: Colors.blue),
187
+      ),
188
+      headerStyle: HeaderStyle(
189
+        centerHeaderTitle: true,
190
+        formatButtonVisible: false,
191
+      ),
192
+      builders: CalendarBuilders(
193
+        selectedDayBuilder: (context, date, _) {
194
+          //Animacion del Calendario al cambiar el mes
195
+          return FadeTransition(
196
+            opacity: Tween(begin: 0.0, end: 1.0).animate(_animationController),
197
+            child: Container(
198
+              margin: const EdgeInsets.all(4.0),
199
+              padding: const EdgeInsets.only(top: 5.0, left: 6.0),
200
+              color: Colors.green,
201
+              width: 100,
202
+              height: 100,
203
+              child: Text(
204
+                '${date.day}',
205
+                style: TextStyle().copyWith(fontSize: 16.0),
206
+              ),
207
+            ),
208
+          );
209
+        },
210
+        todayDayBuilder: (context, date, _) {
211
+          return Container(
212
+            margin: const EdgeInsets.all(4.0),
213
+            padding: const EdgeInsets.only(top: 5.0, left: 6.0),
214
+            color: Colors.amber,
215
+            width: 100,
216
+            height: 100,
217
+            child: Text(
218
+              '${date.day}',
219
+              style: TextStyle().copyWith(fontSize: 16.0),
220
+            ),
221
+          );
222
+        },
223
+        markersBuilder: (context, date, events, holidays) {
224
+          final children = <Widget>[];
225
+
226
+          if (events.isNotEmpty) {
227
+            children.add(
228
+              Positioned(
229
+                right: 1,
230
+                bottom: 1,
231
+                child: _buildEventsMarker(date, events),
164 232
               ),
165 233
             );
166 234
           }
235
+
236
+          if (holidays.isNotEmpty) {
237
+            children.add(
238
+              Positioned(
239
+                right: -2,
240
+                top: -2,
241
+                child: _buildHolidaysMarker(),
242
+              ),
243
+            );
244
+          }
245
+
246
+          return children;
247
+        },
167 248
       ),
168
-      floatingActionButton: FloatingActionButton(
169
-        child: Icon(Icons.add),
170
-        onPressed: () => Navigator.pushNamed(context, 'add_event'),
249
+      onDaySelected: (date, events, holidays) {
250
+        _onDaySelected(date, events, holidays);
251
+        _animationController.forward(from: 0.0);
252
+      },
253
+      onVisibleDaysChanged: _onVisibleDaysChanged,
254
+      onCalendarCreated: _onCalendarCreated,
255
+    );
256
+  }
257
+//Marcador de eventos (aparece debajo de los dias)
258
+  Widget _buildEventsMarker(DateTime date, List events) {
259
+    return AnimatedContainer(
260
+      duration: const Duration(milliseconds: 300),
261
+      decoration: BoxDecoration(
262
+        shape: BoxShape.rectangle,
263
+        color: _calendarController.isSelected(date)
264
+            ? Colors.brown[500]
265
+            : _calendarController.isToday(date) ? Colors.brown : Colors.blue,
266
+      ),
267
+      width: 16.0,
268
+      height: 16.0,
269
+      child: Center(
270
+        child: Text(
271
+          '${events.length}',
272
+          style: TextStyle().copyWith(
273
+            color: Colors.green,
274
+            fontSize: 12.0,
275
+          ),
276
+        ),
171 277
       ),
172 278
     );
173 279
   }
174
-}
175 280
 
281
+  Widget _buildHolidaysMarker() {
282
+    return Icon(
283
+      Icons.add_box,
284
+      size: 20.0,
285
+      color: Colors.blueGrey,
286
+    );
287
+  }
288
+
289
+  Widget _buildButtons() {
290
+    final dateTime = _events.keys.elementAt(_events.length - 2);
291
+  //Definimos formato del calendario (mes, 2 semanas, semana)
292
+    return Column(
293
+      children: <Widget>[
294
+        Row(
295
+          mainAxisSize: MainAxisSize.max,
296
+          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
297
+          children: <Widget>[
298
+            RaisedButton(
299
+              child: Text('Mes'),
300
+              onPressed: () {
301
+                setState(() {
302
+                  _calendarController.setCalendarFormat(CalendarFormat.month);
303
+                });
304
+              },
305
+            ),
306
+            RaisedButton(
307
+              child: Text('2 Semanas'),
308
+              onPressed: () {
309
+                setState(() {
310
+                  _calendarController.setCalendarFormat(CalendarFormat.twoWeeks);
311
+                });
312
+              },
313
+            ),
314
+            RaisedButton(
315
+              child: Text('Semana'),
316
+              onPressed: () {
317
+                setState(() {
318
+                  _calendarController.setCalendarFormat(CalendarFormat.week);
319
+                });
320
+              },
321
+            ),
322
+          ],
323
+        ),
324
+        const SizedBox(height: 8.0),
325
+        RaisedButton(
326
+          child: Text('Recuerde Cita ${dateTime.day}-${dateTime.month}-${dateTime.year}'),
327
+          onPressed: () {
328
+            _calendarController.setSelectedDay(
329
+              DateTime(dateTime.year, dateTime.month, dateTime.day),
330
+              runCallback: true,
331
+            );
332
+          },
333
+        ),
334
+      ],
335
+    );
336
+  }
337
+
338
+  //Muestra las citas ya creadas
339
+  Widget _buildEventList() {
340
+    return ListView(
341
+      children: _selectedEvents
342
+          .map((event) => Container(
343
+        decoration: BoxDecoration(
344
+          border: Border.all(width: 0.8),
345
+          borderRadius: BorderRadius.circular(12.0),
346
+        ),
347
+        margin: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0),
348
+        child: ListTile(
349
+          title: Text(event.toString()),
350
+          onTap: () => print('$event tapped!'),
351
+        ),
352
+      ))
353
+          .toList(),
354
+    );
355
+  }
356
+}

+ 0
- 210
fast_med_flutter/lib/ui/pages/add_event.dart View File

@@ -1,210 +0,0 @@
1
-import 'package:fast_med_flutter/model/event.dart';
2
-import 'package:flutter/material.dart';
3
-import 'package:fast_med_flutter/res/event_firestore_service.dart';
4
-import 'package:http/http.dart' as http;
5
-import 'dart:async';
6
-import 'dart:convert';
7
-
8
-class AddEventPage extends StatefulWidget {
9
-  final EventModel note;
10
-
11
-  const AddEventPage({Key key, this.note}) : super(key: key);
12
-
13
-  @override
14
-  _AddEventPageState createState() => _AddEventPageState();
15
-}
16
-
17
-class _AddEventPageState extends State<AddEventPage> {
18
-  TextStyle style = TextStyle(fontFamily: 'Montserrat', fontSize: 20.0);
19
-  TextEditingController _title;
20
-  TextEditingController _description;
21
-  TextEditingController _number;
22
-  TextEditingController _name;
23
-  TextEditingController _reason;
24
-  TextEditingController _date;
25
-  TextEditingController _time;
26
-
27
-  DateTime _eventDate;
28
-  DateTime _eventTime;
29
-  DateTime selectedDate = DateTime.now();
30
-  List data;
31
-  final _formKey = GlobalKey<FormState>();
32
-  final _key = GlobalKey<ScaffoldState>();
33
-  bool processing;
34
-
35
-  @override
36
-  void initState() {
37
-    super.initState();
38
-    _title = TextEditingController(text: widget.note != null ? widget.note.title : "");
39
-    _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
-    _eventDate = DateTime.now();
45
-    //_eventTime = Time.now();
46
-    processing = false;
47
-  }
48
-
49
-
50
-  @override
51
-  Widget build(BuildContext context) {
52
-    return Scaffold(
53
-      appBar: AppBar(
54
-        title: Text(widget.note != null ? "Edit Note" : "Crear Su Cita"),
55
-      ),
56
-      key: _key,
57
-      body: Form(
58
-        key: _formKey,
59
-        child: Container(
60
-          alignment: Alignment.center,
61
-          child: ListView(
62
-            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
-              ),
89
-              Padding(
90
-                padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
91
-                child: TextFormField(
92
-                  controller: _reason,
93
-                  minLines: 3,
94
-                  maxLines: 5,
95
-                  validator: (value) =>
96
-                      (value.isEmpty) ? "Favor Explicar Razon Para La Cita" : null,
97
-                  style: style,
98
-                  decoration: InputDecoration(
99
-                      labelText: "Razones para su cita",
100
-                      border: OutlineInputBorder(borderRadius: BorderRadius.circular(10))),
101
-                ),
102
-              ),
103
-              const SizedBox(height: 10.0),
104
-              ListTile(
105
-                title: Text("Date (YYYY-MM-DD)"),
106
-                subtitle: Text("${_eventDate.year} - ${_eventDate.month} - ${_eventDate.day}"),
107
-                onTap: ()async{
108
-                  DateTime picked = await showDatePicker(context: context, initialDate: _eventDate, firstDate: DateTime(_eventDate.year-5), lastDate: DateTime(_eventDate.year+5));
109
-                  if(picked != null) {
110
-                    setState(() {
111
-                      _eventDate = picked;
112
-                    });
113
-                  }
114
-                },
115
-              ),
116
-
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
-              SizedBox(height: 10.0),
134
-              processing
135
-                  ? Center(child: CircularProgressIndicator())
136
-                  : Padding(
137
-                padding: const EdgeInsets.symmetric(horizontal: 16.0),
138
-                child: Material(
139
-                  elevation: 5.0,
140
-                  borderRadius: BorderRadius.circular(30.0),
141
-                  color: Theme.of(context).primaryColor,
142
-                  child: MaterialButton(
143
-                    onPressed: () async {
144
-                      if (_formKey.currentState.validate()) {
145
-                        setState(() {
146
-                          processing = true;
147
-                        });
148
-                        if(widget.note != null) {
149
-                          await eventDBS.updateData(widget.note.id,{
150
-
151
-
152
-                          "title": _title.text,
153
-                          "number": _number.text,
154
-                          "reason": _reason.text,
155
-                          "event_date": widget.note.eventDate,
156
-                          //"time": widget.note.DateTime,
157
-                          });
158
-                        }else{
159
-                          await eventDBS.createItem(EventModel(
160
-                              title: _title.text,
161
-                              description: _description.text,
162
-                              eventDate: _eventDate
163
-                          ));
164
-                        }
165
-                        Navigator.pop(context);
166
-                        setState(() {
167
-                          processing = false;
168
-                        });
169
-                      }
170
-                    },
171
-                    child: Text(
172
-                      "Crear Su Cita Ahora",
173
-                      style: style.copyWith(
174
-                          color: Colors.white,
175
-                          fontWeight: FontWeight.bold),
176
-                    ),
177
-                  ),
178
-                ),
179
-              ),
180
-            ],
181
-          ),
182
-        ),
183
-      ),
184
-    );
185
-  }
186
-
187
-
188
-  @override
189
-  void dispose() {
190
-    _title.dispose();
191
-    _description.dispose();
192
-    super.dispose();
193
-  }
194
-}
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
-);

+ 0
- 28
fast_med_flutter/lib/ui/pages/view_event.dart View File

@@ -1,28 +0,0 @@
1
-import 'package:flutter/material.dart';
2
-import 'package:fast_med_flutter/model/event.dart';
3
-
4
-class EventDetailsPage extends StatelessWidget {
5
-  final EventModel event;
6
-
7
-  const EventDetailsPage({Key key, this.event}) : super(key: key);
8
-
9
-  @override
10
-  Widget build(BuildContext context){
11
-    return Scaffold(
12
-      appBar: AppBar(
13
-        title: Text('Note details'),
14
-      ),
15
-      body: SingleChildScrollView(
16
-        padding: const EdgeInsets.all(16.0),
17
-        child: Column(
18
-          crossAxisAlignment: CrossAxisAlignment.start,
19
-          children: <Widget>[
20
-            Text(event.title, style: Theme.of(context).textTheme.display1,),
21
-            SizedBox(height: 20.0),
22
-            Text(event.description)
23
-          ],
24
-        ),
25
-      ),
26
-    );
27
-  }
28
-}