Mi primer commit

This commit is contained in:
Kimberly
2026-05-22 23:18:37 -06:00
commit ea0b7e0f75
138 changed files with 6398 additions and 0 deletions

114
lib/tarjetaeta.dart Normal file
View File

@@ -0,0 +1,114 @@
import 'package:flutter/material.dart';
class TarjetaEtaWidget extends StatelessWidget {
final String horaInicio;
final String horaFin;
final int minutosRestantes;
final String estadoCamion;
const TarjetaEtaWidget({
super.key,
required this.horaInicio,
required this.horaFin,
required this.minutosRestantes,
required this.estadoCamion,
});
Color _obtenerColorEstado() {
return estadoCamion == 'retrasado' ? Colors.amber[700]! : Colors.green[700]!;
}
String _generarMensajeAccion() {
if (estadoCamion == 'retrasado') {
return 'El servicio presenta un ligero retraso por tráfico.';
}
if (minutosRestantes <= 5) {
return '¡Saca tus residuos clasificados ahora mismo!';
}
return 'Prepara tus bolsas de residuos orgánicos e inorgánicos.';
}
@override
Widget build(BuildContext context) {
final Color colorTema = _obtenerColorEstado();
return Card(
elevation: 3,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
colorTema.withOpacity(0.05),
colorTema.withOpacity(0.12),
],
),
),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Icon(Icons.local_shipping_rounded, color: colorTema, size: 24),
const SizedBox(width: 8),
Text(
estadoCamion == 'retrasado' ? 'Estado: Demorado' : 'Ruta en Progreso',
style: TextStyle(
color: colorTema,
fontWeight: FontWeight.bold,
fontSize: 13,
),
),
const Spacer(),
Container(
width: 8,
height: 8,
decoration: BoxDecoration(color: colorTema, shape: BoxShape.circle),
),
],
),
const SizedBox(height: 12),
Text(
'Llega en aproximadamente $minutosRestantes minutos',
style: Theme.of(context).textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.bold,
color: Colors.grey[800],
),
),
const SizedBox(height: 4),
Text(
'El camión llegará a tu zona entre las $horaInicio y las $horaFin.',
style: TextStyle(fontSize: 14, color: Colors.grey[700]),
),
const Padding(
padding: EdgeInsets.symmetric(vertical: 10.0),
child: Divider(color: Colors.black),
),
Row(
children: [
Icon(Icons.info_outline_rounded, color: colorTema, size: 18),
const SizedBox(width: 6),
Expanded(
child: Text(
_generarMensajeAccion(),
style: TextStyle(
color: colorTema,
fontWeight: FontWeight.w600,
fontSize: 12,
),
),
),
],
),
],
),
),
),
);
}
}