fix campos
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -26,6 +25,8 @@ import 'package:prosappco/src/presentation/screens/service_type.dart';
|
||||
import 'package:prosappco/src/presentation/widgets/shared/drawer_menu.dart';
|
||||
import 'package:prosappco/src/presentation/widgets/shared/primary_button.dart';
|
||||
import 'package:prosappco/src/presentation/widgets/shared/warning_snackbar.dart';
|
||||
import 'package:prosappco/src/providers/user_provider.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class ServiceScreen extends StatefulWidget {
|
||||
@@ -81,23 +82,12 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
||||
|
||||
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
||||
|
||||
UserModel? user;
|
||||
String? settings;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
if (user == null) {
|
||||
UserModel.getUser(uid.toString()).then(
|
||||
(UserModel s) => (value) {
|
||||
if (mounted) {
|
||||
setState(() => user = s);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
_getAppVersion();
|
||||
|
||||
getLocationUpdates().then(
|
||||
@@ -191,127 +181,129 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final userProvider = Provider.of<UserProvider>(context);
|
||||
UserModel? user = userProvider.user;
|
||||
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
drawer: DrawerMenu(),
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: _currentP == null
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: Stack(
|
||||
children: [
|
||||
GoogleMap(
|
||||
onMapCreated: ((GoogleMapController controller) {
|
||||
_mapController.complete(controller);
|
||||
child: Stack(
|
||||
children: [
|
||||
GoogleMap(
|
||||
onMapCreated: ((GoogleMapController controller) {
|
||||
_mapController.complete(controller);
|
||||
|
||||
_applyMapStyle(controller);
|
||||
}),
|
||||
initialCameraPosition: const CameraPosition(
|
||||
target: _pGooglePlex,
|
||||
zoom: 15,
|
||||
),
|
||||
markers: {
|
||||
...markers,
|
||||
Marker(
|
||||
markerId: const MarkerId("_currentLocation"),
|
||||
icon: BitmapDescriptor.defaultMarker,
|
||||
position: _currentP!,
|
||||
),
|
||||
const Marker(
|
||||
markerId: MarkerId("_sourceLocation"),
|
||||
icon: BitmapDescriptor.defaultMarker,
|
||||
position: _pGooglePlex,
|
||||
),
|
||||
const Marker(
|
||||
markerId: MarkerId("_destionationLocation"),
|
||||
icon: BitmapDescriptor.defaultMarker,
|
||||
position: _pApplePark,
|
||||
),
|
||||
},
|
||||
polylines: Set<Polyline>.of(polylines.values),
|
||||
onCameraIdle: () {
|
||||
if (professionalAddress == '') {
|
||||
if (coordinates != null) {
|
||||
getLocationName(coordinates.latitude,
|
||||
coordinates.longitude)
|
||||
.then((locationName) {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_locacionController.text = locationName;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
onCameraMove: (position) {
|
||||
_applyMapStyle(controller);
|
||||
}),
|
||||
initialCameraPosition: const CameraPosition(
|
||||
target: _pGooglePlex,
|
||||
zoom: 15,
|
||||
),
|
||||
markers: {
|
||||
...markers,
|
||||
if (_currentP != null)
|
||||
Marker(
|
||||
markerId: const MarkerId("_currentLocation"),
|
||||
icon: BitmapDescriptor.defaultMarker,
|
||||
position: _currentP!,
|
||||
),
|
||||
// const Marker(
|
||||
// markerId: MarkerId("_sourceLocation"),
|
||||
// icon: BitmapDescriptor.defaultMarker,
|
||||
// position: _pGooglePlex,
|
||||
// ),
|
||||
// const Marker(
|
||||
// markerId: MarkerId("_destionationLocation"),
|
||||
// icon: BitmapDescriptor.defaultMarker,
|
||||
// position: _pApplePark,
|
||||
// ),
|
||||
},
|
||||
polylines: Set<Polyline>.of(polylines.values),
|
||||
onCameraIdle: () {
|
||||
if (professionalAddress == '') {
|
||||
if (coordinates != null) {
|
||||
getLocationName(
|
||||
coordinates.latitude, coordinates.longitude)
|
||||
.then((locationName) {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
coordinates = position.target;
|
||||
_locacionController.text = locationName;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
onCameraMove: (position) {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
coordinates = position.target;
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
Positioned(
|
||||
top: 10,
|
||||
left: 10,
|
||||
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();
|
||||
},
|
||||
),
|
||||
Positioned(
|
||||
top: 10,
|
||||
left: 10,
|
||||
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();
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 10,
|
||||
right: 20,
|
||||
child: FloatingActionButton(
|
||||
onPressed: () async {
|
||||
try {
|
||||
Position position = await _determinePosition();
|
||||
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_currentP = LatLng(
|
||||
position.latitude,
|
||||
position.longitude,
|
||||
);
|
||||
});
|
||||
|
||||
_animateCameraToPosition(_currentP!);
|
||||
}
|
||||
} catch (e) {
|
||||
WarningSnackbar.show(
|
||||
title: 'Ubicación desactivada',
|
||||
message:
|
||||
'Por favor activa la ubicacion de tu telefono.',
|
||||
);
|
||||
}
|
||||
},
|
||||
elevation: 0,
|
||||
child: const Icon(
|
||||
Icons.gps_fixed,
|
||||
size: 30,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 10,
|
||||
right: 20,
|
||||
child: FloatingActionButton(
|
||||
onPressed: () async {
|
||||
try {
|
||||
Position position = await _determinePosition();
|
||||
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_currentP = LatLng(
|
||||
position.latitude,
|
||||
position.longitude,
|
||||
);
|
||||
});
|
||||
|
||||
_animateCameraToPosition(_currentP!);
|
||||
}
|
||||
} catch (e) {
|
||||
WarningSnackbar.show(
|
||||
title: 'Ubicación desactivada',
|
||||
message:
|
||||
'Por favor activa la ubicacion de tu telefono.',
|
||||
);
|
||||
}
|
||||
},
|
||||
elevation: 0,
|
||||
child: const Icon(
|
||||
Icons.gps_fixed,
|
||||
size: 30,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 10),
|
||||
|
||||
Reference in New Issue
Block a user