fix campos
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||||
import 'package:firebase_auth/firebase_auth.dart';
|
|
||||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.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/drawer_menu.dart';
|
||||||
import 'package:prosappco/src/presentation/widgets/shared/primary_button.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/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';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
class ServiceScreen extends StatefulWidget {
|
class ServiceScreen extends StatefulWidget {
|
||||||
@@ -81,23 +82,12 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
|||||||
|
|
||||||
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
||||||
|
|
||||||
UserModel? user;
|
|
||||||
String? settings;
|
String? settings;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
if (user == null) {
|
|
||||||
UserModel.getUser(uid.toString()).then(
|
|
||||||
(UserModel s) => (value) {
|
|
||||||
if (mounted) {
|
|
||||||
setState(() => user = s);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
_getAppVersion();
|
_getAppVersion();
|
||||||
|
|
||||||
getLocationUpdates().then(
|
getLocationUpdates().then(
|
||||||
@@ -191,127 +181,129 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final userProvider = Provider.of<UserProvider>(context);
|
||||||
|
UserModel? user = userProvider.user;
|
||||||
|
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
drawer: DrawerMenu(),
|
drawer: DrawerMenu(),
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: _currentP == null
|
child: Stack(
|
||||||
? const Center(child: CircularProgressIndicator())
|
children: [
|
||||||
: Stack(
|
GoogleMap(
|
||||||
children: [
|
onMapCreated: ((GoogleMapController controller) {
|
||||||
GoogleMap(
|
_mapController.complete(controller);
|
||||||
onMapCreated: ((GoogleMapController controller) {
|
|
||||||
_mapController.complete(controller);
|
|
||||||
|
|
||||||
_applyMapStyle(controller);
|
_applyMapStyle(controller);
|
||||||
}),
|
}),
|
||||||
initialCameraPosition: const CameraPosition(
|
initialCameraPosition: const CameraPosition(
|
||||||
target: _pGooglePlex,
|
target: _pGooglePlex,
|
||||||
zoom: 15,
|
zoom: 15,
|
||||||
),
|
),
|
||||||
markers: {
|
markers: {
|
||||||
...markers,
|
...markers,
|
||||||
Marker(
|
if (_currentP != null)
|
||||||
markerId: const MarkerId("_currentLocation"),
|
Marker(
|
||||||
icon: BitmapDescriptor.defaultMarker,
|
markerId: const MarkerId("_currentLocation"),
|
||||||
position: _currentP!,
|
icon: BitmapDescriptor.defaultMarker,
|
||||||
),
|
position: _currentP!,
|
||||||
const Marker(
|
),
|
||||||
markerId: MarkerId("_sourceLocation"),
|
// const Marker(
|
||||||
icon: BitmapDescriptor.defaultMarker,
|
// markerId: MarkerId("_sourceLocation"),
|
||||||
position: _pGooglePlex,
|
// icon: BitmapDescriptor.defaultMarker,
|
||||||
),
|
// position: _pGooglePlex,
|
||||||
const Marker(
|
// ),
|
||||||
markerId: MarkerId("_destionationLocation"),
|
// const Marker(
|
||||||
icon: BitmapDescriptor.defaultMarker,
|
// markerId: MarkerId("_destionationLocation"),
|
||||||
position: _pApplePark,
|
// icon: BitmapDescriptor.defaultMarker,
|
||||||
),
|
// position: _pApplePark,
|
||||||
},
|
// ),
|
||||||
polylines: Set<Polyline>.of(polylines.values),
|
},
|
||||||
onCameraIdle: () {
|
polylines: Set<Polyline>.of(polylines.values),
|
||||||
if (professionalAddress == '') {
|
onCameraIdle: () {
|
||||||
if (coordinates != null) {
|
if (professionalAddress == '') {
|
||||||
getLocationName(coordinates.latitude,
|
if (coordinates != null) {
|
||||||
coordinates.longitude)
|
getLocationName(
|
||||||
.then((locationName) {
|
coordinates.latitude, coordinates.longitude)
|
||||||
if (mounted) {
|
.then((locationName) {
|
||||||
setState(() {
|
|
||||||
_locacionController.text = locationName;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onCameraMove: (position) {
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {
|
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(
|
Container(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 10),
|
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 10),
|
||||||
|
|||||||
Reference in New Issue
Block a user