servicios
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import 'dart:async';
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:firebase_storage/firebase_storage.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
@@ -10,8 +10,11 @@ import 'package:get/get.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
||||
import 'package:prosappco/src/components/drawer_menu.dart';
|
||||
import 'package:prosappco/src/models/event_model.dart';
|
||||
import 'package:prosappco/src/models/user_model.dart';
|
||||
import 'package:prosappco/src/screens/professional.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:prosappco/src/screens/service_type.dart';
|
||||
|
||||
class ServiceScreen extends StatefulWidget {
|
||||
const ServiceScreen({super.key});
|
||||
@@ -21,9 +24,16 @@ class ServiceScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ServiceScreenState extends State<ServiceScreen> {
|
||||
EventoService eventoService = EventoService();
|
||||
|
||||
final TextEditingController _locationController = TextEditingController();
|
||||
final String _locationPosition = '';
|
||||
|
||||
final _profesionalController = TextEditingController();
|
||||
final _serviceTypeController = TextEditingController();
|
||||
final _observacionController = TextEditingController();
|
||||
var professionalId = '';
|
||||
String _serviceType = 'Servicio';
|
||||
String _professional = '';
|
||||
final DateFormat formatter = DateFormat('dd/MM/yyyy');
|
||||
final DateTime now = DateTime.now();
|
||||
|
||||
@@ -32,7 +42,7 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
||||
|
||||
late GoogleMapController googleMapController;
|
||||
|
||||
static const CameraPosition initialCameraPosition = CameraPosition(
|
||||
static CameraPosition initialCameraPosition = const CameraPosition(
|
||||
target: LatLng(7.8939100, -72.5078200),
|
||||
zoom: 14.4746,
|
||||
);
|
||||
@@ -130,9 +140,6 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<String> opc = ["Servicio", "Opción 1", "Opción 2", "Opción 3"];
|
||||
String defaultValue = opc[0];
|
||||
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
backgroundColor: const Color(0xFFD6F4FF),
|
||||
@@ -218,7 +225,7 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
||||
// markers.clear();
|
||||
|
||||
// markers.add(Marker(
|
||||
// markerId: const MarkerId('currentLocation'),
|
||||
// markerId: MarkerId('currentLocation'),
|
||||
// position:
|
||||
// LatLng(position.latitude, position.longitude)));
|
||||
},
|
||||
@@ -254,54 +261,56 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(top: 23, left: 100, right: 25),
|
||||
const EdgeInsets.only(top: 22, left: 100, right: 25),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
color: Colors.white,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.4),
|
||||
spreadRadius: 1,
|
||||
blurRadius: 2,
|
||||
offset: const Offset(
|
||||
1, 2), // changes position of shadow
|
||||
offset: const Offset(1, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: DropdownButtonFormField(
|
||||
value: defaultValue,
|
||||
elevation: 0,
|
||||
decoration: InputDecoration(
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 16, vertical: 8),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
borderSide: BorderSide.none,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: TextFormField(
|
||||
onTap: () async {
|
||||
final String? serviceType = await Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return const ServiceTypeScreen();
|
||||
},
|
||||
),
|
||||
) as String?;
|
||||
|
||||
if (serviceType != null) {
|
||||
setState(() {
|
||||
_serviceType = serviceType;
|
||||
_serviceTypeController.text = _serviceType;
|
||||
});
|
||||
}
|
||||
},
|
||||
controller: _serviceTypeController,
|
||||
style: const TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
borderSide: BorderSide.none,
|
||||
readOnly: true,
|
||||
decoration: InputDecoration(
|
||||
hintText:
|
||||
_serviceType == '' ? 'Servicio' : _serviceType,
|
||||
hintStyle: const TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight: FontWeight.w600),
|
||||
border: InputBorder.none,
|
||||
enabledBorder: InputBorder.none,
|
||||
),
|
||||
),
|
||||
items: opc.map((e) {
|
||||
return DropdownMenuItem(
|
||||
value: e,
|
||||
child: Text(
|
||||
e,
|
||||
style:
|
||||
const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (value) {
|
||||
print(value);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -319,29 +328,35 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
||||
child: Column(
|
||||
children: [
|
||||
TextFormField(
|
||||
readOnly: true,
|
||||
controller: _locationController,
|
||||
decoration: const InputDecoration(
|
||||
prefixIcon: Icon(Icons.near_me),
|
||||
hintText: 'Dirección'),
|
||||
prefixIcon: Icon(Icons.near_me),
|
||||
hintText: 'Dirección',
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
TextFormField(
|
||||
// controller: _cedulaController,
|
||||
controller: _profesionalController,
|
||||
readOnly: true,
|
||||
onTap: () async {
|
||||
final String? profesional =
|
||||
final Professional? profesional =
|
||||
await Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return const ProfessionalScreen();
|
||||
return ProfessionalScreen(
|
||||
profession: _serviceTypeController.text,
|
||||
);
|
||||
},
|
||||
),
|
||||
) as String?;
|
||||
);
|
||||
|
||||
if (profesional != null) {
|
||||
setState(() {
|
||||
// _profession = profesional;
|
||||
_profesionalController.text =
|
||||
profesional.name.toString();
|
||||
professionalId = profesional.id;
|
||||
});
|
||||
}
|
||||
},
|
||||
@@ -396,14 +411,36 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
TextFormField(
|
||||
// controller: _cedulaController,
|
||||
controller: _observacionController,
|
||||
decoration: const InputDecoration(
|
||||
prefixIcon: Icon(Icons.message_outlined),
|
||||
hintText: 'Observaciones'),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
ElevatedButton(
|
||||
onPressed: () {},
|
||||
onPressed: () {
|
||||
int tiempo2 = ((_selectedTime!.hour * 3600 +
|
||||
_selectedTime!.minute * 60) +
|
||||
7200) %
|
||||
86400;
|
||||
|
||||
int hora2 = tiempo2 ~/ 3600;
|
||||
int minutos2 = (tiempo2 % 3600) ~/ 60;
|
||||
|
||||
TimeOfDay time2 =
|
||||
TimeOfDay(hour: hora2, minute: minutos2);
|
||||
|
||||
UserModel.getUser(uid.toString()).then((value) {
|
||||
eventoService.createEvent(
|
||||
value.name,
|
||||
_observacionController.text,
|
||||
'${_selectedDate}Z',
|
||||
_selectedTime!.format(context),
|
||||
time2.format(context),
|
||||
professionalId,
|
||||
);
|
||||
});
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: const Color(0xFF2BA4EC),
|
||||
shape: RoundedRectangleBorder(
|
||||
|
||||
Reference in New Issue
Block a user