feat: UI/UX mejorado en servicios, historial, solicitar profesional y logo

- logo.dart: path correcto assets/prosapp-logo.png + errorBuilder
- services_view.dart: rediseño con tarjetas, dark mode, avatar con inicial, badges de estado
- services_history_view.dart: mismo rediseño + badges completado/cancelado/rechazado
- request_professional_view.dart: secciones con cards, botones de upload con estado visual,
  estados pending/rejected mejorados, dark mode completo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-06-27 19:40:58 -05:00
co-authored by Claude Sonnet 4.6
parent 97d8535d54
commit 7de1bed254
4 changed files with 981 additions and 658 deletions
+10 -1
View File
@@ -24,9 +24,18 @@ class Logo extends StatelessWidget {
], ],
), ),
child: Image.asset( child: Image.asset(
'prosapp-logo.png', 'assets/prosapp-logo.png',
height: 38, height: 38,
fit: BoxFit.contain, fit: BoxFit.contain,
errorBuilder: (_, __, ___) => const Text(
'ProsApp',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Color(0xFF42A4EF),
),
),
), ),
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
+484 -370
View File
@@ -9,490 +9,604 @@ import 'package:prosapp_web_app/providers/professional_form_provider.dart';
import 'package:prosapp_web_app/providers/professional_provider.dart'; import 'package:prosapp_web_app/providers/professional_provider.dart';
import 'package:prosapp_web_app/providers/professions_provider.dart'; import 'package:prosapp_web_app/providers/professions_provider.dart';
import 'package:prosapp_web_app/providers/profile_form_provider.dart'; import 'package:prosapp_web_app/providers/profile_form_provider.dart';
import 'package:prosapp_web_app/providers/theme_provider.dart';
import 'package:prosapp_web_app/services/notifications_service.dart'; import 'package:prosapp_web_app/services/notifications_service.dart';
import 'package:prosapp_web_app/ui/cards/white_card.dart';
import 'package:prosapp_web_app/ui/inputs/custom_inputs.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:prosapp_web_app/ui/views/no_page_found_view.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class RequestProfessionalView extends StatefulWidget { class RequestProfessionalView extends StatefulWidget {
const RequestProfessionalView({super.key}); const RequestProfessionalView({super.key});
@override @override
State<RequestProfessionalView> createState() => State<RequestProfessionalView> createState() => _RequestProfessionalViewState();
_RequestProfessionalViewState();
} }
class _RequestProfessionalViewState extends State<RequestProfessionalView> { class _RequestProfessionalViewState extends State<RequestProfessionalView> {
Usuario? user;
List<Profession> professions = [];
late ProfessionalFormProvider professionalFormProvider;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
final authProvider = Provider.of<AuthProvider>(context, listen: false); final authProvider = Provider.of<AuthProvider>(context, listen: false);
final profileFormProvider = final profileFormProvider = Provider.of<ProfileFormProvider>(context, listen: false);
Provider.of<ProfileFormProvider>(context, listen: false); final professionalFormProvider = Provider.of<ProfessionalFormProvider>(context, listen: false);
professionalFormProvider = final proProvider = Provider.of<ProfessionalProvider>(context, listen: false);
Provider.of<ProfessionalFormProvider>(context, listen: false);
final professionsProvider =
Provider.of<ProfessionsProvider>(context, listen: false);
final proProvider =
Provider.of<ProfessionalProvider>(context, listen: false);
profileFormProvider.user = authProvider.user; profileFormProvider.user = authProvider.user;
proProvider.getProfessional(authProvider.user!.id).then((value) { proProvider.getProfessional(authProvider.user!.id).then((value) {
professionalFormProvider.setProfesional(value); professionalFormProvider.setProfesional(value);
}); });
setState(() {
professions = professionsProvider.professions;
user = authProvider.user;
});
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return LayoutBuilder(builder: (context, constraints) {
if (constraints.maxWidth < 900) {
return ListView( return ListView(
physics: const ClampingScrollPhysics(), padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
children: const [SizedBox(height: 10), _ProfileViewForm()], children: [
); Center(
} else { child: ConstrainedBox(
return Container( constraints: const BoxConstraints(maxWidth: 680),
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10), child: const _ProfessionalForm(),
child: ListView(
physics: const ClampingScrollPhysics(),
children: const [SizedBox(height: 10), _ProfileViewForm()],
), ),
),
],
); );
} }
});
}
} }
class _ProfileViewForm extends StatefulWidget { class _ProfessionalForm extends StatefulWidget {
const _ProfileViewForm(); const _ProfessionalForm();
@override @override
State<_ProfileViewForm> createState() => _ProfileViewFormState(); State<_ProfessionalForm> createState() => _ProfessionalFormState();
} }
class _ProfileViewFormState extends State<_ProfileViewForm> { class _ProfessionalFormState extends State<_ProfessionalForm> {
final TextEditingController _specialityController = TextEditingController(); final TextEditingController _specialityController = TextEditingController();
List<String> specializations = []; List<String> specializations = [];
void _addItemToList() { void _addSpecialization() {
final item = _specialityController.text.trim();
if (item.isNotEmpty && !specializations.contains(item)) {
setState(() { setState(() {
String newItem = _specialityController.text.trim(); specializations.add(item);
if (newItem.isNotEmpty) {
specializations.add(newItem);
_specialityController.clear(); _specialityController.clear();
}
}); });
} }
void _removeItemFromList(String item) {
setState(() {
specializations.remove(item);
});
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final isDark = context.watch<ThemeProvider>().isDark;
final authProvider = Provider.of<AuthProvider>(context); final authProvider = Provider.of<AuthProvider>(context);
final professionsProvider = Provider.of<ProfessionsProvider>(context); final professionsProvider = Provider.of<ProfessionsProvider>(context);
final professions = professionsProvider.professions;
final user = authProvider.user!; final user = authProvider.user!;
return Center( final cardBg = isDark ? const Color(0xFF1E293B) : Colors.white;
child: ConstrainedBox( final border = isDark ? const Color(0xFF334155) : const Color(0xFFE5E7EB);
constraints: const BoxConstraints(maxWidth: 900), final textPrimary = isDark ? Colors.white : const Color(0xFF111827);
child: Consumer<ProfessionalFormProvider>( final textSecondary = isDark ? const Color(0xFF94A3B8) : const Color(0xFF6B7280);
builder: (context, professionalFormProvider, child) {
if (professionalFormProvider.profesional == null) { return Consumer<ProfessionalFormProvider>(
return const Center( builder: (context, fp, _) {
if (fp.profesional == null) {
return const Center(child: Padding(
padding: EdgeInsets.all(40),
child: CircularProgressIndicator(), child: CircularProgressIndicator(),
); ));
} }
final professional = professionalFormProvider.profesional; final pro = fp.profesional!;
switch (enumToInt(user.proState)) { switch (enumToInt(user.proState)) {
// ── Estado 0: Formulario ──────────────────────────────────────────
case 0: case 0:
return WhiteCard( return Form(
title: 'Información profesional', key: fp.formKey,
child: Form( autovalidateMode: AutovalidateMode.onUserInteraction,
key: professionalFormProvider.formKey,
autovalidateMode: AutovalidateMode.always,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
const SizedBox(height: 10),
TextFormField( // Header
initialValue: professional!.identification, Container(
validator: (value) { padding: const EdgeInsets.all(20),
if (value == null || value.isEmpty) { decoration: BoxDecoration(
return 'La cedula es obligatoria'; gradient: const LinearGradient(
} colors: [Color(0xFF42A4EF), Color(0xFF1565C0)],
if (value.trim().length < 6) { begin: Alignment.topLeft,
return 'La cedula debe tener al menos 6 caracteres'; end: Alignment.bottomRight,
} ),
return null; borderRadius: BorderRadius.circular(16),
}, ),
onChanged: (value) { child: Column(
professionalFormProvider.copyProfesionalWith( children: const [
identification: value); Icon(Icons.work_outline_rounded, color: Colors.white, size: 36),
}, SizedBox(height: 10),
decoration: CustomInputs.formInputDecoration( Text('Solicitud de Profesional',
hint: 'Ingresa tu cedula', style: TextStyle(
label: 'Cedula', color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.bold,
)),
SizedBox(height: 4),
Text('Completa tu información para comenzar a ofrecer servicios',
style: TextStyle(color: Colors.white70, fontSize: 12),
textAlign: TextAlign.center),
],
),
),
const SizedBox(height: 20),
// ── Sección 1: Identificación ──
_Section(
title: 'Identificación',
icon: Icons.badge_outlined, icon: Icons.badge_outlined,
), cardBg: cardBg,
), border: border,
const SizedBox(height: 10), textPrimary: textPrimary,
children: [
TextFormField( TextFormField(
initialValue: professional!.rethusCode, initialValue: pro.identification,
onChanged: (value) { style: TextStyle(color: textPrimary),
professionalFormProvider.copyProfesionalWith( validator: (v) {
rethusCode: value); if (v == null || v.isEmpty) return 'La cédula es obligatoria';
if (v.trim().length < 6) return 'Mínimo 6 caracteres';
return null;
}, },
decoration: CustomInputs.formInputDecoration( onChanged: (v) => fp.copyProfesionalWith(identification: v),
hint: 'Código RETHUS (opcional)', decoration: _inputDec('Número de cédula', Icons.badge_outlined, isDark),
label: 'Código RETHUS', ),
const SizedBox(height: 12),
_UploadButton(
label: 'PDF de la cédula',
uploaded: pro.identificationPicture.isNotEmpty,
isDark: isDark,
onTap: () async {
final bytes = await _pickPdf();
if (bytes != null) {
NotificationsService.showBusyIndicator(context);
await fp.uploadPdfIdentification(bytes, user.id);
if (context.mounted) Navigator.pop(context);
}
},
),
],
),
const SizedBox(height: 12),
// ── Sección 2: Certificación ──
_Section(
title: 'Certificación',
icon: Icons.health_and_safety_outlined, icon: Icons.health_and_safety_outlined,
), cardBg: cardBg,
), border: border,
const SizedBox(height: 10), textPrimary: textPrimary,
ElevatedButton.icon( children: [
onPressed: () async {
try {
FilePickerResult? result =
await FilePicker.platform.pickFiles(
type: FileType.custom,
allowedExtensions: ['pdf'],
withData: true,
);
if (result != null) {
PlatformFile file = result.files.first;
Uint8List? fileBytes = file.bytes;
if (fileBytes != null) {
NotificationsService.showBusyIndicator(context);
final provider =
Provider.of<ProfessionalFormProvider>(
context,
listen: false);
await provider.uploadPdfIdentification(
fileBytes, user.id);
Navigator.pop(context);
}
}
} catch (e) {
print('debugeando $e');
}
},
icon: const Icon(Icons.upload_file),
label: const Text('Cargar pdf de la cedula'),
),
const SizedBox(height: 20),
DropdownButtonFormField(
validator: (value) {
if (value == null) {
return 'La profesión es obligatoria';
}
return null;
},
value: professional.profession == ''
? null
: professional.profession,
decoration: CustomInputs.formInputDecoration(
hint: 'Selecciona tu profesión',
label: 'Profesión',
icon: Icons.work_outline_outlined,
),
items: professions.map((Profession profession) {
return DropdownMenuItem<String>(
value: profession.name,
child: Text(profession.name),
);
}).toList(),
onChanged: (value) {
professionalFormProvider.copyProfesionalWith(
profession: value);
}),
const SizedBox(height: 10),
ElevatedButton.icon(
onPressed: () async {
try {
FilePickerResult? result =
await FilePicker.platform.pickFiles(
type: FileType.custom,
allowedExtensions: ['pdf'],
withData: true,
);
if (result != null) {
PlatformFile file = result.files.first;
Uint8List? fileBytes = file.bytes;
if (fileBytes != null) {
NotificationsService.showBusyIndicator(context);
final provider =
Provider.of<ProfessionalFormProvider>(
context,
listen: false);
await provider.uploadPdfCertificate(
fileBytes, user.id);
Navigator.pop(context);
}
}
} catch (e) {
print('debugeando $e');
}
},
icon: const Icon(Icons.upload_file),
label: const Text('Cargar pdf del certificado'),
),
const SizedBox(height: 20),
TextFormField( TextFormField(
validator: (value) { initialValue: pro.rethusCode,
if (RegExp(r'\s{2,}').hasMatch(value!)) { style: TextStyle(color: textPrimary),
return 'La especialización no es valida'; onChanged: (v) => fp.copyProfesionalWith(rethusCode: v),
decoration: _inputDec('Código RETHUS (opcional)', Icons.health_and_safety_outlined, isDark),
),
const SizedBox(height: 6),
Text('El código RETHUS es el registro del talento humano en salud de Colombia.',
style: TextStyle(fontSize: 11, color: textSecondary)),
const SizedBox(height: 12),
_UploadButton(
label: 'PDF del certificado profesional',
uploaded: pro.certificatePicture.isNotEmpty,
isDark: isDark,
onTap: () async {
final bytes = await _pickPdf();
if (bytes != null) {
NotificationsService.showBusyIndicator(context);
await fp.uploadPdfCertificate(bytes, user.id);
if (context.mounted) Navigator.pop(context);
} }
return null;
}, },
onFieldSubmitted: (_) { ),
_addItemToList(); ],
}, ),
controller: _specialityController,
decoration: CustomInputs.formInputDecoration( const SizedBox(height: 12),
hint: 'Ingresa tus especializaciones y agregalas (+)',
label: 'Especializaciones', // ── Sección 3: Profesión ──
_Section(
title: 'Profesión',
icon: Icons.work_outline_outlined,
cardBg: cardBg,
border: border,
textPrimary: textPrimary,
children: [
DropdownButtonFormField<String>(
value: pro.profession.isEmpty ? null : pro.profession,
dropdownColor: cardBg,
style: TextStyle(color: textPrimary),
validator: (v) => v == null ? 'La profesión es obligatoria' : null,
decoration: _inputDec('Selecciona tu profesión', Icons.work_outline_outlined, isDark),
items: professionsProvider.professions
.map((p) => DropdownMenuItem<String>(
value: p.name,
child: Text(p.name,
style: TextStyle(color: textPrimary)),
))
.toList(),
onChanged: (v) => fp.copyProfesionalWith(profession: v),
),
],
),
const SizedBox(height: 12),
// ── Sección 4: Especializaciones ──
_Section(
title: 'Especializaciones',
icon: Icons.assignment_outlined, icon: Icons.assignment_outlined,
iconButton: IconButton( cardBg: cardBg,
onPressed: () { border: border,
_addItemToList(); textPrimary: textPrimary,
}, children: [
icon: const Icon(Icons.add), Row(
children: [
Expanded(
child: TextFormField(
controller: _specialityController,
style: TextStyle(color: textPrimary),
onFieldSubmitted: (_) => _addSpecialization(),
decoration: _inputDec(
'Agregar especialización',
Icons.assignment_outlined,
isDark,
), ),
), ),
), ),
const SizedBox(width: 8),
Material(
color: const Color(0xFF42A4EF),
borderRadius: BorderRadius.circular(10),
child: InkWell(
onTap: _addSpecialization,
borderRadius: BorderRadius.circular(10),
child: const Padding(
padding: EdgeInsets.all(14),
child: Icon(Icons.add, color: Colors.white, size: 20),
),
),
),
],
),
if (specializations.isNotEmpty) ...[
const SizedBox(height: 10), const SizedBox(height: 10),
ElevatedButton.icon( Wrap(
onPressed: () async { spacing: 8,
try { runSpacing: 6,
FilePickerResult? result = children: specializations
await FilePicker.platform.pickFiles( .map((item) => Chip(
label: Text(item,
style: const TextStyle(
color: Color(0xFF42A4EF), fontSize: 12)),
backgroundColor:
const Color(0xFF42A4EF).withOpacity(0.1),
deleteIconColor: const Color(0xFF42A4EF),
side: const BorderSide(
color: Color(0xFF42A4EF), width: 0.5),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
onDeleted: () => setState(
() => specializations.remove(item)),
))
.toList(),
),
],
const SizedBox(height: 12),
_UploadButton(
label: 'PDFs de especializaciones (múltiples)',
uploaded: pro.specializationsPictures.isNotEmpty,
isDark: isDark,
onTap: () async {
final result = await FilePicker.platform.pickFiles(
type: FileType.custom, type: FileType.custom,
allowMultiple: true, allowMultiple: true,
allowedExtensions: ['pdf'], allowedExtensions: ['pdf'],
withData: true, withData: true,
); );
if (result != null) { if (result != null) {
List<Uint8List> filesBytes = result.files final filesBytes = result.files
.where((file) => file.bytes != null) .where((f) => f.bytes != null)
.map((file) => file.bytes!) .map((f) => f.bytes!)
.toList(); .toList();
if (filesBytes.isNotEmpty && context.mounted) {
if (filesBytes.isNotEmpty) {
NotificationsService.showBusyIndicator(context); NotificationsService.showBusyIndicator(context);
await fp.uploadPdfSpecializations(
final provider =
Provider.of<ProfessionalFormProvider>(
context,
listen: false);
await provider.uploadPdfSpecializations(
filesBytes, user.id); filesBytes, user.id);
if (context.mounted) Navigator.pop(context);
Navigator.pop(context);
} }
} }
} catch (e) {
print('debugeando $e');
}
}, },
icon: const Icon(Icons.upload_file),
label:
const Text('Cargar pdfs de las especializaciones'),
), ),
const SizedBox(height: 10),
Wrap(
spacing: 8.0,
runSpacing: 4.0,
children: specializations
.map((item) => Chip(
label: Text(item),
backgroundColor: Colors.blue.withOpacity(0.3),
labelStyle:
const TextStyle(color: Colors.blue),
deleteIconColor: Colors.blue,
onDeleted: () {
_removeItemFromList(item);
},
shape: RoundedRectangleBorder(
side: const BorderSide(
color: Colors.blue, width: 0.3),
borderRadius: BorderRadius.circular(8),
),
))
.toList(),
),
const SizedBox(height: 20),
Center(
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 180),
child: ElevatedButton(
onPressed: () async {
professionalFormProvider.copyProfesionalWith(
specializations: specializations);
final res = await professionalFormProvider
.updateProfesionalInfo(user.id);
if (res) {
Provider.of<AuthProvider>(context,
listen: false)
.refreshUser();
final profileFormProvider =
Provider.of<ProfileFormProvider>(context,
listen: false);
profileFormProvider.copyUserWith(
proState: ProState.pending);
profileFormProvider.updateUserInfoNoValid();
}
},
style: ButtonStyle(
backgroundColor: WidgetStateProperty.all(
Colors.blue.shade400,
),
shape: WidgetStateProperty.all(
const RoundedRectangleBorder(
borderRadius:
BorderRadius.all(Radius.circular(5)),
),
),
shadowColor:
WidgetStateProperty.all(Colors.transparent),
),
child: const Text(
'Enviar a revisión',
style: TextStyle(
color: Colors.white,
fontSize: 15,
),
),
),
),
),
const SizedBox(height: 15),
], ],
), ),
const SizedBox(height: 24),
// ── Botón enviar ──
SizedBox(
width: double.infinity,
child: ElevatedButton.icon(
icon: const Icon(Icons.send_rounded, size: 18),
label: const Text('Enviar a revisión',
style: TextStyle(
fontSize: 15, fontWeight: FontWeight.w600)),
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF42A4EF),
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(vertical: 16),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12)),
elevation: 0,
),
onPressed: () async {
fp.copyProfesionalWith(specializations: specializations);
final res = await fp.updateProfesionalInfo(user.id);
if (res && context.mounted) {
Provider.of<AuthProvider>(context, listen: false)
.refreshUser();
final pfp = Provider.of<ProfileFormProvider>(context,
listen: false);
pfp.copyUserWith(proState: ProState.pending);
pfp.updateUserInfoNoValid();
}
},
),
),
const SizedBox(height: 20),
],
), ),
); );
case 1:
return LayoutBuilder(
builder: (context, constraints) {
double screenWidth = constraints.maxWidth;
double baseFontSize = 18;
double responsiveFontSize =
screenWidth < 600 ? baseFontSize * 0.8 : baseFontSize;
return WhiteCard( // ── Estado 1: En revisión ─────────────────────────────────────────
case 1:
return Container(
margin: const EdgeInsets.only(top: 20),
padding: const EdgeInsets.all(32),
decoration: BoxDecoration(
color: cardBg,
borderRadius: BorderRadius.circular(16),
border: Border.all(color: border),
),
child: Column( child: Column(
children: [ children: [
const Center( const Image(image: AssetImage('assets/checklist.gif'), width: 200),
child: Image( const SizedBox(height: 20),
image: AssetImage('checklist.gif'), Text('Solicitud en revisión',
width: 320, style: TextStyle(
), fontSize: 20,
), fontWeight: FontWeight.bold,
ConstrainedBox( color: textPrimary,
constraints: const BoxConstraints(maxWidth: 1020), )),
child: Container( const SizedBox(height: 12),
margin: const EdgeInsets.symmetric(horizontal: 8), Text(
child: Text( 'Gracias por enviar tu información. Estamos revisando tus datos y te notificaremos cuando tu cuenta esté aprobada.',
'Gracias por proporcionar tu información. Actualmente, estamos revisando tus datos y una vez aprobados, podrás acceder al perfil profesional sin problemas. Te notificaremos tan pronto como tu cuenta esté lista.',
style: TextStyle(fontSize: responsiveFontSize),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), style: TextStyle(color: textSecondary, fontSize: 14, height: 1.5),
),
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
Text( Container(
'¡Gracias por tu paciencia!', padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
style: TextStyle(fontSize: responsiveFontSize), decoration: BoxDecoration(
textAlign: TextAlign.center, color: const Color(0xFFF59E0B).withOpacity(0.12),
borderRadius: BorderRadius.circular(10),
border: Border.all(color: const Color(0xFFF59E0B).withOpacity(0.4)),
),
child: const Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.hourglass_empty_rounded,
color: Color(0xFFF59E0B), size: 18),
SizedBox(width: 8),
Text('Revisión en proceso',
style: TextStyle(
color: Color(0xFFF59E0B),
fontWeight: FontWeight.w600,
fontSize: 13,
)),
],
),
), ),
const SizedBox(height: 30),
], ],
), ),
); );
},
);
// ── Estado 3: Rechazado ───────────────────────────────────────────
case 3: case 3:
return LayoutBuilder( return Container(
builder: (context, constraints) { margin: const EdgeInsets.only(top: 20),
double screenWidth = constraints.maxWidth; padding: const EdgeInsets.all(32),
double baseFontSize = 18; decoration: BoxDecoration(
double responsiveFontSize = color: cardBg,
screenWidth < 600 ? baseFontSize * 0.8 : baseFontSize; borderRadius: BorderRadius.circular(16),
border: Border.all(color: border),
return WhiteCard( ),
child: Column( child: Column(
children: [ children: [
Container( Container(
margin: const EdgeInsets.symmetric(vertical: 25), padding: const EdgeInsets.all(20),
child: const Center( decoration: BoxDecoration(
child: Icon( color: const Color(0xFFEF4444).withOpacity(0.1),
Icons.sentiment_dissatisfied_outlined, shape: BoxShape.circle,
size: 100,
color: Colors.red,
),
),
),
ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 1020),
child: Container(
margin: const EdgeInsets.only(
left: 8, right: 8, bottom: 10),
child: Text(
'Lamentablemente, tu solicitud no ha sido aceptada en esta ocasión. Por favor, revisa tus datos y vuelve a intentarlo más tarde.',
style: TextStyle(fontSize: responsiveFontSize),
textAlign: TextAlign.center,
),
), ),
child: const Icon(Icons.sentiment_dissatisfied_outlined,
size: 56, color: Color(0xFFEF4444)),
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
Text('Solicitud no aprobada',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: textPrimary,
)),
const SizedBox(height: 12),
Text( Text(
'¡Gracias por tu paciencia!', 'Tu solicitud no fue aprobada en esta ocasión. Por favor revisa tus documentos y vuelve a intentarlo.',
style: TextStyle(fontSize: responsiveFontSize),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle(color: textSecondary, fontSize: 14, height: 1.5),
), ),
const SizedBox(height: 30),
], ],
), ),
); );
default:
return const SizedBox();
}
}, },
); );
} }
return Center(child: Text('No se encontró la sección.')); Future<Uint8List?> _pickPdf() async {
// return const NoPageFoundView(); final result = await FilePicker.platform.pickFiles(
}), type: FileType.custom,
allowedExtensions: ['pdf'],
withData: true,
);
return result?.files.first.bytes;
}
InputDecoration _inputDec(String label, IconData icon, bool isDark) {
final borderColor = isDark ? const Color(0xFF334155) : const Color(0xFFD1D5DB);
final labelColor = isDark ? const Color(0xFF94A3B8) : const Color(0xFF6B7280);
return InputDecoration(
labelText: label,
labelStyle: TextStyle(color: labelColor, fontSize: 13),
hintStyle: TextStyle(color: labelColor),
prefixIcon: Icon(icon, color: const Color(0xFF42A4EF), size: 20),
filled: true,
fillColor: isDark ? const Color(0xFF0F172A) : const Color(0xFFF9FAFB),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(color: borderColor),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(color: borderColor),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: const BorderSide(color: Color(0xFF42A4EF), width: 2),
),
errorBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: const BorderSide(color: Colors.red),
),
contentPadding: const EdgeInsets.symmetric(horizontal: 14, vertical: 14),
);
}
}
// ── Helpers ──────────────────────────────────────────────────────────────────
class _Section extends StatelessWidget {
final String title;
final IconData icon;
final Color cardBg;
final Color border;
final Color textPrimary;
final List<Widget> children;
const _Section({
required this.title,
required this.icon,
required this.cardBg,
required this.border,
required this.textPrimary,
required this.children,
});
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: cardBg,
borderRadius: BorderRadius.circular(14),
border: Border.all(color: border),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Icon(icon, color: const Color(0xFF42A4EF), size: 18),
const SizedBox(width: 8),
Text(title,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: textPrimary,
)),
],
),
const SizedBox(height: 14),
...children,
],
),
);
}
}
class _UploadButton extends StatelessWidget {
final String label;
final bool uploaded;
final bool isDark;
final VoidCallback onTap;
const _UploadButton({
required this.label,
required this.uploaded,
required this.isDark,
required this.onTap,
});
@override
Widget build(BuildContext context) {
final color = uploaded ? const Color(0xFF10B981) : const Color(0xFF42A4EF);
final bg = color.withOpacity(0.08);
return InkWell(
onTap: onTap,
borderRadius: BorderRadius.circular(10),
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12),
decoration: BoxDecoration(
color: bg,
borderRadius: BorderRadius.circular(10),
border: Border.all(
color: color.withOpacity(0.4),
style: BorderStyle.solid,
),
),
child: Row(
children: [
Icon(
uploaded ? Icons.check_circle_outline : Icons.upload_file_outlined,
color: color,
size: 20,
),
const SizedBox(width: 10),
Expanded(
child: Text(
uploaded ? '$label (subido ✓)' : label,
style: TextStyle(
fontSize: 13,
color: color,
fontWeight: FontWeight.w500,
),
),
),
Icon(Icons.chevron_right, color: color.withOpacity(0.6), size: 18),
],
),
), ),
); );
} }
+179 -98
View File
@@ -3,153 +3,234 @@ import 'package:intl/intl.dart';
import 'package:prosapp_web_app/models/schedules_entity.dart'; import 'package:prosapp_web_app/models/schedules_entity.dart';
import 'package:prosapp_web_app/models/service.dart'; import 'package:prosapp_web_app/models/service.dart';
import 'package:prosapp_web_app/models/service_status.dart'; import 'package:prosapp_web_app/models/service_status.dart';
import 'package:prosapp_web_app/services/navigation_service.dart'; import 'package:prosapp_web_app/models/servicio_profesional.dart';
import 'package:prosapp_web_app/ui/labels/custom_labels.dart';
import 'package:prosapp_web_app/ui/shared/widgets/status_item.dart';
import 'package:provider/provider.dart';
import 'package:prosapp_web_app/providers/auth_provider.dart'; import 'package:prosapp_web_app/providers/auth_provider.dart';
import 'package:prosapp_web_app/providers/services_provider.dart'; import 'package:prosapp_web_app/providers/services_provider.dart';
import 'package:prosapp_web_app/providers/theme_provider.dart';
import 'package:prosapp_web_app/ui/cards/white_card.dart'; import 'package:prosapp_web_app/services/navigation_service.dart';
import 'package:provider/provider.dart';
class ServicesHistoryView extends StatelessWidget { class ServicesHistoryView extends StatelessWidget {
final String type; final String type;
const ServicesHistoryView({super.key, required this.type}); const ServicesHistoryView({super.key, required this.type});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final servicesProvider = final servicesProvider = Provider.of<ServicesProvider>(context, listen: false);
Provider.of<ServicesProvider>(context, listen: false); final userId = Provider.of<AuthProvider>(context, listen: false).user!.id;
if (type == 'user') { if (type == 'user') servicesProvider.getServicesHistoryForUser(userId);
servicesProvider.getServicesHistoryForUser( if (type == 'professional') servicesProvider.getServicesHistoryForProfessional(userId);
Provider.of<AuthProvider>(context, listen: false).user!.id);
} final isDark = context.watch<ThemeProvider>().isDark;
if (type == 'professional') { final textSecondary = isDark ? const Color(0xFF94A3B8) : const Color(0xFF6B7280);
servicesProvider.getServicesHistoryForProfessional(
Provider.of<AuthProvider>(context, listen: false).user!.id);
}
return Center( return Center(
child: ConstrainedBox( child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 900), constraints: const BoxConstraints(maxWidth: 900),
child: Consumer<ServicesProvider>( child: Consumer<ServicesProvider>(
builder: (context, servicesProvider, child) { builder: (context, sp, _) {
if (servicesProvider.isLoading) { if (sp.isLoading) {
return const Center( return const Center(child: CircularProgressIndicator());
child: CircularProgressIndicator(),
);
} }
if (sp.services.isEmpty) {
if (servicesProvider.services.isEmpty) { return Center(
return ListView( child: Column(
children: const [ mainAxisAlignment: MainAxisAlignment.center,
WhiteCard( children: [
child: Center(child: Text('No hay servicios disponibles.')), Icon(Icons.history_outlined, size: 64,
), color: textSecondary.withOpacity(0.5)),
const SizedBox(height: 16),
Text('Sin historial',
style: TextStyle(
fontSize: 17,
fontWeight: FontWeight.w600,
color: isDark ? Colors.white : const Color(0xFF111827),
)),
const SizedBox(height: 6),
Text('Los servicios completados o cancelados aparecerán aquí.',
style: TextStyle(fontSize: 13, color: textSecondary)),
], ],
),
); );
} }
return ListView.builder( return ListView.builder(
itemCount: servicesProvider.services.length, padding: const EdgeInsets.symmetric(vertical: 8),
itemBuilder: (context, index) { itemCount: sp.services.length,
final data = servicesProvider.services[index]; itemBuilder: (context, i) {
final data = sp.services[i];
final image = return _HistoryCard(
(data.user.picture == '' || data.user.picture == null) data: data,
? const Image(image: AssetImage('no-image.jpg')) isDark: isDark,
: FadeInImage.assetNetwork( onTap: () => NavigationService.replaceTo(
placeholder: 'loader.gif', '/dashboard/$type/service/${data.service.id}'),
fit: BoxFit.cover,
image: data.user.picture!,
); );
return Container(
margin: const EdgeInsets.only(bottom: 10),
child: MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
onTap: () {
NavigationService.replaceTo(
'/dashboard/$type/service/${data.service.id}');
}, },
child: WhiteCard( );
},
),
),
);
}
}
class _HistoryCard extends StatelessWidget {
final ServicioProfesional data;
final bool isDark;
final VoidCallback onTap;
const _HistoryCard({
required this.data,
required this.isDark,
required this.onTap,
});
@override
Widget build(BuildContext context) {
final cardBg = isDark ? const Color(0xFF1E293B) : Colors.white;
final border = isDark ? const Color(0xFF334155) : const Color(0xFFE5E7EB);
final textPrimary = isDark ? Colors.white : const Color(0xFF111827);
final textSecondary = isDark ? const Color(0xFF94A3B8) : const Color(0xFF6B7280);
final hasPic = data.user.picture != null && data.user.picture!.isNotEmpty;
final day = DateTime.tryParse(data.service.day);
final dateStr = day != null
? DateFormat('dd MMM yyyy', 'es').format(day)
: data.service.day;
final timeStr = ScheduleEntity.getFormatTime(data.service.range1Hour1) ?? '';
Widget statusBadge;
if (data.service.status == ServiceStatus.completed) {
statusBadge = _Badge(label: 'Completado', color: const Color(0xFF3B82F6));
} else if (data.service.status == ServiceStatus.cancelled) {
statusBadge = _Badge(label: 'Cancelado', color: const Color(0xFFEF4444));
} else if (data.service.status == ServiceStatus.denied) {
statusBadge = _Badge(label: 'Rechazado', color: const Color(0xFFEF4444));
} else {
statusBadge = const SizedBox();
}
return Padding(
padding: const EdgeInsets.only(bottom: 10),
child: Material(
color: cardBg,
borderRadius: BorderRadius.circular(14),
child: InkWell(
onTap: onTap,
borderRadius: BorderRadius.circular(14),
child: Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(14),
border: Border.all(color: border),
),
child: Row( child: Row(
children: [ children: [
Padding( Container(
padding: const EdgeInsets.only(left: 10), width: 52,
child: SizedBox( height: 52,
width: 80, decoration: BoxDecoration(
height: 80, shape: BoxShape.circle,
color: const Color(0xFF42A4EF).withOpacity(0.12),
),
child: ClipOval( child: ClipOval(
child: image, child: hasPic
? FadeInImage.assetNetwork(
placeholder: 'loader.gif',
image: data.user.picture!,
fit: BoxFit.cover,
)
: Center(
child: Text(
data.user.name.isNotEmpty
? data.user.name[0].toUpperCase()
: '?',
style: const TextStyle(
color: Color(0xFF42A4EF),
fontSize: 20,
fontWeight: FontWeight.bold,
), ),
), ),
), ),
const SizedBox(width: 20), ),
),
const SizedBox(width: 14),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Text( Text(data.user.name,
data.user.name, style: TextStyle(
style: CustomLabels.h2, fontSize: 14,
), fontWeight: FontWeight.w600,
if (data.service.description != '') color: textPrimary,
Text( )),
'"${data.service.description}"', if (data.service.address.isNotEmpty) ...[
style: CustomLabels.h5, const SizedBox(height: 3),
Row(children: [
Icon(Icons.location_on_outlined,
size: 12, color: textSecondary),
const SizedBox(width: 3),
Expanded(
child: Text(data.service.address,
style: TextStyle(
fontSize: 11, color: textSecondary),
maxLines: 1,
overflow: TextOverflow.ellipsis),
), ),
]),
],
const SizedBox(height: 5),
Row(children: [
Icon(Icons.calendar_today_outlined,
size: 12, color: textSecondary),
const SizedBox(width: 4),
Text('$timeStr · $dateStr',
style: TextStyle(
fontSize: 11, color: textSecondary)),
]),
], ],
), ),
), ),
Padding( const SizedBox(width: 10),
padding: const EdgeInsets.only(right: 10), Column(
child: Column(
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
Text( statusBadge,
'${ScheduleEntity.getFormatTime(data.service.range1Hour1)} - ${DateFormat('dd MMMM yyyy', 'es').format(DateTime.parse(data.service.day))}', const SizedBox(height: 8),
style: const TextStyle( Icon(Icons.chevron_right, color: textSecondary, size: 18),
color: Colors.black54, fontSize: 16),
),
Padding(
padding: const EdgeInsets.symmetric(
vertical: 10),
child: customStatus(data.service),
),
], ],
), ),
),
], ],
), ),
), ),
), ),
), ),
); );
},
);
},
),
),
);
} }
} }
Widget customStatus(Service service) { class _Badge extends StatelessWidget {
if (service.status == ServiceStatus.completed) { final String label;
return const StatusItem(text: 'Completado', color: Colors.blueAccent); final Color color;
} const _Badge({required this.label, required this.color});
if (service.status == ServiceStatus.cancelled) {
return const StatusItem(text: 'Cancelado', color: Colors.red);
}
if (service.status == ServiceStatus.denied) {
return const StatusItem(text: 'Rechazado', color: Colors.red);
}
return const SizedBox(); @override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
decoration: BoxDecoration(
color: color.withOpacity(0.12),
borderRadius: BorderRadius.circular(20),
border: Border.all(color: color.withOpacity(0.4)),
),
child: Text(label,
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
color: color,
)),
);
}
} }
+217 -98
View File
@@ -3,153 +3,272 @@ import 'package:intl/intl.dart';
import 'package:prosapp_web_app/models/schedules_entity.dart'; import 'package:prosapp_web_app/models/schedules_entity.dart';
import 'package:prosapp_web_app/models/service.dart'; import 'package:prosapp_web_app/models/service.dart';
import 'package:prosapp_web_app/models/service_status.dart'; import 'package:prosapp_web_app/models/service_status.dart';
import 'package:prosapp_web_app/services/navigation_service.dart'; import 'package:prosapp_web_app/models/servicio_profesional.dart';
import 'package:prosapp_web_app/ui/labels/custom_labels.dart';
import 'package:prosapp_web_app/ui/shared/widgets/status_item.dart';
import 'package:provider/provider.dart';
import 'package:prosapp_web_app/providers/auth_provider.dart'; import 'package:prosapp_web_app/providers/auth_provider.dart';
import 'package:prosapp_web_app/providers/services_provider.dart'; import 'package:prosapp_web_app/providers/services_provider.dart';
import 'package:prosapp_web_app/providers/theme_provider.dart';
import 'package:prosapp_web_app/ui/cards/white_card.dart'; import 'package:prosapp_web_app/services/navigation_service.dart';
import 'package:provider/provider.dart';
class ServicesView extends StatelessWidget { class ServicesView extends StatelessWidget {
final String type; final String type;
const ServicesView({super.key, required this.type}); const ServicesView({super.key, required this.type});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final servicesProvider = final servicesProvider = Provider.of<ServicesProvider>(context, listen: false);
Provider.of<ServicesProvider>(context, listen: false); final userId = Provider.of<AuthProvider>(context, listen: false).user!.id;
if (type == 'user') { if (type == 'user') servicesProvider.getServicesForUser(userId);
servicesProvider.getServicesForUser( if (type == 'professional') servicesProvider.getServicesForProfessional(userId);
Provider.of<AuthProvider>(context, listen: false).user!.id);
} final isDark = context.watch<ThemeProvider>().isDark;
if (type == 'professional') {
servicesProvider.getServicesForProfessional(
Provider.of<AuthProvider>(context, listen: false).user!.id);
}
return Center( return Center(
child: ConstrainedBox( child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 900), constraints: const BoxConstraints(maxWidth: 900),
child: Consumer<ServicesProvider>( child: Consumer<ServicesProvider>(
builder: (context, servicesProvider, child) { builder: (context, sp, _) {
if (servicesProvider.isLoading) { if (sp.isLoading) {
return const Center( return const Center(child: CircularProgressIndicator());
child: CircularProgressIndicator(), }
if (sp.services.isEmpty) {
return _EmptyState(
isDark: isDark,
icon: Icons.room_service_outlined,
title: 'Sin servicios activos',
subtitle: 'Aquí verás tus servicios en curso.',
); );
} }
if (servicesProvider.services.isEmpty) {
return ListView(
children: const [
WhiteCard(
child: Center(child: Text('No hay servicios disponibles.')),
),
],
);
}
return ListView.builder( return ListView.builder(
itemCount: servicesProvider.services.length, padding: const EdgeInsets.symmetric(vertical: 8),
itemBuilder: (context, index) { itemCount: sp.services.length,
final data = servicesProvider.services[index]; itemBuilder: (context, i) {
final data = sp.services[i];
final image = return _ServiceCard(
(data.user.picture == '' || data.user.picture == null) data: data,
? const Image(image: AssetImage('no-image.jpg')) isDark: isDark,
: FadeInImage.assetNetwork( onTap: () => NavigationService.replaceTo(
placeholder: 'loader.gif', '/dashboard/$type/service/${data.service.id}'),
fit: BoxFit.cover, statusWidget: _activeStatus(data.service, isDark),
image: data.user.picture!,
); );
return Container(
margin: const EdgeInsets.only(bottom: 10),
child: MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
onTap: () {
NavigationService.replaceTo(
'/dashboard/$type/service/${data.service.id}');
}, },
child: WhiteCard( );
},
),
),
);
}
Widget _activeStatus(Service service, bool isDark) {
switch (service.status) {
case ServiceStatus.pending:
return _StatusBadge(label: 'Pendiente', color: const Color(0xFFF59E0B));
case ServiceStatus.acepted:
return _StatusBadge(label: 'Aceptado', color: const Color(0xFF10B981));
case ServiceStatus.active:
return _StatusBadge(label: 'En curso', color: const Color(0xFF3B82F6));
default:
return const SizedBox();
}
}
}
// ── Shared widgets ────────────────────────────────────────────────────────────
class _ServiceCard extends StatelessWidget {
final ServicioProfesional data;
final bool isDark;
final VoidCallback onTap;
final Widget statusWidget;
const _ServiceCard({
required this.data,
required this.isDark,
required this.onTap,
required this.statusWidget,
});
@override
Widget build(BuildContext context) {
final cardBg = isDark ? const Color(0xFF1E293B) : Colors.white;
final border = isDark ? const Color(0xFF334155) : const Color(0xFFE5E7EB);
final textPrimary = isDark ? Colors.white : const Color(0xFF111827);
final textSecondary = isDark ? const Color(0xFF94A3B8) : const Color(0xFF6B7280);
final hasPic = data.user.picture != null && data.user.picture!.isNotEmpty;
final day = DateTime.tryParse(data.service.day);
final dateStr = day != null
? DateFormat('dd MMM yyyy', 'es').format(day)
: data.service.day;
final timeStr = ScheduleEntity.getFormatTime(data.service.range1Hour1) ?? '';
return Padding(
padding: const EdgeInsets.only(bottom: 10),
child: Material(
color: cardBg,
borderRadius: BorderRadius.circular(14),
child: InkWell(
onTap: onTap,
borderRadius: BorderRadius.circular(14),
child: Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(14),
border: Border.all(color: border),
),
child: Row( child: Row(
children: [ children: [
Padding( // Avatar
padding: const EdgeInsets.only(left: 10), Container(
child: SizedBox( width: 56,
width: 80, height: 56,
height: 80, decoration: BoxDecoration(
shape: BoxShape.circle,
color: const Color(0xFF42A4EF).withOpacity(0.15),
),
child: ClipOval( child: ClipOval(
child: image, child: hasPic
? FadeInImage.assetNetwork(
placeholder: 'loader.gif',
image: data.user.picture!,
fit: BoxFit.cover,
)
: Center(
child: Text(
data.user.name.isNotEmpty
? data.user.name[0].toUpperCase()
: '?',
style: const TextStyle(
color: Color(0xFF42A4EF),
fontSize: 22,
fontWeight: FontWeight.bold,
), ),
), ),
), ),
const SizedBox(width: 20), ),
),
const SizedBox(width: 14),
// Info
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Text( Text(data.user.name,
data.user.name, style: TextStyle(
style: CustomLabels.h2, fontSize: 15,
fontWeight: FontWeight.w600,
color: textPrimary,
)),
if (data.service.address.isNotEmpty) ...[
const SizedBox(height: 3),
Row(
children: [
Icon(Icons.location_on_outlined,
size: 13, color: textSecondary),
const SizedBox(width: 3),
Expanded(
child: Text(
data.service.address,
style:
TextStyle(fontSize: 12, color: textSecondary),
maxLines: 1,
overflow: TextOverflow.ellipsis,
), ),
if (data.service.description != '') ),
Text( ],
'"${data.service.description}"', ),
style: CustomLabels.h5, ],
const SizedBox(height: 6),
Row(
children: [
Icon(Icons.calendar_today_outlined,
size: 13, color: textSecondary),
const SizedBox(width: 4),
Text('$timeStr · $dateStr',
style: TextStyle(fontSize: 12, color: textSecondary)),
],
), ),
], ],
), ),
), ),
Padding( const SizedBox(width: 10),
padding: const EdgeInsets.only(right: 10), // Status + arrow
child: Column( Column(
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
Text( statusWidget,
'${ScheduleEntity.getFormatTime(data.service.range1Hour1)} - ${DateFormat('dd MMMM yyyy', 'es').format(DateTime.parse(data.service.day))}', const SizedBox(height: 8),
style: const TextStyle( Icon(Icons.chevron_right, color: textSecondary, size: 18),
color: Colors.black54, fontSize: 16),
),
Padding(
padding: const EdgeInsets.symmetric(
vertical: 10),
child: customStatus(data.service),
),
], ],
), ),
),
], ],
), ),
), ),
), ),
), ),
); );
}, }
); }
},
), class _StatusBadge extends StatelessWidget {
final String label;
final Color color;
const _StatusBadge({required this.label, required this.color});
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
decoration: BoxDecoration(
color: color.withOpacity(0.12),
borderRadius: BorderRadius.circular(20),
border: Border.all(color: color.withOpacity(0.4)),
), ),
child: Text(label,
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
color: color,
)),
); );
} }
} }
Widget customStatus(Service service) { class _EmptyState extends StatelessWidget {
if (service.status == ServiceStatus.pending) { final bool isDark;
return const StatusItem(text: 'Pendiente', color: Colors.black54); final IconData icon;
} final String title;
if (service.status == ServiceStatus.acepted) { final String subtitle;
return const StatusItem(text: 'Aceptado', color: Colors.green);
}
if (service.status == ServiceStatus.active) {
return const StatusItem(text: 'Activo', color: Colors.blueAccent);
}
return const SizedBox(); const _EmptyState({
required this.isDark,
required this.icon,
required this.title,
required this.subtitle,
});
@override
Widget build(BuildContext context) {
final textPrimary = isDark ? Colors.white : const Color(0xFF111827);
final textSecondary = isDark ? const Color(0xFF94A3B8) : const Color(0xFF6B7280);
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(icon, size: 64, color: textSecondary.withOpacity(0.5)),
const SizedBox(height: 16),
Text(title,
style: TextStyle(
fontSize: 17,
fontWeight: FontWeight.w600,
color: textPrimary)),
const SizedBox(height: 6),
Text(subtitle,
style: TextStyle(fontSize: 13, color: textSecondary)),
],
),
);
}
} }