This commit is contained in:
Felipe
2023-10-24 15:15:47 -05:00
parent 20bd588176
commit c9deda8f97
+38 -37
View File
@@ -839,6 +839,7 @@ class _ServiceScreenState extends State<ServiceScreen> {
const SizedBox(height: 15), const SizedBox(height: 15),
TextFormField( TextFormField(
controller: _locationController, controller: _locationController,
readOnly: ubicacion == 'sitio' ? true : false,
decoration: const InputDecoration( decoration: const InputDecoration(
prefixIcon: Icon(Icons.near_me), prefixIcon: Icon(Icons.near_me),
hintText: 'Dirección', hintText: 'Dirección',
@@ -849,46 +850,46 @@ class _ServiceScreenState extends State<ServiceScreen> {
placeAutoComplete(modifiedValue); placeAutoComplete(modifiedValue);
}, },
), ),
SizedBox( ubicacion == 'sitio'
height: _placesList.isNotEmpty ? const SizedBox.shrink()
? 200 : SizedBox(
: 0, // Ajusta la altura según tus necesidades height: _placesList.isNotEmpty ? 200 : 0,
child: ListView.builder( child: ListView.builder(
itemCount: _placesList.length, itemCount: _placesList.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return ListTile( return ListTile(
onTap: () { onTap: () {
final selectedAddress = final selectedAddress =
_placesList[index] _placesList[index]
['formatted_address']; ['formatted_address'];
final selectedLatitude = final selectedLatitude =
_placesList[index]['geometry'] _placesList[index]['geometry']
['location']['lat']; ['location']['lat'];
final selectedLongitude = final selectedLongitude =
_placesList[index]['geometry'] _placesList[index]['geometry']
['location']['lng']; ['location']['lng'];
_locationController.text = _locationController.text =
selectedAddress; selectedAddress;
final newCoordinates = LatLng( final newCoordinates = LatLng(
selectedLatitude, selectedLatitude,
selectedLongitude); selectedLongitude);
googleMapController.animateCamera( googleMapController.animateCamera(
CameraUpdate.newLatLng( CameraUpdate.newLatLng(
newCoordinates), newCoordinates),
); );
setState(() { setState(() {
_placesList = []; _placesList = [];
}); });
}, },
title: Text(_placesList[index] title: Text(_placesList[index]
['formatted_address']), ['formatted_address']),
); );
}, },
), ),
), ),
const SizedBox(height: 15), const SizedBox(height: 15),
Row( Row(
children: [ children: [