This commit is contained in:
Felipe
2024-01-05 15:57:46 -05:00
parent d9a62ce404
commit 278fdfd9e1
16 changed files with 647 additions and 251 deletions
+81 -58
View File
@@ -18,6 +18,7 @@ import 'package:prosappco/constansts.dart';
import 'package:prosappco/src/authentication/authentication_repository.dart';
import 'package:prosappco/src/components/network_utility.dart';
import 'package:prosappco/src/models/event_model.dart';
import 'package:prosappco/src/models/professional_model.dart';
import 'package:prosappco/src/models/setting_model.dart';
import 'package:prosappco/src/models/user_model.dart';
import 'package:prosappco/src/presentation/screens/professional.dart';
@@ -32,7 +33,11 @@ import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
class ServiceScreen extends StatefulWidget {
const ServiceScreen({super.key});
final DateTime? fechaSeleccionada;
final TimeOfDay? horaSeleccionada;
const ServiceScreen(
{super.key, this.fechaSeleccionada, this.horaSeleccionada});
@override
State<ServiceScreen> createState() => _ServiceScreenState();
@@ -100,6 +105,9 @@ class _ServiceScreenState extends State<ServiceScreen> {
_auth = FirebaseAuth.instance;
print('jurgo 1 ${widget.fechaSeleccionada}');
print('jurgo 2 ${widget.horaSeleccionada}');
final currentUser = _auth.currentUser;
if (currentUser != null && currentUser.displayName != null) {
@@ -611,64 +619,79 @@ class _ServiceScreenState extends State<ServiceScreen> {
},
),
),
const SizedBox(height: 15),
Row(
children: [
Expanded(
child: TextFormField(
readOnly: true,
decoration: InputDecoration(
prefixIcon: const Icon(Icons.calendar_month),
suffixIcon: _selectedDate == null
? const Icon(Icons.arrow_drop_down)
: null,
hintText: 'Fecha',
),
controller: TextEditingController(
text: _selectedDate == null
? ''
: formatter.format(_selectedDate!),
),
onTap: () {
if (_profesionalController.text.isNotEmpty) {
_selectDateAndTime(context);
} else {
WarningSnackbar.show(
title: 'Selecciona un profesional',
message:
'Selecciona un profesional antes de elegir la fecha y la hora de la cita.',
backgroundColor: Colors.orange,
);
}
},
widget.fechaSeleccionada == null &&
widget.horaSeleccionada == null
? const SizedBox()
: const SizedBox(height: 15),
widget.fechaSeleccionada == null &&
widget.horaSeleccionada == null
? const SizedBox()
: Row(
children: [
Expanded(
child: TextFormField(
readOnly: true,
decoration: const InputDecoration(
prefixIcon: Icon(Icons.calendar_month),
hintText: 'Fecha',
),
// controller: TextEditingController(
// text: _selectedDate == null
// ? ''
// : formatter.format(_selectedDate!),
// ),
controller: TextEditingController(
text: widget.fechaSeleccionada == null
? ''
: formatter
.format(widget.fechaSeleccionada!),
),
// onTap: () {
// if (_profesionalController
// .text.isNotEmpty) {
// _selectDateAndTime(context);
// } else {
// WarningSnackbar.show(
// title: 'Selecciona un profesional',
// message:
// 'Selecciona un profesional antes de elegir la fecha y la hora de la cita.',
// backgroundColor: Colors.orange,
// );
// }
// },
),
),
Expanded(
child: TextFormField(
// onTap: () {
// if (_profesionalController.text.isNotEmpty) {
// _selectDateAndTime(context);
// } else {
// WarningSnackbar.show(
// title: 'Selecciona un profesional',
// message:
// 'Selecciona un profesional antes de elegir la fecha y la hora de la cita.',
// backgroundColor: Colors.orange);
// }
// },
readOnly: true,
decoration: const InputDecoration(
prefixIcon: Icon(Icons.watch_later_outlined),
hintText: 'Hora',
),
// controller: TextEditingController(
// text: _selectedTime == null
// ? ''
// : ' ${_selectedTime!.format(context)}',
// ),
controller: TextEditingController(
text: widget.horaSeleccionada == null
? ''
: ' ${widget.horaSeleccionada!.format(context)}',
),
))
],
),
),
Expanded(
child: TextFormField(
onTap: () {
if (_profesionalController.text.isNotEmpty) {
_selectDateAndTime(context);
} else {
WarningSnackbar.show(
title: 'Selecciona un profesional',
message:
'Selecciona un profesional antes de elegir la fecha y la hora de la cita.',
backgroundColor: Colors.orange);
}
},
readOnly: true,
decoration: const InputDecoration(
suffixIcon: Icon(Icons.arrow_drop_down),
hintText: 'Hora',
),
controller: TextEditingController(
text: _selectedTime == null
? ''
: ' ${_selectedTime!.format(context)}',
),
))
],
),
const SizedBox(height: 15),
TextFormField(
controller: _observacionController,