Compare commits
6 Commits
feature/re
...
feature/ma
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c0b88fea86 | ||
|
|
88532b43e7 | ||
|
|
1f2d162c34 | ||
|
|
e10bb97afb | ||
|
|
36c04582f3 | ||
|
|
2d56d6de0d |
@@ -1,8 +1,7 @@
|
||||
// main.dart
|
||||
import 'package:flutter/material.dart';
|
||||
import 'src/views/rutas.dart';
|
||||
import 'src/views/main_screen.dart';
|
||||
import 'src/views/login.dart'; // Importar LoginView
|
||||
import 'src/views/login.dart';
|
||||
import 'src/views/home_screen.dart';
|
||||
|
||||
void main() {
|
||||
runApp(const MyApp());
|
||||
@@ -60,10 +59,10 @@ class RegistroView extends StatelessWidget {
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15))
|
||||
),
|
||||
onPressed: () {
|
||||
// Navegar a MainScreen (app principal)
|
||||
// ✅ Navegar a HomeScreen (única barra de navegación)
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => const MainScreen()),
|
||||
MaterialPageRoute(builder: (context) => const HomeScreen()),
|
||||
);
|
||||
},
|
||||
child: const Text('Registrar', style: TextStyle(color: Colors.white, fontSize: 18)),
|
||||
|
||||
@@ -1,44 +1,50 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class Domicilio {
|
||||
final String id;
|
||||
final String nombre;
|
||||
final String colonia;
|
||||
final String calle;
|
||||
final String numero;
|
||||
final String id;
|
||||
final double latitud;
|
||||
final double longitud;
|
||||
|
||||
Domicilio({
|
||||
required this.id,
|
||||
required this.nombre,
|
||||
required this.colonia,
|
||||
required this.calle,
|
||||
required this.numero,
|
||||
required this.id,
|
||||
required this.latitud,
|
||||
required this.longitud,
|
||||
});
|
||||
|
||||
String get direccionCompleta => '$colonia, $calle $numero';
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'nombre': nombre,
|
||||
'colonia': colonia,
|
||||
'calle': calle,
|
||||
'numero': numero,
|
||||
'id': id,
|
||||
'latitud': latitud,
|
||||
'longitud': longitud,
|
||||
};
|
||||
|
||||
factory Domicilio.fromJson(Map<String, dynamic> json) {
|
||||
return Domicilio(
|
||||
id: json['id'],
|
||||
nombre: json['nombre'],
|
||||
colonia: json['colonia'],
|
||||
calle: json['calle'],
|
||||
numero: json['numero'],
|
||||
id: json['id'],
|
||||
latitud: json['latitud'].toDouble(),
|
||||
longitud: json['longitud'].toDouble(),
|
||||
);
|
||||
}
|
||||
|
||||
static String encode(List<Domicilio> domicilios) {
|
||||
return json.encode(
|
||||
domicilios.map((d) => d.toJson()).toList(),
|
||||
);
|
||||
return json.encode(domicilios.map((d) => d.toJson()).toList());
|
||||
}
|
||||
|
||||
static List<Domicilio> decode(String domiciliosString) {
|
||||
|
||||
72
lib/src/services/geolocation_service.dart
Normal file
72
lib/src/services/geolocation_service.dart
Normal file
@@ -0,0 +1,72 @@
|
||||
// src/services/geolocation_service.dart
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
|
||||
class SimplePosition {
|
||||
final double latitude;
|
||||
final double longitude;
|
||||
final DateTime timestamp;
|
||||
|
||||
SimplePosition({
|
||||
required this.latitude,
|
||||
required this.longitude,
|
||||
required this.timestamp,
|
||||
});
|
||||
}
|
||||
|
||||
class GeolocationService {
|
||||
static Future<bool> isLocationServiceEnabled() async {
|
||||
return await Geolocator.isLocationServiceEnabled();
|
||||
}
|
||||
|
||||
static Future<LocationPermission> checkPermission() async {
|
||||
return await Geolocator.checkPermission();
|
||||
}
|
||||
|
||||
static Future<LocationPermission> requestPermission() async {
|
||||
return await Geolocator.requestPermission();
|
||||
}
|
||||
|
||||
static Future<bool> hasPermission() async {
|
||||
LocationPermission permission = await Geolocator.checkPermission();
|
||||
return permission == LocationPermission.always ||
|
||||
permission == LocationPermission.whileInUse;
|
||||
}
|
||||
|
||||
static Future<SimplePosition?> getCurrentLocation() async {
|
||||
try {
|
||||
bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
|
||||
if (!serviceEnabled) return null;
|
||||
|
||||
LocationPermission permission = await Geolocator.checkPermission();
|
||||
if (permission == LocationPermission.denied) {
|
||||
permission = await Geolocator.requestPermission();
|
||||
if (permission == LocationPermission.denied) return null;
|
||||
}
|
||||
|
||||
if (permission == LocationPermission.deniedForever) return null;
|
||||
|
||||
Position position = await Geolocator.getCurrentPosition(
|
||||
desiredAccuracy: LocationAccuracy.low,
|
||||
timeLimit: const Duration(seconds: 5),
|
||||
);
|
||||
|
||||
return SimplePosition(
|
||||
latitude: position.latitude,
|
||||
longitude: position.longitude,
|
||||
timestamp: position.timestamp,
|
||||
);
|
||||
} catch (e) {
|
||||
print('Error: $e');
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static Future<SimplePosition?> getCurrentLocationWithRetry({int maxRetries = 2}) async {
|
||||
for (int i = 0; i < maxRetries; i++) {
|
||||
final position = await getCurrentLocation();
|
||||
if (position != null) return position;
|
||||
if (i < maxRetries - 1) await Future.delayed(const Duration(seconds: 1));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
// domicilios.dart
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'rutas.dart';
|
||||
import '../models/domicilio_model.dart';
|
||||
import 'dart:math';
|
||||
import '../services/geolocation_service.dart';
|
||||
|
||||
class DomiciliosView extends StatefulWidget {
|
||||
const DomiciliosView({super.key});
|
||||
@@ -15,8 +16,8 @@ class DomiciliosView extends StatefulWidget {
|
||||
class _DomiciliosViewState extends State<DomiciliosView> {
|
||||
List<Domicilio> domicilios = [];
|
||||
bool _isLoading = true;
|
||||
bool _isLoadingLocation = false;
|
||||
|
||||
// Controladores para el formulario
|
||||
final TextEditingController nombreController = TextEditingController();
|
||||
final TextEditingController coloniaController = TextEditingController();
|
||||
final TextEditingController calleController = TextEditingController();
|
||||
@@ -37,43 +38,121 @@ class _DomiciliosViewState extends State<DomiciliosView> {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
// Cargar domicilios guardados
|
||||
Future<void> _cargarDomicilios() async {
|
||||
try {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
final String? domiciliosString = prefs.getString('domicilios');
|
||||
|
||||
if (domiciliosString != null && domiciliosString.isNotEmpty) {
|
||||
setState(() {
|
||||
setState(() {
|
||||
if (domiciliosString != null && domiciliosString.isNotEmpty) {
|
||||
domicilios = Domicilio.decode(domiciliosString);
|
||||
_isLoading = false;
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
_isLoading = false;
|
||||
});
|
||||
} catch (e) {
|
||||
print('Error al cargar domicilios: $e');
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Guardar domicilios en SharedPreferences
|
||||
Future<void> _guardarDomicilios() async {
|
||||
try {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
final String domiciliosString = Domicilio.encode(domicilios);
|
||||
await prefs.setString('domicilios', domiciliosString);
|
||||
} catch (e) {
|
||||
print('Error al guardar domicilios: $e');
|
||||
print('Error al guardar: $e');
|
||||
}
|
||||
}
|
||||
|
||||
void _mostrarDialogoAgregar() {
|
||||
// Limpiar controladores
|
||||
Future<bool> _showLocationPermissionDialog() async {
|
||||
if (await GeolocationService.hasPermission()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
final result = await showDialog<bool>(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('Permiso de ubicación'),
|
||||
content: const Text(
|
||||
'Necesitamos acceder a tu ubicación para asignar tu domicilio a la ruta correcta.',
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, false),
|
||||
child: const Text('Cancelar'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, true),
|
||||
child: const Text('Aceptar', style: TextStyle(color: colorAzul)),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
if (result == true) {
|
||||
LocationPermission newPermission = await GeolocationService.requestPermission();
|
||||
return newPermission == LocationPermission.always ||
|
||||
newPermission == LocationPermission.whileInUse;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Future<void> _obtenerUbicacionYAgregar() async {
|
||||
setState(() {
|
||||
_isLoadingLocation = true;
|
||||
});
|
||||
|
||||
final serviceEnabled = await GeolocationService.isLocationServiceEnabled();
|
||||
if (!serviceEnabled) {
|
||||
setState(() {
|
||||
_isLoadingLocation = false;
|
||||
});
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Activa el GPS para agregar un domicilio'),
|
||||
backgroundColor: Colors.orange,
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
final hasPermission = await _showLocationPermissionDialog();
|
||||
if (!hasPermission) {
|
||||
setState(() {
|
||||
_isLoadingLocation = false;
|
||||
});
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Necesitamos tu ubicación'),
|
||||
backgroundColor: Colors.orange,
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
final simplePosition = await GeolocationService.getCurrentLocation();
|
||||
|
||||
setState(() {
|
||||
_isLoadingLocation = false;
|
||||
});
|
||||
|
||||
if (simplePosition == null) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('No se pudo obtener tu ubicación.'),
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
_mostrarDialogoAgregarConUbicacion(simplePosition.latitude, simplePosition.longitude);
|
||||
}
|
||||
|
||||
void _mostrarDialogoAgregarConUbicacion(double lat, double lng) {
|
||||
nombreController.clear();
|
||||
coloniaController.clear();
|
||||
calleController.clear();
|
||||
@@ -90,86 +169,53 @@ class _DomiciliosViewState extends State<DomiciliosView> {
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
// Título
|
||||
const Text(
|
||||
'Añadir domicilio',
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: colorAzul,
|
||||
const Text('Añadir domicilio', style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold, color: colorAzul)),
|
||||
const SizedBox(height: 10),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(color: Colors.green.withOpacity(0.1), borderRadius: BorderRadius.circular(12)),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.location_on, color: Colors.green[700], size: 24),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('📍 Ubicación obtenida', style: TextStyle(fontSize: 12, color: Colors.green[700])),
|
||||
Text('Lat: ${lat.toStringAsFixed(6)}'),
|
||||
Text('Lng: ${lng.toStringAsFixed(6)}'),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
// Campo: Nombre del domicilio
|
||||
_buildCampoTexto(
|
||||
controller: nombreController,
|
||||
hint: 'Nombre del domicilio',
|
||||
icon: Icons.home_outlined,
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
// Campo: Colonia
|
||||
_buildCampoTexto(
|
||||
controller: coloniaController,
|
||||
hint: 'Colonia',
|
||||
icon: Icons.location_city_outlined,
|
||||
),
|
||||
_buildCampoTexto(controller: nombreController, hint: 'Nombre del domicilio', icon: Icons.home_outlined),
|
||||
const SizedBox(height: 15),
|
||||
// Campo: Calle
|
||||
_buildCampoTexto(
|
||||
controller: calleController,
|
||||
hint: 'Calle',
|
||||
icon: Icons.streetview,
|
||||
),
|
||||
_buildCampoTexto(controller: coloniaController, hint: 'Colonia', icon: Icons.location_city_outlined),
|
||||
const SizedBox(height: 15),
|
||||
// Campo: Número
|
||||
_buildCampoTexto(
|
||||
controller: numeroController,
|
||||
hint: 'Número',
|
||||
icon: Icons.numbers,
|
||||
keyboardType: TextInputType.number,
|
||||
),
|
||||
_buildCampoTexto(controller: calleController, hint: 'Calle', icon: Icons.streetview),
|
||||
const SizedBox(height: 15),
|
||||
_buildCampoTexto(controller: numeroController, hint: 'Número', icon: Icons.numbers, keyboardType: TextInputType.number),
|
||||
const SizedBox(height: 25),
|
||||
// Botones
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
// Botón Cancelar
|
||||
Expanded(
|
||||
child: OutlinedButton(
|
||||
style: OutlinedButton.styleFrom(
|
||||
side: BorderSide(color: colorAzul, width: 2),
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: const Text(
|
||||
'Cancelar',
|
||||
style: TextStyle(fontSize: 16, color: colorAzul),
|
||||
),
|
||||
style: OutlinedButton.styleFrom(side: BorderSide(color: colorAzul, width: 2), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15))),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: const Text('Cancelar', style: TextStyle(color: colorAzul)),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
// Botón Agregar
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: colorAzul,
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
_agregarDomicilio();
|
||||
},
|
||||
child: const Text(
|
||||
'Agregar',
|
||||
style: TextStyle(fontSize: 16, color: Colors.white),
|
||||
),
|
||||
style: ElevatedButton.styleFrom(backgroundColor: colorAzul, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15))),
|
||||
onPressed: () => _agregarDomicilio(latitud: lat, longitud: lng),
|
||||
child: const Text('Agregar', style: TextStyle(color: Colors.white)),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -194,238 +240,139 @@ class _DomiciliosViewState extends State<DomiciliosView> {
|
||||
decoration: InputDecoration(
|
||||
hintText: hint,
|
||||
prefixIcon: Icon(icon, color: colorAzul),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
borderSide: const BorderSide(color: colorAzul),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
borderSide: BorderSide(color: colorAzul.withOpacity(0.5)),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
borderSide: const BorderSide(color: colorAzul, width: 2),
|
||||
),
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(15)),
|
||||
enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15), borderSide: BorderSide(color: colorAzul.withOpacity(0.5))),
|
||||
focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15), borderSide: const BorderSide(color: colorAzul, width: 2)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _agregarDomicilio() async {
|
||||
// Validar que todos los campos estén llenos
|
||||
if (nombreController.text.isEmpty ||
|
||||
coloniaController.text.isEmpty ||
|
||||
calleController.text.isEmpty ||
|
||||
numeroController.text.isEmpty) {
|
||||
void _agregarDomicilio({required double latitud, required double longitud}) async {
|
||||
if (nombreController.text.trim().isEmpty ||
|
||||
coloniaController.text.trim().isEmpty ||
|
||||
calleController.text.trim().isEmpty ||
|
||||
numeroController.text.trim().isEmpty) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Por favor, llena todos los campos'),
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
const SnackBar(content: Text('Llena todos los campos'), backgroundColor: Colors.red),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Crear nuevo domicilio con ID único
|
||||
final nuevoDomicilio = Domicilio(
|
||||
nombre: nombreController.text,
|
||||
colonia: coloniaController.text,
|
||||
calle: calleController.text,
|
||||
numero: numeroController.text,
|
||||
id: DateTime.now().millisecondsSinceEpoch.toString(), // ID único
|
||||
id: DateTime.now().millisecondsSinceEpoch.toString(),
|
||||
nombre: nombreController.text.trim(),
|
||||
colonia: coloniaController.text.trim(),
|
||||
calle: calleController.text.trim(),
|
||||
numero: numeroController.text.trim(),
|
||||
latitud: latitud,
|
||||
longitud: longitud,
|
||||
);
|
||||
|
||||
// Agregar a la lista
|
||||
setState(() {
|
||||
domicilios.add(nuevoDomicilio);
|
||||
});
|
||||
|
||||
// Guardar en SharedPreferences
|
||||
await _guardarDomicilios();
|
||||
|
||||
// Cerrar el diálogo
|
||||
Navigator.pop(context);
|
||||
|
||||
// Mostrar mensaje de éxito
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Domicilio "${nombreController.text}" agregado'),
|
||||
backgroundColor: colorAzul,
|
||||
duration: const Duration(seconds: 2),
|
||||
),
|
||||
SnackBar(content: Text('Domicilio agregado'), backgroundColor: colorAzul),
|
||||
);
|
||||
}
|
||||
|
||||
void _eliminarDomicilio(int index) async {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: const Text('Eliminar domicilio'),
|
||||
content: Text('¿Deseas eliminar "${domicilios[index].nombre}"?'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: const Text('Cancelar'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
setState(() {
|
||||
domicilios.removeAt(index);
|
||||
});
|
||||
|
||||
// Guardar cambios en SharedPreferences
|
||||
await _guardarDomicilios();
|
||||
|
||||
Navigator.pop(context);
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Domicilio eliminado'),
|
||||
backgroundColor: Colors.red,
|
||||
duration: Duration(seconds: 2),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: const Text('Eliminar', style: TextStyle(color: Colors.red)),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('Eliminar domicilio'),
|
||||
content: Text('¿Eliminar "${domicilios[index].nombre}"?'),
|
||||
actions: [
|
||||
TextButton(onPressed: () => Navigator.pop(context), child: const Text('Cancelar')),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
setState(() => domicilios.removeAt(index));
|
||||
await _guardarDomicilios();
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: const Text('Eliminar', style: TextStyle(color: Colors.red)),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
// AppBar personalizado
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 16),
|
||||
decoration: const BoxDecoration(
|
||||
color: colorAzul,
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(20),
|
||||
bottomRight: Radius.circular(20),
|
||||
),
|
||||
),
|
||||
child: const Text(
|
||||
'Domicilios',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 28,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
return SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 16),
|
||||
decoration: const BoxDecoration(
|
||||
color: colorAzul,
|
||||
borderRadius: BorderRadius.only(bottomLeft: Radius.circular(20), bottomRight: Radius.circular(20)),
|
||||
),
|
||||
// Contenido
|
||||
Expanded(
|
||||
child: _isLoading
|
||||
? const Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: colorAzul,
|
||||
),
|
||||
)
|
||||
: domicilios.isEmpty
|
||||
? Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.home_outlined,
|
||||
size: 100,
|
||||
color: Colors.grey.withOpacity(0.5),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
'No hay domicilios agregados',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
color: Colors.grey.withOpacity(0.7),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
'Toca el botón + para agregar',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.grey.withOpacity(0.5),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: ListView.builder(
|
||||
padding: const EdgeInsets.all(20),
|
||||
itemCount: domicilios.length,
|
||||
itemBuilder: (context, index) {
|
||||
final domicilio = domicilios[index];
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(15),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.black, width: 4),
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.home_outlined, size: 60),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
domicilio.nombre,
|
||||
style: const TextStyle(
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
domicilio.direccionCompleta,
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () => _eliminarDomicilio(index),
|
||||
icon: const Icon(Icons.delete_outline, size: 40),
|
||||
color: Colors.red,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: const Text('Domicilios', style: TextStyle(color: Colors.white, fontSize: 28, fontWeight: FontWeight.bold), textAlign: TextAlign.center),
|
||||
),
|
||||
Expanded(
|
||||
child: _isLoading
|
||||
? const Center(child: CircularProgressIndicator(color: colorAzul))
|
||||
: domicilios.isEmpty
|
||||
? Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.home_outlined, size: 100, color: Colors.grey.withOpacity(0.5)),
|
||||
const SizedBox(height: 20),
|
||||
Text('No hay domicilios', style: TextStyle(fontSize: 18, color: Colors.grey.withOpacity(0.7))),
|
||||
const SizedBox(height: 10),
|
||||
Text('Toca el botón + para agregar', style: TextStyle(fontSize: 14, color: Colors.grey.withOpacity(0.5))),
|
||||
],
|
||||
),
|
||||
),
|
||||
// Botón flotante de agregar
|
||||
Padding(
|
||||
)
|
||||
: ListView.builder(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: GestureDetector(
|
||||
onTap: _mostrarDialogoAgregar,
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: 100,
|
||||
decoration: BoxDecoration(
|
||||
color: colorAzul,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
itemCount: domicilios.length,
|
||||
itemBuilder: (context, index) {
|
||||
final d = domicilios[index];
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(15),
|
||||
decoration: BoxDecoration(border: Border.all(color: Colors.black, width: 4), borderRadius: BorderRadius.circular(25)),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.home_outlined, size: 60),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(d.nombre, style: const TextStyle(fontSize: 22, fontWeight: FontWeight.bold)),
|
||||
Text(d.direccionCompleta, style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
|
||||
Text('📍 ${d.latitud.toStringAsFixed(4)}, ${d.longitud.toStringAsFixed(4)}', style: TextStyle(fontSize: 12, color: Colors.grey[600])),
|
||||
],
|
||||
),
|
||||
),
|
||||
IconButton(onPressed: () => _eliminarDomicilio(index), icon: const Icon(Icons.delete_outline, size: 40), color: Colors.red),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: const Icon(Icons.add, color: Colors.white, size: 80),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: _isLoadingLocation
|
||||
? Container(width: double.infinity, height: 100, decoration: BoxDecoration(color: colorAzul, borderRadius: BorderRadius.circular(20)), child: const Center(child: CircularProgressIndicator(color: Colors.white)))
|
||||
: GestureDetector(
|
||||
onTap: _obtenerUbicacionYAgregar,
|
||||
child: Container(width: double.infinity, height: 100, decoration: BoxDecoration(color: colorAzul, borderRadius: BorderRadius.circular(20)), child: const Icon(Icons.add, color: Colors.white, size: 80)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
42
lib/src/views/home_screen.dart
Normal file
42
lib/src/views/home_screen.dart
Normal file
@@ -0,0 +1,42 @@
|
||||
// home_screen.dart
|
||||
import 'package:flutter/material.dart';
|
||||
import 'domicilios.dart';
|
||||
import 'horarios.dart';
|
||||
import 'configuracion.dart';
|
||||
import 'rutas.dart';
|
||||
import 'nav_bar.dart';
|
||||
|
||||
class HomeScreen extends StatefulWidget {
|
||||
const HomeScreen({super.key});
|
||||
|
||||
@override
|
||||
State<HomeScreen> createState() => _HomeScreenState();
|
||||
}
|
||||
|
||||
class _HomeScreenState extends State<HomeScreen> {
|
||||
int _currentIndex = 0; // 0: Domicilios, 1: Rutas, 2: Configuración
|
||||
|
||||
final List<Widget> _paginas = const [
|
||||
DomiciliosView(),
|
||||
HorariosView(),
|
||||
ConfiguracionView(),
|
||||
];
|
||||
|
||||
void _onNavBarTap(int index) {
|
||||
setState(() {
|
||||
_currentIndex = index;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
body: _paginas[_currentIndex],
|
||||
bottomNavigationBar: CustomNavBar(
|
||||
currentIndex: _currentIndex,
|
||||
onTap: _onNavBarTap,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,46 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'rutas.dart';
|
||||
import '../models/domicilio_model.dart';
|
||||
import 'mapa_expandible.dart';
|
||||
|
||||
class HorariosView extends StatelessWidget {
|
||||
class HorariosView extends StatefulWidget {
|
||||
const HorariosView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final List<Map<String, String>> rutas = List.generate(
|
||||
6,
|
||||
(index) => {
|
||||
'colonia': 'Colonia ${index + 1}',
|
||||
'ruta': 'Ruta ${index + 1}',
|
||||
'horario': '${8 + (index % 3)}:${30 * (index % 2)} ${index < 3 ? 'AM' : 'PM'}',
|
||||
},
|
||||
);
|
||||
State<HorariosView> createState() => _HorariosViewState();
|
||||
}
|
||||
|
||||
class _HorariosViewState extends State<HorariosView> {
|
||||
List<Domicilio> domicilios = [];
|
||||
bool _isLoading = true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_cargarDomicilios();
|
||||
}
|
||||
|
||||
Future<void> _cargarDomicilios() async {
|
||||
try {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
final String? domiciliosString = prefs.getString('domicilios');
|
||||
|
||||
setState(() {
|
||||
if (domiciliosString != null && domiciliosString.isNotEmpty) {
|
||||
domicilios = Domicilio.decode(domiciliosString);
|
||||
}
|
||||
_isLoading = false;
|
||||
});
|
||||
} catch (e) {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
child: SafeArea(
|
||||
@@ -32,7 +58,7 @@ class HorariosView extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
child: const Text(
|
||||
'Horarios',
|
||||
'Mis Rutas',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 32,
|
||||
@@ -41,32 +67,46 @@ class HorariosView extends StatelessWidget {
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
// Lista de horarios
|
||||
// Lista de domicilios
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 24),
|
||||
itemCount: rutas.length,
|
||||
itemBuilder: (context, index) {
|
||||
final item = rutas[index];
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(item['colonia']!,
|
||||
style: const TextStyle(fontSize: 22, fontWeight: FontWeight.bold)),
|
||||
Text(item['ruta']!,
|
||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold)),
|
||||
],
|
||||
),
|
||||
Text(item['horario']!,
|
||||
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold)),
|
||||
],
|
||||
child: _isLoading
|
||||
? const Center(child: CircularProgressIndicator(color: colorAzul))
|
||||
: domicilios.isEmpty
|
||||
? Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.location_on_outlined,
|
||||
size: 100,
|
||||
color: Colors.grey.withOpacity(0.5),
|
||||
),
|
||||
);
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
'No hay domicilios agregados',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
color: Colors.grey.withOpacity(0.7),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
'Agrega domicilios desde la pestaña Domicilios',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.grey.withOpacity(0.5),
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: ListView.builder(
|
||||
padding: const EdgeInsets.all(20),
|
||||
itemCount: domicilios.length,
|
||||
itemBuilder: (context, index) {
|
||||
final domicilio = domicilios[index];
|
||||
return _buildDomicilioCard(domicilio, index);
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -75,4 +115,110 @@ class HorariosView extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDomicilioCard(Domicilio domicilio, int index) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.black, width: 4),
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
// Contenido principal del domicilio
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(15),
|
||||
child: Column(
|
||||
children: [
|
||||
// Info principal
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.home_outlined, size: 60),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
domicilio.nombre,
|
||||
style: const TextStyle(
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
domicilio.direccionCompleta,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'📍 ${domicilio.latitud.toStringAsFixed(4)}, ${domicilio.longitud.toStringAsFixed(4)}',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Colors.grey[600],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
// Fila de horario y botón de mapa
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
// Horario (placeholder para API del backend)
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: colorAzul.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.access_time, color: colorAzul, size: 20),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'Horario: ${_obtenerHorarioEstimado(index)}',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: colorAzul,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
// Botón/flecha para mapa desplegable
|
||||
MapaExpandible(
|
||||
latitud: domicilio.latitud,
|
||||
longitud: domicilio.longitud,
|
||||
nombreDomicilio: domicilio.nombre,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Horario estimado (placeholder para cuando conectes con el backend)
|
||||
String _obtenerHorarioEstimado(int index) {
|
||||
// Esto es solo un placeholder - aquí irá la llamada a tu API
|
||||
final horarios = ['8:00 AM - 9:00 AM', '9:30 AM - 10:30 AM', '11:00 AM - 12:00 PM', '1:00 PM - 2:00 PM', '3:00 PM - 4:00 PM', '5:00 PM - 6:00 PM'];
|
||||
return horarios[index % horarios.length];
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
// login.dart - cambiar MainScreen por HomeScreen
|
||||
import 'package:flutter/material.dart';
|
||||
import 'rutas.dart';
|
||||
import 'main_screen.dart';
|
||||
import 'home_screen.dart'; // ← Importar HomeScreen
|
||||
|
||||
class LoginView extends StatelessWidget {
|
||||
const LoginView({super.key});
|
||||
@@ -27,16 +28,12 @@ class LoginView extends StatelessWidget {
|
||||
padding: const EdgeInsets.all(30.0),
|
||||
child: Column(
|
||||
children: [
|
||||
// Campo de Correo
|
||||
_buildInput(Icons.email_outlined, 'Correo electrónico', obscureText: false),
|
||||
const SizedBox(height: 20),
|
||||
// Campo de Contraseña
|
||||
_buildInput(Icons.lock_outline, 'Contraseña', obscureText: true),
|
||||
const SizedBox(height: 50),
|
||||
// Botones
|
||||
Column(
|
||||
children: [
|
||||
// Botón Iniciar Sesión
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: colorAzul,
|
||||
@@ -44,9 +41,10 @@ class LoginView extends StatelessWidget {
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)),
|
||||
),
|
||||
onPressed: () {
|
||||
// ✅ Navegar a HomeScreen
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => const MainScreen()),
|
||||
MaterialPageRoute(builder: (context) => const HomeScreen()),
|
||||
);
|
||||
},
|
||||
child: const Text(
|
||||
@@ -55,7 +53,6 @@ class LoginView extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
// Botón Crear Cuenta
|
||||
OutlinedButton(
|
||||
style: OutlinedButton.styleFrom(
|
||||
minimumSize: const Size(double.infinity, 55),
|
||||
|
||||
138
lib/src/views/mapa_expandible.dart
Normal file
138
lib/src/views/mapa_expandible.dart
Normal file
@@ -0,0 +1,138 @@
|
||||
// src/views/mapa_expandible.dart
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import 'rutas.dart';
|
||||
|
||||
class MapaExpandible extends StatefulWidget {
|
||||
final double latitud;
|
||||
final double longitud;
|
||||
final String nombreDomicilio;
|
||||
|
||||
const MapaExpandible({
|
||||
super.key,
|
||||
required this.latitud,
|
||||
required this.longitud,
|
||||
required this.nombreDomicilio,
|
||||
});
|
||||
|
||||
@override
|
||||
State<MapaExpandible> createState() => _MapaExpandibleState();
|
||||
}
|
||||
|
||||
class _MapaExpandibleState extends State<MapaExpandible> {
|
||||
bool _isExpanded = false;
|
||||
|
||||
bool get _isValidLatLng {
|
||||
final lat = widget.latitud;
|
||||
final lng = widget.longitud;
|
||||
return lat.isFinite && lng.isFinite && lat != 0 && lng != 0;
|
||||
}
|
||||
|
||||
Future<void> _abrirGoogleMaps() async {
|
||||
final url = 'https://www.google.com/maps?q=${widget.latitud},${widget.longitud}&z=15';
|
||||
try {
|
||||
if (await canLaunch(url)) {
|
||||
await launch(url);
|
||||
}
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('No se pudo abrir el mapa'), backgroundColor: Colors.red),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (!_isValidLatLng) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey[200],
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: const Text('Ubicación no disponible', style: TextStyle(fontSize: 12)),
|
||||
);
|
||||
}
|
||||
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_isExpanded = !_isExpanded;
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey[200],
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
_isExpanded ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down,
|
||||
color: colorAzul,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
_isExpanded ? 'Ocultar mapa' : 'Ver mapa',
|
||||
style: TextStyle(color: colorAzul, fontSize: 12, fontWeight: FontWeight.w500),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
if (_isExpanded)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 12),
|
||||
child: GestureDetector(
|
||||
onTap: _abrirGoogleMaps,
|
||||
child: Container(
|
||||
width: 200, // Ancho fijo en lugar de infinity
|
||||
height: 160,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
border: Border.all(color: colorAzul.withOpacity(0.3), width: 1),
|
||||
color: Colors.grey[100],
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.map, size: 40, color: colorAzul),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'Ver en Google Maps',
|
||||
style: TextStyle(color: colorAzul, fontWeight: FontWeight.bold, fontSize: 14),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'${widget.latitud.toStringAsFixed(4)}, ${widget.longitud.toStringAsFixed(4)}',
|
||||
style: TextStyle(fontSize: 11, color: Colors.grey[600]),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 3),
|
||||
decoration: BoxDecoration(
|
||||
color: colorAzul,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: const Text(
|
||||
'Tocar para abrir',
|
||||
style: TextStyle(color: Colors.white, fontSize: 11),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user