horario del profesional
This commit is contained in:
@@ -3,10 +3,12 @@ import 'dart:developer';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'package:injector/injector.dart';
|
||||
import 'package:prosappco/constansts.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:prosappco/blocs/my_user_bloc/my_user_bloc.dart';
|
||||
import 'package:prosappco/screens/lists/professional_list_screen.dart';
|
||||
import 'package:setting_repository/setting_repository.dart';
|
||||
|
||||
@@ -25,6 +27,11 @@ class _UserMapScreenState extends State<UserMapScreen> {
|
||||
final settingRepository = Injector.appInstance.get<SettingRepository>();
|
||||
SettingEntity? settings;
|
||||
|
||||
final DateFormat formatter = DateFormat('dd/MM/yyyy');
|
||||
|
||||
DateTime? fechaSeleccionada;
|
||||
TimeOfDay? horaSeleccionada;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -42,102 +49,109 @@ class _UserMapScreenState extends State<UserMapScreen> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Stack(
|
||||
children: [
|
||||
GoogleMap(
|
||||
myLocationEnabled: true,
|
||||
onMapCreated: (GoogleMapController controller) {
|
||||
_mapController.complete(controller);
|
||||
},
|
||||
initialCameraPosition: const CameraPosition(
|
||||
target: LatLng(7.078511421411328, -73.08832615613937
|
||||
// currentPosition.latitude, currentPosition.longitude
|
||||
),
|
||||
zoom: 16,
|
||||
),
|
||||
myLocationButtonEnabled: false,
|
||||
),
|
||||
Positioned(
|
||||
top: 10,
|
||||
left: 0,
|
||||
child: Builder(
|
||||
builder: (context) {
|
||||
return ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.white,
|
||||
shape: const CircleBorder(),
|
||||
elevation: 3,
|
||||
minimumSize: const Size(50, 50),
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.menu,
|
||||
color: Colors.black,
|
||||
size: 35,
|
||||
),
|
||||
onPressed: () {
|
||||
Scaffold.of(context).openDrawer();
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
const Positioned(
|
||||
bottom: 30,
|
||||
right: 0,
|
||||
left: 0,
|
||||
top: 0,
|
||||
child: Icon(
|
||||
Icons.location_on,
|
||||
size: 40,
|
||||
color: Color(0xFFFF0000),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 10,
|
||||
right: 10,
|
||||
child: FloatingActionButton(
|
||||
onPressed: () async {
|
||||
try {
|
||||
Position position = await _determinePosition();
|
||||
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_currentP = LatLng(
|
||||
position.latitude,
|
||||
position.longitude,
|
||||
);
|
||||
});
|
||||
|
||||
_animateCameraToPosition(_currentP!);
|
||||
}
|
||||
} catch (e) {
|
||||
ScaffoldMessenger.of(context).clearSnackBars();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Por favor activa la ubicacion'),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
elevation: 0,
|
||||
child: const Icon(
|
||||
Icons.gps_fixed,
|
||||
size: 30,
|
||||
return BlocBuilder<MyUserBloc, MyUserState>(
|
||||
builder: (context, state) {
|
||||
return Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Stack(
|
||||
children: [
|
||||
GoogleMap(
|
||||
myLocationEnabled: true,
|
||||
onMapCreated: (GoogleMapController controller) {
|
||||
_mapController.complete(controller);
|
||||
},
|
||||
initialCameraPosition: const CameraPosition(
|
||||
target: LatLng(
|
||||
// 7.078511421411328, -73.08832615613937
|
||||
7.1253900,
|
||||
-73.1198000
|
||||
// currentPosition.latitude, currentPosition.longitude
|
||||
),
|
||||
zoom: 16,
|
||||
),
|
||||
myLocationButtonEnabled: false,
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 10,
|
||||
left: 0,
|
||||
child: Builder(
|
||||
builder: (context) {
|
||||
return ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.white,
|
||||
shape: const CircleBorder(),
|
||||
elevation: 3,
|
||||
minimumSize: const Size(50, 50),
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.menu,
|
||||
color: Colors.black,
|
||||
size: 35,
|
||||
),
|
||||
onPressed: () {
|
||||
Scaffold.of(context).openDrawer();
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
const Positioned(
|
||||
bottom: 30,
|
||||
right: 0,
|
||||
left: 0,
|
||||
top: 0,
|
||||
child: Icon(
|
||||
Icons.location_on,
|
||||
size: 40,
|
||||
color: Color(0xFFFF0000),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 10,
|
||||
right: 10,
|
||||
child: FloatingActionButton(
|
||||
onPressed: () async {
|
||||
try {
|
||||
Position position = await _determinePosition();
|
||||
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_currentP = LatLng(
|
||||
position.latitude,
|
||||
position.longitude,
|
||||
);
|
||||
});
|
||||
|
||||
_animateCameraToPosition(_currentP!);
|
||||
}
|
||||
} catch (e) {
|
||||
ScaffoldMessenger.of(context).clearSnackBars();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Por favor activa la ubicacion'),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
elevation: 0,
|
||||
child: const Icon(
|
||||
Icons.gps_fixed,
|
||||
size: 30,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
buildBottom(context)
|
||||
],
|
||||
),
|
||||
buildBottom(context, state),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Container buildBottom(BuildContext context) {
|
||||
Container buildBottom(BuildContext context, MyUserState state) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 10),
|
||||
color: Colors.white,
|
||||
@@ -147,11 +161,22 @@ class _UserMapScreenState extends State<UserMapScreen> {
|
||||
TextField(
|
||||
readOnly: true,
|
||||
onTap: () async {
|
||||
var datos = await Navigator.push(context, CupertinoPageRoute(builder: (context) {
|
||||
var datos = await Navigator.push(context,
|
||||
CupertinoPageRoute(builder: (context) {
|
||||
return const ProfessionalListScreen();
|
||||
}));
|
||||
|
||||
log('xd -- $datos');
|
||||
log('xd -- datos $datos');
|
||||
|
||||
if (datos != null) {
|
||||
fechaSeleccionada = datos[0];
|
||||
horaSeleccionada = datos[1];
|
||||
|
||||
log('xd -- $fechaSeleccionada');
|
||||
log('xd -- $horaSeleccionada');
|
||||
|
||||
setState(() {});
|
||||
}
|
||||
},
|
||||
decoration: const InputDecoration(
|
||||
prefixIcon: Icon(Icons.assignment_ind_rounded),
|
||||
@@ -167,35 +192,52 @@ class _UserMapScreenState extends State<UserMapScreen> {
|
||||
hintText: 'Dirección',
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
const Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextField(
|
||||
readOnly: true,
|
||||
Visibility(
|
||||
visible: fechaSeleccionada != null && horaSeleccionada != null,
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 15),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextField(
|
||||
readOnly: true,
|
||||
controller: TextEditingController(
|
||||
text: fechaSeleccionada == null
|
||||
? ''
|
||||
: formatter.format(fechaSeleccionada!),
|
||||
),
|
||||
decoration: const InputDecoration(
|
||||
prefixIcon: Icon(Icons.calendar_month),
|
||||
hintText: 'Fecha',
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
readOnly: true,
|
||||
controller: TextEditingController(
|
||||
text: horaSeleccionada == null
|
||||
? ''
|
||||
: horaSeleccionada!.format(context),
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: Icon(Icons.watch_later_outlined),
|
||||
hintText: 'Hora',
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
const TextField(
|
||||
// controller: _observacionController,
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: Icon(Icons.calendar_month),
|
||||
hintText: 'Fecha',
|
||||
prefixIcon: Icon(Icons.message_outlined),
|
||||
hintText: 'Observaciones',
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
readOnly: true,
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: Icon(Icons.watch_later_outlined),
|
||||
hintText: 'Hora',
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
const TextField(
|
||||
// controller: _observacionController,
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: Icon(Icons.message_outlined),
|
||||
hintText: 'Observaciones',
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
|
||||
Reference in New Issue
Block a user