Fix dark/light theme support in redesigned views
Replace hardcoded colors with Theme.of(context) values via BuildContext extension (_Th): bg, card, onSurface, muted, subtle, divider, shadow, inputFill, chipBg. Affects: professional_profile_view, professional_ calendar_view, services_requests_view. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
142e3ffafd
commit
2d5ff1581b
@@ -12,12 +12,21 @@ import 'package:table_calendar/table_calendar.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
const _kPrimary = Color(0xFF1565C0);
|
const _kPrimary = Color(0xFF1565C0);
|
||||||
const _kAccent = Color(0xFF42A4EF);
|
|
||||||
const _kBg = Color(0xFFF4F6FA);
|
|
||||||
const _kCard = Colors.white;
|
|
||||||
const _kAvailable = Color(0xFF16A34A);
|
const _kAvailable = Color(0xFF16A34A);
|
||||||
const _kOccupied = Color(0xFFDC2626);
|
const _kOccupied = Color(0xFFDC2626);
|
||||||
|
|
||||||
|
extension _Th on BuildContext {
|
||||||
|
ThemeData get _t => Theme.of(this);
|
||||||
|
Color get bg => _t.scaffoldBackgroundColor;
|
||||||
|
Color get card => _t.cardColor;
|
||||||
|
Color get onSurface => _t.colorScheme.onSurface;
|
||||||
|
Color get muted => _t.colorScheme.onSurface.withOpacity(0.55);
|
||||||
|
Color get subtle => _t.colorScheme.onSurface.withOpacity(0.35);
|
||||||
|
bool get isDark => _t.brightness == Brightness.dark;
|
||||||
|
Color get shadow => isDark ? Colors.transparent : Colors.black.withOpacity(0.07);
|
||||||
|
Color get shadowSm => isDark ? Colors.transparent : Colors.black.withOpacity(0.04);
|
||||||
|
}
|
||||||
|
|
||||||
class ProfessionalCalendarView extends StatefulWidget {
|
class ProfessionalCalendarView extends StatefulWidget {
|
||||||
const ProfessionalCalendarView({super.key});
|
const ProfessionalCalendarView({super.key});
|
||||||
|
|
||||||
@@ -26,8 +35,7 @@ class ProfessionalCalendarView extends StatefulWidget {
|
|||||||
_ProfessionalCalendarViewState();
|
_ProfessionalCalendarViewState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ProfessionalCalendarViewState
|
class _ProfessionalCalendarViewState extends State<ProfessionalCalendarView> {
|
||||||
extends State<ProfessionalCalendarView> {
|
|
||||||
DateTime _selected = DateTime.now();
|
DateTime _selected = DateTime.now();
|
||||||
List<Service>? _services;
|
List<Service>? _services;
|
||||||
bool _loading = true;
|
bool _loading = true;
|
||||||
@@ -56,31 +64,27 @@ class _ProfessionalCalendarViewState
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
color: _kBg,
|
color: context.bg,
|
||||||
child: Consumer<ProfessionalFormProvider>(
|
child: Consumer<ProfessionalFormProvider>(
|
||||||
builder: (context, fp, _) {
|
builder: (context, fp, _) {
|
||||||
if (fp.profesional == null || _loading) {
|
if (fp.profesional == null || _loading) {
|
||||||
return const Center(
|
return const Center(child: CircularProgressIndicator(color: _kPrimary));
|
||||||
child: CircularProgressIndicator(color: _kPrimary),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
final pro = fp.profesional!;
|
final pro = fp.profesional!;
|
||||||
final schedule = _scheduleFor(_selected.weekday, pro);
|
final schedule = _scheduleFor(_selected.weekday, pro);
|
||||||
final slots = _buildSlots(schedule);
|
final slots = _buildSlots(schedule);
|
||||||
final occupied = slots
|
final occupied = slots.where((t) => _isOccupied(t, _services, _selected)).length;
|
||||||
.where((t) => _isOccupied(t, _services, _selected))
|
|
||||||
.length;
|
|
||||||
|
|
||||||
return ListView(
|
return ListView(
|
||||||
physics: const ClampingScrollPhysics(),
|
physics: const ClampingScrollPhysics(),
|
||||||
padding: const EdgeInsets.only(bottom: 32),
|
padding: const EdgeInsets.only(bottom: 32),
|
||||||
children: [
|
children: [
|
||||||
_calendarCard(),
|
_calendarCard(context),
|
||||||
_dayHeader(schedule, slots.length, occupied),
|
_dayHeader(context, schedule, slots.length, occupied),
|
||||||
if (slots.isEmpty)
|
if (slots.isEmpty)
|
||||||
_emptyState()
|
_emptyState(context)
|
||||||
else
|
else
|
||||||
..._slotCards(slots, schedule),
|
..._slotCards(context, slots),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -88,24 +92,16 @@ class _ProfessionalCalendarViewState
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Calendar card ─────────────────────────────────────────────────────────
|
Widget _calendarCard(BuildContext context) {
|
||||||
|
|
||||||
Widget _calendarCard() {
|
|
||||||
return Center(
|
return Center(
|
||||||
child: ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
constraints: const BoxConstraints(maxWidth: 720),
|
constraints: const BoxConstraints(maxWidth: 720),
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: const EdgeInsets.fromLTRB(16, 20, 16, 0),
|
margin: const EdgeInsets.fromLTRB(16, 20, 16, 0),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: _kCard,
|
color: context.card,
|
||||||
borderRadius: BorderRadius.circular(16),
|
borderRadius: BorderRadius.circular(16),
|
||||||
boxShadow: [
|
boxShadow: [BoxShadow(color: context.shadow, blurRadius: 16, offset: const Offset(0, 4))],
|
||||||
BoxShadow(
|
|
||||||
color: Colors.black.withOpacity(0.07),
|
|
||||||
blurRadius: 16,
|
|
||||||
offset: const Offset(0, 4),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(16),
|
borderRadius: BorderRadius.circular(16),
|
||||||
@@ -119,48 +115,25 @@ class _ProfessionalCalendarViewState
|
|||||||
selectedDayPredicate: (d) => isSameDay(d, _selected),
|
selectedDayPredicate: (d) => isSameDay(d, _selected),
|
||||||
calendarStyle: CalendarStyle(
|
calendarStyle: CalendarStyle(
|
||||||
todayDecoration: BoxDecoration(
|
todayDecoration: BoxDecoration(
|
||||||
border: Border.all(color: _kPrimary, width: 2),
|
border: Border.all(color: _kPrimary, width: 2), shape: BoxShape.circle),
|
||||||
shape: BoxShape.circle,
|
todayTextStyle: const TextStyle(color: _kPrimary, fontWeight: FontWeight.w700),
|
||||||
),
|
selectedDecoration: const BoxDecoration(color: _kPrimary, shape: BoxShape.circle),
|
||||||
todayTextStyle: const TextStyle(
|
selectedTextStyle: const TextStyle(color: Colors.white, fontWeight: FontWeight.w700),
|
||||||
color: _kPrimary,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
),
|
|
||||||
selectedDecoration: const BoxDecoration(
|
|
||||||
color: _kPrimary,
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
),
|
|
||||||
selectedTextStyle: const TextStyle(
|
|
||||||
color: Colors.white,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
),
|
|
||||||
weekendTextStyle: TextStyle(color: Colors.red.shade400),
|
weekendTextStyle: TextStyle(color: Colors.red.shade400),
|
||||||
|
defaultTextStyle: TextStyle(color: context.onSurface),
|
||||||
outsideDaysVisible: false,
|
outsideDaysVisible: false,
|
||||||
),
|
),
|
||||||
headerStyle: const HeaderStyle(
|
headerStyle: HeaderStyle(
|
||||||
formatButtonVisible: false,
|
formatButtonVisible: false,
|
||||||
titleCentered: true,
|
titleCentered: true,
|
||||||
titleTextStyle: TextStyle(
|
titleTextStyle: TextStyle(
|
||||||
fontSize: 15,
|
fontSize: 15, fontWeight: FontWeight.w700, color: context.onSurface),
|
||||||
fontWeight: FontWeight.w700,
|
leftChevronIcon: const Icon(Icons.chevron_left, color: _kPrimary),
|
||||||
color: Color(0xFF1E293B),
|
rightChevronIcon: const Icon(Icons.chevron_right, color: _kPrimary),
|
||||||
),
|
|
||||||
leftChevronIcon:
|
|
||||||
Icon(Icons.chevron_left, color: _kPrimary),
|
|
||||||
rightChevronIcon:
|
|
||||||
Icon(Icons.chevron_right, color: _kPrimary),
|
|
||||||
),
|
),
|
||||||
daysOfWeekStyle: const DaysOfWeekStyle(
|
daysOfWeekStyle: DaysOfWeekStyle(
|
||||||
weekdayStyle: TextStyle(
|
weekdayStyle: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: context.muted),
|
||||||
fontSize: 12,
|
weekendStyle: const TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xFFEF4444)),
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
color: Color(0xFF64748B),
|
|
||||||
),
|
|
||||||
weekendStyle: TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
color: Color(0xFFEF4444),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -169,10 +142,7 @@ class _ProfessionalCalendarViewState
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Day header + stats ────────────────────────────────────────────────────
|
Widget _dayHeader(BuildContext context, ScheduleEntity? schedule, int total, int occupied) {
|
||||||
|
|
||||||
Widget _dayHeader(
|
|
||||||
ScheduleEntity? schedule, int total, int occupied) {
|
|
||||||
final dayName = DateFormat('EEEE', 'es').format(_selected);
|
final dayName = DateFormat('EEEE', 'es').format(_selected);
|
||||||
final dateStr = DateFormat('d MMMM yyyy', 'es').format(_selected);
|
final dateStr = DateFormat('d MMMM yyyy', 'es').format(_selected);
|
||||||
final available = total - occupied;
|
final available = total - occupied;
|
||||||
@@ -185,98 +155,43 @@ class _ProfessionalCalendarViewState
|
|||||||
margin: const EdgeInsets.fromLTRB(16, 12, 16, 0),
|
margin: const EdgeInsets.fromLTRB(16, 12, 16, 0),
|
||||||
padding: const EdgeInsets.fromLTRB(16, 14, 16, 14),
|
padding: const EdgeInsets.fromLTRB(16, 14, 16, 14),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: _kCard,
|
color: context.card,
|
||||||
borderRadius: BorderRadius.circular(16),
|
borderRadius: BorderRadius.circular(16),
|
||||||
boxShadow: [
|
boxShadow: [BoxShadow(color: context.shadowSm, blurRadius: 12, offset: const Offset(0, 2))],
|
||||||
BoxShadow(
|
|
||||||
color: Colors.black.withOpacity(0.05),
|
|
||||||
blurRadius: 12,
|
|
||||||
offset: const Offset(0, 2),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(children: [
|
||||||
children: [
|
Container(
|
||||||
// Date block
|
width: 48, height: 52,
|
||||||
Container(
|
decoration: BoxDecoration(color: _kPrimary, borderRadius: BorderRadius.circular(12)),
|
||||||
width: 48,
|
child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||||
height: 52,
|
Text(DateFormat('d').format(_selected),
|
||||||
decoration: BoxDecoration(
|
style: const TextStyle(color: Colors.white, fontSize: 20, fontWeight: FontWeight.w800, height: 1)),
|
||||||
color: _kPrimary,
|
Text(DateFormat('MMM', 'es').format(_selected).toUpperCase(),
|
||||||
borderRadius: BorderRadius.circular(12),
|
style: const TextStyle(color: Colors.white70, fontSize: 10, fontWeight: FontWeight.w600)),
|
||||||
),
|
]),
|
||||||
child: Column(
|
),
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
const SizedBox(width: 14),
|
||||||
children: [
|
Expanded(child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||||
Text(
|
Text(_capitalize(dayName),
|
||||||
DateFormat('d').format(_selected),
|
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w700, color: context.onSurface)),
|
||||||
style: const TextStyle(
|
Text(dateStr, style: TextStyle(fontSize: 12, color: context.subtle)),
|
||||||
color: Colors.white,
|
])),
|
||||||
fontSize: 20,
|
if (hasSchedule && total > 0) ...[
|
||||||
fontWeight: FontWeight.w800,
|
_StatPill(label: '$occupied', sublabel: 'ocupadas', color: _kOccupied),
|
||||||
height: 1,
|
const SizedBox(width: 8),
|
||||||
),
|
_StatPill(label: '$available', sublabel: 'libres', color: _kAvailable),
|
||||||
),
|
|
||||||
Text(
|
|
||||||
DateFormat('MMM', 'es').format(_selected).toUpperCase(),
|
|
||||||
style: const TextStyle(
|
|
||||||
color: Colors.white70,
|
|
||||||
fontSize: 10,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 14),
|
|
||||||
Expanded(
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
_capitalize(dayName),
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
color: Color(0xFF1E293B),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
dateStr,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
color: Color(0xFF94A3B8),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (hasSchedule && total > 0) ...[
|
|
||||||
_StatPill(
|
|
||||||
label: '$occupied',
|
|
||||||
sublabel: 'ocupadas',
|
|
||||||
color: _kOccupied,
|
|
||||||
),
|
|
||||||
const SizedBox(width: 8),
|
|
||||||
_StatPill(
|
|
||||||
label: '$available',
|
|
||||||
sublabel: 'libres',
|
|
||||||
color: _kAvailable,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
),
|
]),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Slot cards ────────────────────────────────────────────────────────────
|
List<Widget> _slotCards(BuildContext context, List<TimeOfDay> slots) {
|
||||||
|
|
||||||
List<Widget> _slotCards(List<TimeOfDay> slots, ScheduleEntity? schedule) {
|
|
||||||
return slots.map((time) {
|
return slots.map((time) {
|
||||||
final occupied = _isOccupied(time, _services, _selected);
|
final occ = _isOccupied(time, _services, _selected);
|
||||||
final matchService = occupied ? _serviceFor(time, _services, _selected) : null;
|
final matchService = occ ? _serviceFor(time, _services, _selected) : null;
|
||||||
|
final color = occ ? _kOccupied : _kAvailable;
|
||||||
|
|
||||||
return Center(
|
return Center(
|
||||||
child: ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
@@ -284,114 +199,54 @@ class _ProfessionalCalendarViewState
|
|||||||
child: Container(
|
child: Container(
|
||||||
margin: const EdgeInsets.fromLTRB(16, 8, 16, 0),
|
margin: const EdgeInsets.fromLTRB(16, 8, 16, 0),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: _kCard,
|
color: context.card,
|
||||||
borderRadius: BorderRadius.circular(14),
|
borderRadius: BorderRadius.circular(14),
|
||||||
boxShadow: [
|
boxShadow: [BoxShadow(color: context.shadowSm, blurRadius: 8, offset: const Offset(0, 2))],
|
||||||
BoxShadow(
|
|
||||||
color: Colors.black.withOpacity(0.04),
|
|
||||||
blurRadius: 8,
|
|
||||||
offset: const Offset(0, 2),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(14),
|
borderRadius: BorderRadius.circular(14),
|
||||||
child: IntrinsicHeight(
|
child: IntrinsicHeight(
|
||||||
child: Row(
|
child: Row(children: [
|
||||||
children: [
|
Container(width: 4, color: color),
|
||||||
// Color accent strip
|
Expanded(
|
||||||
Container(
|
child: Padding(
|
||||||
width: 4,
|
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12),
|
||||||
color: occupied ? _kOccupied : _kAvailable,
|
child: Row(children: [
|
||||||
),
|
Container(
|
||||||
Expanded(
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||||
child: Padding(
|
decoration: BoxDecoration(
|
||||||
padding: const EdgeInsets.symmetric(
|
color: color.withOpacity(0.08), borderRadius: BorderRadius.circular(8)),
|
||||||
horizontal: 14, vertical: 12),
|
child: Text(ScheduleEntity.getFormatTime(time) ?? '',
|
||||||
child: Row(
|
style: TextStyle(fontSize: 15, fontWeight: FontWeight.w800, color: color)),
|
||||||
children: [
|
|
||||||
// Time badge
|
|
||||||
Container(
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 12, vertical: 6),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: (occupied ? _kOccupied : _kAvailable)
|
|
||||||
.withOpacity(0.08),
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
ScheduleEntity.getFormatTime(time) ?? '',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.w800,
|
|
||||||
color:
|
|
||||||
occupied ? _kOccupied : _kAvailable,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 14),
|
|
||||||
Expanded(
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
mainAxisAlignment:
|
|
||||||
MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
occupied ? 'Ocupado' : 'Disponible',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 14,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
color: occupied
|
|
||||||
? _kOccupied
|
|
||||||
: _kAvailable,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (matchService != null &&
|
|
||||||
matchService.description.isNotEmpty)
|
|
||||||
Text(
|
|
||||||
matchService.description,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
color: Color(0xFF64748B),
|
|
||||||
),
|
|
||||||
maxLines: 1,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
)
|
|
||||||
else if (!occupied)
|
|
||||||
const Text(
|
|
||||||
'Horario libre para nuevas citas',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 11,
|
|
||||||
color: Color(0xFF94A3B8),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
// Status icon
|
|
||||||
Container(
|
|
||||||
width: 32,
|
|
||||||
height: 32,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: (occupied ? _kOccupied : _kAvailable)
|
|
||||||
.withOpacity(0.1),
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
),
|
|
||||||
child: Icon(
|
|
||||||
occupied
|
|
||||||
? Icons.event_busy_outlined
|
|
||||||
: Icons.event_available_outlined,
|
|
||||||
size: 17,
|
|
||||||
color:
|
|
||||||
occupied ? _kOccupied : _kAvailable,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(width: 14),
|
||||||
|
Expanded(child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(occ ? 'Ocupado' : 'Disponible',
|
||||||
|
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w700, color: color)),
|
||||||
|
if (matchService != null && matchService.description.isNotEmpty)
|
||||||
|
Text(matchService.description,
|
||||||
|
style: TextStyle(fontSize: 12, color: context.muted),
|
||||||
|
maxLines: 1, overflow: TextOverflow.ellipsis)
|
||||||
|
else if (!occ)
|
||||||
|
Text('Horario libre para nuevas citas',
|
||||||
|
style: TextStyle(fontSize: 11, color: context.subtle)),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
Container(
|
||||||
|
width: 32, height: 32,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: color.withOpacity(0.1), shape: BoxShape.circle),
|
||||||
|
child: Icon(
|
||||||
|
occ ? Icons.event_busy_outlined : Icons.event_available_outlined,
|
||||||
|
size: 17, color: color),
|
||||||
|
),
|
||||||
|
]),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
]),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -400,9 +255,7 @@ class _ProfessionalCalendarViewState
|
|||||||
}).toList();
|
}).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Empty state ───────────────────────────────────────────────────────────
|
Widget _emptyState(BuildContext context) {
|
||||||
|
|
||||||
Widget _emptyState() {
|
|
||||||
return Center(
|
return Center(
|
||||||
child: ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
constraints: const BoxConstraints(maxWidth: 720),
|
constraints: const BoxConstraints(maxWidth: 720),
|
||||||
@@ -410,76 +263,40 @@ class _ProfessionalCalendarViewState
|
|||||||
margin: const EdgeInsets.fromLTRB(16, 12, 16, 0),
|
margin: const EdgeInsets.fromLTRB(16, 12, 16, 0),
|
||||||
padding: const EdgeInsets.symmetric(vertical: 40, horizontal: 24),
|
padding: const EdgeInsets.symmetric(vertical: 40, horizontal: 24),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: _kCard,
|
color: context.card,
|
||||||
borderRadius: BorderRadius.circular(16),
|
borderRadius: BorderRadius.circular(16),
|
||||||
boxShadow: [
|
boxShadow: [BoxShadow(color: context.shadowSm, blurRadius: 12, offset: const Offset(0, 2))],
|
||||||
BoxShadow(
|
|
||||||
color: Colors.black.withOpacity(0.05),
|
|
||||||
blurRadius: 12,
|
|
||||||
offset: const Offset(0, 2),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(children: [
|
||||||
children: [
|
Container(
|
||||||
Container(
|
width: 64, height: 64,
|
||||||
width: 64,
|
decoration: BoxDecoration(
|
||||||
height: 64,
|
color: context.subtle.withOpacity(0.1), shape: BoxShape.circle),
|
||||||
decoration: BoxDecoration(
|
child: Icon(Icons.event_busy_outlined, size: 32, color: context.subtle),
|
||||||
color: const Color(0xFF94A3B8).withOpacity(0.1),
|
),
|
||||||
shape: BoxShape.circle,
|
const SizedBox(height: 16),
|
||||||
),
|
Text('Sin horario este día',
|
||||||
child: const Icon(Icons.event_busy_outlined,
|
style: TextStyle(fontSize: 15, fontWeight: FontWeight.w700, color: context.muted)),
|
||||||
size: 32, color: Color(0xFF94A3B8)),
|
const SizedBox(height: 6),
|
||||||
),
|
Text('No tienes horario de atención configurado\npara este día de la semana.',
|
||||||
const SizedBox(height: 16),
|
|
||||||
const Text(
|
|
||||||
'Sin horario este día',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
color: Color(0xFF475569),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 6),
|
|
||||||
const Text(
|
|
||||||
'No tienes horario de atención configurado\npara este día de la semana.',
|
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(fontSize: 13, color: context.subtle, height: 1.5)),
|
||||||
fontSize: 13,
|
]),
|
||||||
color: Color(0xFF94A3B8),
|
|
||||||
height: 1.5,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Helpers ───────────────────────────────────────────────────────────────
|
ScheduleEntity? _scheduleFor(int weekday, Profesional pro) => switch (weekday) {
|
||||||
|
1 => pro.schedules.monday, 2 => pro.schedules.tuesday,
|
||||||
ScheduleEntity? _scheduleFor(int weekday, Profesional pro) {
|
3 => pro.schedules.wednesday, 4 => pro.schedules.thursday,
|
||||||
return switch (weekday) {
|
5 => pro.schedules.friday, 6 => pro.schedules.saturday,
|
||||||
1 => pro.schedules.monday,
|
_ => pro.schedules.sunday,
|
||||||
2 => pro.schedules.tuesday,
|
};
|
||||||
3 => pro.schedules.wednesday,
|
|
||||||
4 => pro.schedules.thursday,
|
|
||||||
5 => pro.schedules.friday,
|
|
||||||
6 => pro.schedules.saturday,
|
|
||||||
_ => pro.schedules.sunday,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
List<TimeOfDay> _buildSlots(ScheduleEntity? s) {
|
List<TimeOfDay> _buildSlots(ScheduleEntity? s) {
|
||||||
if (s == null ||
|
if (s == null || !s.enabled || s.range1Hour1 == null || s.range2Hour2 == null) return [];
|
||||||
!s.enabled ||
|
if (s.continuousDay) return TimeOfDayUtils.genRanges(s.range1Hour1!, s.range2Hour2!);
|
||||||
s.range1Hour1 == null ||
|
|
||||||
s.range2Hour2 == null) return [];
|
|
||||||
if (s.continuousDay) {
|
|
||||||
return TimeOfDayUtils.genRanges(s.range1Hour1!, s.range2Hour2!);
|
|
||||||
}
|
|
||||||
if (s.range1Hour2 == null || s.range2Hour1 == null) return [];
|
if (s.range1Hour2 == null || s.range2Hour1 == null) return [];
|
||||||
return [
|
return [
|
||||||
...TimeOfDayUtils.genRanges(s.range1Hour1!, s.range1Hour2!),
|
...TimeOfDayUtils.genRanges(s.range1Hour1!, s.range1Hour2!),
|
||||||
@@ -487,42 +304,28 @@ class _ProfessionalCalendarViewState
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _isOccupied(
|
bool _isOccupied(TimeOfDay time, List<Service>? services, DateTime day) {
|
||||||
TimeOfDay time, List<Service>? services, DateTime day) {
|
|
||||||
if (services == null) return false;
|
if (services == null) return false;
|
||||||
final dayStr = day.toIso8601String().split('T').first;
|
final dayStr = day.toIso8601String().split('T').first;
|
||||||
return services
|
return services.any((s) => s.day == dayStr && s.range1Hour1 == time);
|
||||||
.any((s) => s.day == dayStr && s.range1Hour1 == time);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Service? _serviceFor(
|
Service? _serviceFor(TimeOfDay time, List<Service>? services, DateTime day) {
|
||||||
TimeOfDay time, List<Service>? services, DateTime day) {
|
|
||||||
if (services == null) return null;
|
if (services == null) return null;
|
||||||
final dayStr = day.toIso8601String().split('T').first;
|
final dayStr = day.toIso8601String().split('T').first;
|
||||||
try {
|
try {
|
||||||
return services
|
return services.firstWhere((s) => s.day == dayStr && s.range1Hour1 == time);
|
||||||
.firstWhere((s) => s.day == dayStr && s.range1Hour1 == time);
|
} catch (_) { return null; }
|
||||||
} catch (_) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String _capitalize(String s) =>
|
String _capitalize(String s) => s.isEmpty ? s : s[0].toUpperCase() + s.substring(1);
|
||||||
s.isEmpty ? s : s[0].toUpperCase() + s.substring(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Stat pill ─────────────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
class _StatPill extends StatelessWidget {
|
class _StatPill extends StatelessWidget {
|
||||||
final String label;
|
final String label;
|
||||||
final String sublabel;
|
final String sublabel;
|
||||||
final Color color;
|
final Color color;
|
||||||
|
const _StatPill({required this.label, required this.sublabel, required this.color});
|
||||||
const _StatPill({
|
|
||||||
required this.label,
|
|
||||||
required this.sublabel,
|
|
||||||
required this.color,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -533,28 +336,12 @@ class _StatPill extends StatelessWidget {
|
|||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
border: Border.all(color: color.withOpacity(0.25)),
|
border: Border.all(color: color.withOpacity(0.25)),
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(mainAxisSize: MainAxisSize.min, children: [
|
||||||
mainAxisSize: MainAxisSize.min,
|
Text(label,
|
||||||
children: [
|
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w800, color: color, height: 1)),
|
||||||
Text(
|
Text(sublabel,
|
||||||
label,
|
style: TextStyle(fontSize: 9, color: color.withOpacity(0.8), fontWeight: FontWeight.w600)),
|
||||||
style: TextStyle(
|
]),
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.w800,
|
|
||||||
color: color,
|
|
||||||
height: 1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
sublabel,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 9,
|
|
||||||
color: color.withOpacity(0.8),
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,13 +14,24 @@ import 'package:prosapp_web_app/services/notifications_service.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
// ── Constants ──────────────────────────────────────────────────────────────
|
|
||||||
const _kPrimary = Color(0xFF1565C0);
|
const _kPrimary = Color(0xFF1565C0);
|
||||||
const _kAccent = Color(0xFF42A4EF);
|
const _kAccent = Color(0xFF42A4EF);
|
||||||
const _kBg = Color(0xFFF4F6FA);
|
|
||||||
const _kCard = Colors.white;
|
|
||||||
|
|
||||||
// ── Entry ──────────────────────────────────────────────────────────────────
|
// Theme-aware color helpers
|
||||||
|
extension _Th on BuildContext {
|
||||||
|
ThemeData get _t => Theme.of(this);
|
||||||
|
Color get bg => _t.scaffoldBackgroundColor;
|
||||||
|
Color get card => _t.cardColor;
|
||||||
|
Color get onSurface => _t.colorScheme.onSurface;
|
||||||
|
Color get muted => _t.colorScheme.onSurface.withOpacity(0.55);
|
||||||
|
Color get subtle => _t.colorScheme.onSurface.withOpacity(0.35);
|
||||||
|
Color get divider => _t.dividerColor;
|
||||||
|
bool get isDark => _t.brightness == Brightness.dark;
|
||||||
|
Color get shadow => isDark ? Colors.transparent : Colors.black.withOpacity(0.07);
|
||||||
|
Color get shadowSm => isDark ? Colors.transparent : Colors.black.withOpacity(0.04);
|
||||||
|
Color get inputFill => isDark ? _t.cardColor : const Color(0xFFF8FAFC);
|
||||||
|
Color get chipBg => isDark ? _t.colorScheme.onSurface.withOpacity(0.06) : Colors.grey.shade50;
|
||||||
|
}
|
||||||
|
|
||||||
class ProfessionalProfileView extends StatefulWidget {
|
class ProfessionalProfileView extends StatefulWidget {
|
||||||
const ProfessionalProfileView({super.key});
|
const ProfessionalProfileView({super.key});
|
||||||
@@ -46,7 +57,7 @@ class _ProfessionalProfileViewState extends State<ProfessionalProfileView> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
color: _kBg,
|
color: context.bg,
|
||||||
child: ListView(
|
child: ListView(
|
||||||
physics: const ClampingScrollPhysics(),
|
physics: const ClampingScrollPhysics(),
|
||||||
padding: const EdgeInsets.only(bottom: 32),
|
padding: const EdgeInsets.only(bottom: 32),
|
||||||
@@ -56,7 +67,7 @@ class _ProfessionalProfileViewState extends State<ProfessionalProfileView> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Profile header card ───────────────────────────────────────────────────
|
// ── Profile header ────────────────────────────────────────────────────────
|
||||||
|
|
||||||
class _ProfileHeader extends StatelessWidget {
|
class _ProfileHeader extends StatelessWidget {
|
||||||
const _ProfileHeader();
|
const _ProfileHeader();
|
||||||
@@ -66,7 +77,6 @@ class _ProfileHeader extends StatelessWidget {
|
|||||||
final auth = Provider.of<AuthProvider>(context).user!;
|
final auth = Provider.of<AuthProvider>(context).user!;
|
||||||
final pfp = Provider.of<ProfileFormProvider>(context);
|
final pfp = Provider.of<ProfileFormProvider>(context);
|
||||||
final fp = Provider.of<ProfessionalFormProvider>(context);
|
final fp = Provider.of<ProfessionalFormProvider>(context);
|
||||||
|
|
||||||
final picture = pfp.user?.picture;
|
final picture = pfp.user?.picture;
|
||||||
final profession = fp.profesional?.profession;
|
final profession = fp.profesional?.profession;
|
||||||
|
|
||||||
@@ -76,19 +86,12 @@ class _ProfileHeader extends StatelessWidget {
|
|||||||
child: Container(
|
child: Container(
|
||||||
margin: const EdgeInsets.fromLTRB(16, 20, 16, 0),
|
margin: const EdgeInsets.fromLTRB(16, 20, 16, 0),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: _kCard,
|
color: context.card,
|
||||||
borderRadius: BorderRadius.circular(16),
|
borderRadius: BorderRadius.circular(16),
|
||||||
boxShadow: [
|
boxShadow: [BoxShadow(color: context.shadow, blurRadius: 16, offset: const Offset(0, 4))],
|
||||||
BoxShadow(
|
|
||||||
color: Colors.black.withOpacity(0.07),
|
|
||||||
blurRadius: 16,
|
|
||||||
offset: const Offset(0, 4),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
// Banner gradient
|
|
||||||
Container(
|
Container(
|
||||||
height: 110,
|
height: 110,
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
@@ -97,11 +100,9 @@ class _ProfileHeader extends StatelessWidget {
|
|||||||
begin: Alignment.topLeft,
|
begin: Alignment.topLeft,
|
||||||
end: Alignment.bottomRight,
|
end: Alignment.bottomRight,
|
||||||
),
|
),
|
||||||
borderRadius:
|
borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
|
||||||
BorderRadius.vertical(top: Radius.circular(16)),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// Avatar overlapping the banner
|
|
||||||
Transform.translate(
|
Transform.translate(
|
||||||
offset: const Offset(0, -44),
|
offset: const Offset(0, -44),
|
||||||
child: Column(
|
child: Column(
|
||||||
@@ -114,72 +115,49 @@ class _ProfileHeader extends StatelessWidget {
|
|||||||
height: 88,
|
height: 88,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
border: Border.all(color: _kCard, width: 4),
|
border: Border.all(color: context.card, width: 4),
|
||||||
boxShadow: [
|
boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.12), blurRadius: 8)],
|
||||||
BoxShadow(
|
|
||||||
color: Colors.black.withOpacity(0.12),
|
|
||||||
blurRadius: 8,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
child: ClipOval(
|
child: ClipOval(
|
||||||
child: picture != null && picture.isNotEmpty
|
child: picture != null && picture.isNotEmpty
|
||||||
? FadeInImage.assetNetwork(
|
? FadeInImage.assetNetwork(
|
||||||
placeholder: 'loader.gif',
|
placeholder: 'loader.gif', image: picture, fit: BoxFit.cover)
|
||||||
image: picture,
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
)
|
|
||||||
: Container(
|
: Container(
|
||||||
color: _kAccent.withOpacity(0.15),
|
color: _kAccent.withOpacity(0.15),
|
||||||
child: const Icon(Icons.person,
|
child: const Icon(Icons.person, size: 44, color: _kAccent),
|
||||||
size: 44, color: _kAccent),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
_CameraButton(
|
_CameraButton(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
final result = await FilePicker.platform
|
final result = await FilePicker.platform.pickFiles(withData: true);
|
||||||
.pickFiles(withData: true);
|
|
||||||
if (result == null) return;
|
if (result == null) return;
|
||||||
final bytes = result.files.first.bytes;
|
final bytes = result.files.first.bytes;
|
||||||
if (bytes == null) return;
|
if (bytes == null || !context.mounted) return;
|
||||||
if (!context.mounted) return;
|
|
||||||
NotificationsService.showBusyIndicator(context);
|
NotificationsService.showBusyIndicator(context);
|
||||||
await pfp.uploadPicture(bytes);
|
await pfp.uploadPicture(bytes);
|
||||||
if (!context.mounted) return;
|
if (!context.mounted) return;
|
||||||
Provider.of<AuthProvider>(context, listen: false)
|
Provider.of<AuthProvider>(context, listen: false).refreshUser();
|
||||||
.refreshUser();
|
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Text(
|
Text(auth.name,
|
||||||
auth.name,
|
style: TextStyle(
|
||||||
style: const TextStyle(
|
fontSize: 18, fontWeight: FontWeight.w700, color: context.onSurface)),
|
||||||
fontSize: 18,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
color: Color(0xFF1E293B),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (profession != null && profession.isNotEmpty) ...[
|
if (profession != null && profession.isNotEmpty) ...[
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 3),
|
||||||
horizontal: 12, vertical: 3),
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: _kAccent.withOpacity(0.1),
|
color: _kAccent.withOpacity(0.12),
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(profession,
|
||||||
profession,
|
style: const TextStyle(
|
||||||
style: const TextStyle(
|
color: _kPrimary, fontSize: 12, fontWeight: FontWeight.w600)),
|
||||||
color: _kPrimary,
|
|
||||||
fontSize: 12,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
@@ -208,7 +186,7 @@ class _CameraButton extends StatelessWidget {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: _kPrimary,
|
color: _kPrimary,
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
border: Border.all(color: _kCard, width: 2),
|
border: Border.all(color: context.card, width: 2),
|
||||||
),
|
),
|
||||||
child: const Icon(Icons.camera_alt, size: 14, color: Colors.white),
|
child: const Icon(Icons.camera_alt, size: 14, color: Colors.white),
|
||||||
),
|
),
|
||||||
@@ -252,8 +230,7 @@ class _ProfileFormState extends State<_ProfileForm> {
|
|||||||
_first = false;
|
_first = false;
|
||||||
_rateEnabled = settings.tarifas ? pro.ratePreferences : false;
|
_rateEnabled = settings.tarifas ? pro.ratePreferences : false;
|
||||||
if (pro.locationPreferences == LocationPreferences.both) {
|
if (pro.locationPreferences == LocationPreferences.both) {
|
||||||
_delivery = true;
|
_delivery = true; _office = true;
|
||||||
_office = true;
|
|
||||||
} else if (pro.locationPreferences == LocationPreferences.office) {
|
} else if (pro.locationPreferences == LocationPreferences.office) {
|
||||||
_office = true;
|
_office = true;
|
||||||
} else {
|
} else {
|
||||||
@@ -269,114 +246,91 @@ class _ProfileFormState extends State<_ProfileForm> {
|
|||||||
autovalidateMode: AutovalidateMode.always,
|
autovalidateMode: AutovalidateMode.always,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
// ── Modalidad ──────────────────────────────────────────
|
|
||||||
_SectionCard(
|
_SectionCard(
|
||||||
icon: Icons.tune_outlined,
|
icon: Icons.tune_outlined,
|
||||||
title: 'Modalidad de servicio',
|
title: 'Modalidad de servicio',
|
||||||
child: Column(
|
child: Column(children: [
|
||||||
children: [
|
_ToggleRow(
|
||||||
_ToggleRow(
|
icon: Icons.delivery_dining_outlined,
|
||||||
icon: Icons.delivery_dining_outlined,
|
title: 'Servicio a domicilio',
|
||||||
title: 'Servicio a domicilio',
|
subtitle: 'Vas donde está el cliente',
|
||||||
subtitle: 'Vas donde está el cliente',
|
value: _delivery,
|
||||||
value: _delivery,
|
onChanged: settings.domicilios
|
||||||
onChanged: settings.domicilios
|
? (v) => setState(() { _delivery = v; if (!v) _office = true; })
|
||||||
? (v) => setState(() {
|
: null,
|
||||||
_delivery = v;
|
),
|
||||||
if (!v) _office = true;
|
_Divider(),
|
||||||
})
|
_ToggleRow(
|
||||||
: null,
|
icon: Icons.store_mall_directory_outlined,
|
||||||
),
|
title: 'Servicio en consultorio / sitio',
|
||||||
const _Divider(),
|
subtitle: 'El cliente viene a tu local',
|
||||||
_ToggleRow(
|
value: _office,
|
||||||
icon: Icons.store_mall_directory_outlined,
|
onChanged: (v) => setState(() {
|
||||||
title: 'Servicio en consultorio / sitio',
|
if (settings.domicilios == true) {
|
||||||
subtitle: 'El cliente viene a tu local',
|
_office = v;
|
||||||
value: _office,
|
if (!v) _delivery = true;
|
||||||
onChanged: (v) => setState(() {
|
} else {
|
||||||
if (settings.domicilios == true) {
|
_office = true; _delivery = false;
|
||||||
_office = v;
|
}
|
||||||
if (!v) _delivery = true;
|
}),
|
||||||
} else {
|
),
|
||||||
_office = true;
|
]),
|
||||||
_delivery = false;
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
|
||||||
// ── Dirección ─────────────────────────────────────────
|
|
||||||
if (_office)
|
if (_office)
|
||||||
_SectionCard(
|
_SectionCard(
|
||||||
icon: Icons.location_on_outlined,
|
icon: Icons.location_on_outlined,
|
||||||
title: 'Dirección del consultorio',
|
title: 'Dirección del consultorio',
|
||||||
child: Column(
|
child: Column(children: [
|
||||||
children: [
|
_Field(
|
||||||
_Field(
|
initial: pro.address,
|
||||||
initial: pro.address,
|
hint: 'Calle 123 # 45-67',
|
||||||
hint: 'Calle 123 # 45-67',
|
label: 'Dirección principal',
|
||||||
label: 'Dirección principal',
|
icon: Icons.map_outlined,
|
||||||
icon: Icons.map_outlined,
|
onChanged: (v) => fp.copyProfesionalWith(address: v),
|
||||||
onChanged: (v) =>
|
),
|
||||||
fp.copyProfesionalWith(address: v),
|
const SizedBox(height: 12),
|
||||||
),
|
_Field(
|
||||||
const SizedBox(height: 12),
|
initial: pro.aditionalAddress,
|
||||||
_Field(
|
hint: 'Piso 2, Consultorio 204',
|
||||||
initial: pro.aditionalAddress,
|
label: 'Piso / Apartamento / Conjunto',
|
||||||
hint: 'Piso 2, Consultorio 204',
|
icon: Icons.apartment_outlined,
|
||||||
label: 'Piso / Apartamento / Conjunto',
|
onChanged: (v) => fp.copyProfesionalWith(aditionalAddress: v),
|
||||||
icon: Icons.apartment_outlined,
|
),
|
||||||
onChanged: (v) =>
|
]),
|
||||||
fp.copyProfesionalWith(aditionalAddress: v),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
|
||||||
// ── Tarifa ────────────────────────────────────────────
|
|
||||||
if (settings.tarifas)
|
if (settings.tarifas)
|
||||||
_SectionCard(
|
_SectionCard(
|
||||||
icon: Icons.payments_outlined,
|
icon: Icons.payments_outlined,
|
||||||
title: 'Tarifa del servicio',
|
title: 'Tarifa del servicio',
|
||||||
child: Column(
|
child: Column(children: [
|
||||||
children: [
|
_ToggleRow(
|
||||||
_ToggleRow(
|
icon: Icons.attach_money,
|
||||||
icon: Icons.attach_money,
|
title: 'Mostrar tarifa en el perfil',
|
||||||
title: 'Mostrar tarifa en el perfil',
|
subtitle: 'Los clientes verán el precio por consulta',
|
||||||
subtitle:
|
value: _rateEnabled,
|
||||||
'Los clientes verán el precio por consulta',
|
onChanged: (v) => setState(() => _rateEnabled = v),
|
||||||
value: _rateEnabled,
|
),
|
||||||
onChanged: (v) =>
|
if (_rateEnabled) ...[
|
||||||
setState(() => _rateEnabled = v),
|
_Divider(),
|
||||||
|
_Field(
|
||||||
|
initial: pro.rate,
|
||||||
|
hint: '50000',
|
||||||
|
label: 'Tarifa (COP)',
|
||||||
|
icon: Icons.monetization_on_outlined,
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
validator: (v) {
|
||||||
|
if (v == null || v.isEmpty) return 'La tarifa es obligatoria';
|
||||||
|
if (!RegExp(r'^[0-9]+$').hasMatch(v)) return 'Solo números';
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
onChanged: (v) => fp.copyProfesionalWith(rate: v),
|
||||||
),
|
),
|
||||||
if (_rateEnabled) ...[
|
|
||||||
const _Divider(),
|
|
||||||
_Field(
|
|
||||||
initial: pro.rate,
|
|
||||||
hint: '50000',
|
|
||||||
label: 'Tarifa (COP)',
|
|
||||||
icon: Icons.monetization_on_outlined,
|
|
||||||
keyboardType: TextInputType.number,
|
|
||||||
validator: (v) {
|
|
||||||
if (v == null || v.isEmpty) {
|
|
||||||
return 'La tarifa es obligatoria';
|
|
||||||
}
|
|
||||||
if (!RegExp(r'^[0-9]+$').hasMatch(v)) {
|
|
||||||
return 'Solo números';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
onChanged: (v) =>
|
|
||||||
fp.copyProfesionalWith(rate: v),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
),
|
]),
|
||||||
),
|
),
|
||||||
|
|
||||||
// ── Métodos de pago ───────────────────────────────────
|
|
||||||
_SectionCard(
|
_SectionCard(
|
||||||
icon: Icons.credit_card_outlined,
|
icon: Icons.credit_card_outlined,
|
||||||
title: 'Métodos de pago',
|
title: 'Métodos de pago',
|
||||||
@@ -389,104 +343,70 @@ class _ProfileFormState extends State<_ProfileForm> {
|
|||||||
label: 'Datáfono',
|
label: 'Datáfono',
|
||||||
selected: pro.paymentMethods.datafono,
|
selected: pro.paymentMethods.datafono,
|
||||||
onTap: () => fp.copyProfesionalWith(
|
onTap: () => fp.copyProfesionalWith(
|
||||||
paymentMethods: pro.paymentMethods.copyWith(
|
paymentMethods: pro.paymentMethods.copyWith(datafono: !pro.paymentMethods.datafono)),
|
||||||
datafono: !pro.paymentMethods.datafono,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
_PayChip(
|
_PayChip(
|
||||||
icon: Icons.phone_android_outlined,
|
icon: Icons.phone_android_outlined,
|
||||||
label: 'Nequi',
|
label: 'Nequi',
|
||||||
selected: pro.paymentMethods.nequi,
|
selected: pro.paymentMethods.nequi,
|
||||||
onTap: () => fp.copyProfesionalWith(
|
onTap: () => fp.copyProfesionalWith(
|
||||||
paymentMethods: pro.paymentMethods
|
paymentMethods: pro.paymentMethods.copyWith(nequi: !pro.paymentMethods.nequi)),
|
||||||
.copyWith(nequi: !pro.paymentMethods.nequi),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
_PayChip(
|
_PayChip(
|
||||||
icon: Icons.account_balance_outlined,
|
icon: Icons.account_balance_outlined,
|
||||||
label: 'Transferencia',
|
label: 'Transferencia',
|
||||||
selected: pro.paymentMethods.transferencia,
|
selected: pro.paymentMethods.transferencia,
|
||||||
onTap: () => fp.copyProfesionalWith(
|
onTap: () => fp.copyProfesionalWith(
|
||||||
paymentMethods: pro.paymentMethods.copyWith(
|
paymentMethods: pro.paymentMethods.copyWith(transferencia: !pro.paymentMethods.transferencia)),
|
||||||
transferencia:
|
|
||||||
!pro.paymentMethods.transferencia,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
// ── Horarios ──────────────────────────────────────────
|
|
||||||
_SectionCard(
|
_SectionCard(
|
||||||
icon: Icons.schedule_outlined,
|
icon: Icons.schedule_outlined,
|
||||||
title: 'Horarios de atención',
|
title: 'Horarios de atención',
|
||||||
trailing: TextButton.icon(
|
trailing: TextButton.icon(
|
||||||
onPressed: () => NavigationService.replaceTo(
|
onPressed: () => NavigationService.replaceTo(Flurorouter.professionalScheduleRoute),
|
||||||
Flurorouter.professionalScheduleRoute),
|
icon: const Icon(Icons.edit_outlined, size: 16, color: _kPrimary),
|
||||||
icon: const Icon(Icons.edit_outlined,
|
label: const Text('Editar', style: TextStyle(color: _kPrimary, fontSize: 13)),
|
||||||
size: 16, color: _kPrimary),
|
|
||||||
label: const Text('Editar',
|
|
||||||
style:
|
|
||||||
TextStyle(color: _kPrimary, fontSize: 13)),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
children: _buildScheduleRows(pro.schedules),
|
|
||||||
),
|
),
|
||||||
|
child: Column(children: _buildScheduleRows(pro.schedules, context)),
|
||||||
),
|
),
|
||||||
|
|
||||||
// ── Botón guardar ─────────────────────────────────────
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(16, 14, 16, 4),
|
padding: const EdgeInsets.fromLTRB(16, 14, 16, 4),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 48,
|
height: 48,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
onPressed: _saving
|
onPressed: _saving ? null : () async {
|
||||||
? null
|
setState(() => _saving = true);
|
||||||
: () async {
|
LocationPreferences lp;
|
||||||
setState(() => _saving = true);
|
if (_delivery && _office) {
|
||||||
LocationPreferences lp;
|
lp = LocationPreferences.both;
|
||||||
if (_delivery && _office) {
|
} else if (_delivery) {
|
||||||
lp = LocationPreferences.both;
|
lp = LocationPreferences.delivery;
|
||||||
} else if (_delivery) {
|
} else {
|
||||||
lp = LocationPreferences.delivery;
|
lp = LocationPreferences.office;
|
||||||
} else {
|
}
|
||||||
lp = LocationPreferences.office;
|
fp.copyProfesionalWith(locationPreferences: lp, ratePreferences: _rateEnabled);
|
||||||
}
|
await fp.updateProfesionalProfileInfo(user.id);
|
||||||
fp.copyProfesionalWith(
|
if (mounted) setState(() => _saving = false);
|
||||||
locationPreferences: lp,
|
},
|
||||||
ratePreferences: _rateEnabled,
|
|
||||||
);
|
|
||||||
await fp.updateProfesionalProfileInfo(user.id);
|
|
||||||
if (mounted) setState(() => _saving = false);
|
|
||||||
},
|
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: _kPrimary,
|
backgroundColor: _kPrimary,
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
disabledBackgroundColor:
|
disabledBackgroundColor: _kPrimary.withOpacity(0.6),
|
||||||
_kPrimary.withOpacity(0.6),
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
),
|
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
),
|
),
|
||||||
child: _saving
|
child: _saving
|
||||||
? const SizedBox(
|
? const SizedBox(
|
||||||
width: 20,
|
width: 20, height: 20,
|
||||||
height: 20,
|
child: CircularProgressIndicator(color: Colors.white, strokeWidth: 2))
|
||||||
child: CircularProgressIndicator(
|
: const Text('Guardar cambios',
|
||||||
color: Colors.white,
|
style: TextStyle(fontSize: 15, fontWeight: FontWeight.w600)),
|
||||||
strokeWidth: 2,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: const Text(
|
|
||||||
'Guardar cambios',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.w600),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -499,94 +419,62 @@ class _ProfileFormState extends State<_ProfileForm> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> _buildScheduleRows(dynamic schedules) {
|
List<Widget> _buildScheduleRows(dynamic schedules, BuildContext context) {
|
||||||
const days = [
|
const days = [
|
||||||
('Lunes', 'monday'),
|
('Lunes', 'monday'), ('Martes', 'tuesday'), ('Miércoles', 'wednesday'),
|
||||||
('Martes', 'tuesday'),
|
('Jueves', 'thursday'), ('Viernes', 'friday'), ('Sábado', 'saturday'), ('Domingo', 'sunday'),
|
||||||
('Miércoles', 'wednesday'),
|
|
||||||
('Jueves', 'thursday'),
|
|
||||||
('Viernes', 'friday'),
|
|
||||||
('Sábado', 'saturday'),
|
|
||||||
('Domingo', 'sunday'),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
return days.asMap().entries.map((entry) {
|
return days.asMap().entries.map((entry) {
|
||||||
final i = entry.key;
|
final i = entry.key;
|
||||||
final (name, field) = entry.value;
|
final (name, field) = entry.value;
|
||||||
final ScheduleEntity? sch = switch (field) {
|
final ScheduleEntity? sch = switch (field) {
|
||||||
'monday' => schedules.monday,
|
'monday' => schedules.monday, 'tuesday' => schedules.tuesday,
|
||||||
'tuesday' => schedules.tuesday,
|
'wednesday' => schedules.wednesday, 'thursday' => schedules.thursday,
|
||||||
'wednesday' => schedules.wednesday,
|
'friday' => schedules.friday, 'saturday' => schedules.saturday,
|
||||||
'thursday' => schedules.thursday,
|
|
||||||
'friday' => schedules.friday,
|
|
||||||
'saturday' => schedules.saturday,
|
|
||||||
_ => schedules.sunday,
|
_ => schedules.sunday,
|
||||||
};
|
};
|
||||||
final time = _formatTime(sch);
|
final time = _formatTime(sch);
|
||||||
final active = sch?.enabled == true;
|
final active = sch?.enabled == true;
|
||||||
|
return Column(children: [
|
||||||
return Column(
|
if (i > 0) _Divider(),
|
||||||
children: [
|
Padding(
|
||||||
if (i > 0) const _Divider(),
|
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 6),
|
||||||
Padding(
|
child: Row(children: [
|
||||||
padding:
|
SizedBox(
|
||||||
const EdgeInsets.symmetric(horizontal: 4, vertical: 6),
|
width: 90,
|
||||||
child: Row(
|
child: Text(name,
|
||||||
children: [
|
style: TextStyle(
|
||||||
SizedBox(
|
|
||||||
width: 90,
|
|
||||||
child: Text(
|
|
||||||
name,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color: active
|
color: active ? context.onSurface : context.subtle)),
|
||||||
? const Color(0xFF1E293B)
|
|
||||||
: Colors.grey.shade400,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
width: 7,
|
|
||||||
height: 7,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
color: active
|
|
||||||
? Colors.green.shade400
|
|
||||||
: Colors.grey.shade300,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 10),
|
|
||||||
Expanded(
|
|
||||||
child: Text(
|
|
||||||
time,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
color: active
|
|
||||||
? const Color(0xFF475569)
|
|
||||||
: Colors.grey.shade400,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
Container(
|
||||||
],
|
width: 7, height: 7,
|
||||||
);
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: active ? Colors.green.shade400 : context.subtle,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
Expanded(
|
||||||
|
child: Text(time,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: active ? context.muted : context.subtle)),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
]);
|
||||||
}).toList();
|
}).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
String _formatTime(ScheduleEntity? s) {
|
String _formatTime(ScheduleEntity? s) {
|
||||||
if (s == null || !s.enabled) return 'No disponible';
|
if (s == null || !s.enabled) return 'No disponible';
|
||||||
if (s.range1Hour1 == null || s.range2Hour2 == null) {
|
if (s.range1Hour1 == null || s.range2Hour2 == null) return 'Sin horario definido';
|
||||||
return 'Sin horario definido';
|
|
||||||
}
|
|
||||||
if (s.continuousDay) {
|
if (s.continuousDay) {
|
||||||
return '${ScheduleEntity.getFormatTime(s.range1Hour1)} – ${ScheduleEntity.getFormatTime(s.range2Hour2)}';
|
return '${ScheduleEntity.getFormatTime(s.range1Hour1)} – ${ScheduleEntity.getFormatTime(s.range2Hour2)}';
|
||||||
}
|
}
|
||||||
if (s.range1Hour2 == null || s.range2Hour1 == null) {
|
if (s.range1Hour2 == null || s.range2Hour1 == null) return 'Sin horario definido';
|
||||||
return 'Sin horario definido';
|
|
||||||
}
|
|
||||||
return '${ScheduleEntity.getFormatTime(s.range1Hour1)}–${ScheduleEntity.getFormatTime(s.range1Hour2)} · ${ScheduleEntity.getFormatTime(s.range2Hour1)}–${ScheduleEntity.getFormatTime(s.range2Hour2)}';
|
return '${ScheduleEntity.getFormatTime(s.range1Hour1)}–${ScheduleEntity.getFormatTime(s.range1Hour2)} · ${ScheduleEntity.getFormatTime(s.range2Hour1)}–${ScheduleEntity.getFormatTime(s.range2Hour2)}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -598,64 +486,36 @@ class _SectionCard extends StatelessWidget {
|
|||||||
final String title;
|
final String title;
|
||||||
final Widget child;
|
final Widget child;
|
||||||
final Widget? trailing;
|
final Widget? trailing;
|
||||||
|
const _SectionCard({required this.icon, required this.title, required this.child, this.trailing});
|
||||||
const _SectionCard({
|
|
||||||
required this.icon,
|
|
||||||
required this.title,
|
|
||||||
required this.child,
|
|
||||||
this.trailing,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
margin: const EdgeInsets.fromLTRB(16, 12, 16, 0),
|
margin: const EdgeInsets.fromLTRB(16, 12, 16, 0),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: _kCard,
|
color: context.card,
|
||||||
borderRadius: BorderRadius.circular(16),
|
borderRadius: BorderRadius.circular(16),
|
||||||
boxShadow: [
|
boxShadow: [BoxShadow(color: context.shadowSm, blurRadius: 12, offset: const Offset(0, 2))],
|
||||||
BoxShadow(
|
|
||||||
color: Colors.black.withOpacity(0.05),
|
|
||||||
blurRadius: 12,
|
|
||||||
offset: const Offset(0, 2),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(16, 14, 12, 0),
|
padding: const EdgeInsets.fromLTRB(16, 14, 12, 0),
|
||||||
child: Row(
|
child: Row(children: [
|
||||||
children: [
|
Container(
|
||||||
Container(
|
width: 32, height: 32,
|
||||||
width: 32,
|
decoration: BoxDecoration(
|
||||||
height: 32,
|
color: _kPrimary.withOpacity(0.08), borderRadius: BorderRadius.circular(8)),
|
||||||
decoration: BoxDecoration(
|
child: Icon(icon, size: 17, color: _kPrimary),
|
||||||
color: _kPrimary.withOpacity(0.08),
|
),
|
||||||
borderRadius: BorderRadius.circular(8),
|
const SizedBox(width: 10),
|
||||||
),
|
Expanded(child: Text(title,
|
||||||
child: Icon(icon, size: 17, color: _kPrimary),
|
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w700, color: context.onSurface))),
|
||||||
),
|
if (trailing != null) trailing!,
|
||||||
const SizedBox(width: 10),
|
]),
|
||||||
Expanded(
|
|
||||||
child: Text(
|
|
||||||
title,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 14,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
color: Color(0xFF1E293B),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (trailing != null) trailing!,
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.fromLTRB(16, 10, 16, 14),
|
|
||||||
child: child,
|
|
||||||
),
|
),
|
||||||
|
Padding(padding: const EdgeInsets.fromLTRB(16, 10, 16, 14), child: child),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -668,56 +528,23 @@ class _ToggleRow extends StatelessWidget {
|
|||||||
final String subtitle;
|
final String subtitle;
|
||||||
final bool value;
|
final bool value;
|
||||||
final ValueChanged<bool>? onChanged;
|
final ValueChanged<bool>? onChanged;
|
||||||
|
const _ToggleRow({required this.icon, required this.title, required this.subtitle,
|
||||||
const _ToggleRow({
|
required this.value, this.onChanged});
|
||||||
required this.icon,
|
|
||||||
required this.title,
|
|
||||||
required this.subtitle,
|
|
||||||
required this.value,
|
|
||||||
this.onChanged,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final enabled = onChanged != null;
|
|
||||||
return Opacity(
|
return Opacity(
|
||||||
opacity: enabled ? 1.0 : 0.45,
|
opacity: onChanged != null ? 1.0 : 0.45,
|
||||||
child: Row(
|
child: Row(children: [
|
||||||
children: [
|
Icon(icon, size: 20, color: value ? _kPrimary : context.subtle),
|
||||||
Icon(icon,
|
const SizedBox(width: 12),
|
||||||
size: 20,
|
Expanded(child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||||
color: value ? _kPrimary : Colors.grey.shade400),
|
Text(title, style: TextStyle(fontSize: 13, fontWeight: FontWeight.w600, color: context.onSurface)),
|
||||||
const SizedBox(width: 12),
|
Text(subtitle, style: TextStyle(fontSize: 11, color: context.subtle)),
|
||||||
Expanded(
|
])),
|
||||||
child: Column(
|
Switch(value: value, onChanged: onChanged, activeColor: _kPrimary,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap),
|
||||||
children: [
|
]),
|
||||||
Text(
|
|
||||||
title,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 13,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
color: Color(0xFF1E293B),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
subtitle,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 11,
|
|
||||||
color: Color(0xFF94A3B8),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Switch(
|
|
||||||
value: value,
|
|
||||||
onChanged: onChanged,
|
|
||||||
activeColor: _kPrimary,
|
|
||||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -727,13 +554,7 @@ class _PayChip extends StatelessWidget {
|
|||||||
final String label;
|
final String label;
|
||||||
final bool selected;
|
final bool selected;
|
||||||
final VoidCallback onTap;
|
final VoidCallback onTap;
|
||||||
|
const _PayChip({required this.icon, required this.label, required this.selected, required this.onTap});
|
||||||
const _PayChip({
|
|
||||||
required this.icon,
|
|
||||||
required this.label,
|
|
||||||
required this.selected,
|
|
||||||
required this.onTap,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -743,39 +564,24 @@ class _PayChip extends StatelessWidget {
|
|||||||
duration: const Duration(milliseconds: 180),
|
duration: const Duration(milliseconds: 180),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10),
|
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: selected
|
color: selected ? _kPrimary.withOpacity(0.08) : context.chipBg,
|
||||||
? _kPrimary.withOpacity(0.08)
|
|
||||||
: Colors.grey.shade50,
|
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color: selected ? _kPrimary : Colors.grey.shade200,
|
color: selected ? _kPrimary : context.divider, width: 1.5),
|
||||||
width: 1.5,
|
|
||||||
),
|
|
||||||
borderRadius: BorderRadius.circular(10),
|
borderRadius: BorderRadius.circular(10),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(mainAxisSize: MainAxisSize.min, children: [
|
||||||
mainAxisSize: MainAxisSize.min,
|
Icon(icon, size: 18, color: selected ? _kPrimary : context.subtle),
|
||||||
children: [
|
const SizedBox(width: 8),
|
||||||
Icon(icon,
|
Text(label,
|
||||||
size: 18,
|
style: TextStyle(fontSize: 13, fontWeight: FontWeight.w600,
|
||||||
color: selected ? _kPrimary : Colors.grey.shade400),
|
color: selected ? _kPrimary : context.muted)),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 6),
|
||||||
Text(
|
AnimatedOpacity(
|
||||||
label,
|
opacity: selected ? 1 : 0,
|
||||||
style: TextStyle(
|
duration: const Duration(milliseconds: 180),
|
||||||
fontSize: 13,
|
child: const Icon(Icons.check_circle_rounded, size: 15, color: _kPrimary),
|
||||||
fontWeight: FontWeight.w600,
|
),
|
||||||
color: selected ? _kPrimary : Colors.grey.shade500,
|
]),
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 6),
|
|
||||||
AnimatedOpacity(
|
|
||||||
opacity: selected ? 1 : 0,
|
|
||||||
duration: const Duration(milliseconds: 180),
|
|
||||||
child: const Icon(Icons.check_circle_rounded,
|
|
||||||
size: 15, color: _kPrimary),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -789,16 +595,8 @@ class _Field extends StatelessWidget {
|
|||||||
final TextInputType? keyboardType;
|
final TextInputType? keyboardType;
|
||||||
final String? Function(String?)? validator;
|
final String? Function(String?)? validator;
|
||||||
final ValueChanged<String> onChanged;
|
final ValueChanged<String> onChanged;
|
||||||
|
const _Field({required this.initial, required this.hint, required this.label,
|
||||||
const _Field({
|
required this.icon, required this.onChanged, this.keyboardType, this.validator});
|
||||||
required this.initial,
|
|
||||||
required this.hint,
|
|
||||||
required this.label,
|
|
||||||
required this.icon,
|
|
||||||
required this.onChanged,
|
|
||||||
this.keyboardType,
|
|
||||||
this.validator,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -807,41 +605,28 @@ class _Field extends StatelessWidget {
|
|||||||
keyboardType: keyboardType,
|
keyboardType: keyboardType,
|
||||||
validator: validator,
|
validator: validator,
|
||||||
onChanged: onChanged,
|
onChanged: onChanged,
|
||||||
style: const TextStyle(fontSize: 13),
|
style: TextStyle(fontSize: 13, color: context.onSurface),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: label,
|
labelText: label,
|
||||||
hintText: hint,
|
hintText: hint,
|
||||||
prefixIcon:
|
prefixIcon: Icon(icon, size: 18, color: context.subtle),
|
||||||
Icon(icon, size: 18, color: Colors.grey.shade500),
|
contentPadding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12),
|
||||||
contentPadding:
|
labelStyle: TextStyle(fontSize: 13, color: context.muted),
|
||||||
const EdgeInsets.symmetric(horizontal: 14, vertical: 12),
|
|
||||||
labelStyle: const TextStyle(
|
|
||||||
fontSize: 13,
|
|
||||||
color: Color(0xFF64748B),
|
|
||||||
),
|
|
||||||
border: OutlineInputBorder(
|
border: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(10),
|
borderRadius: BorderRadius.circular(10), borderSide: BorderSide(color: context.divider)),
|
||||||
borderSide: BorderSide(color: Colors.grey.shade200),
|
|
||||||
),
|
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(10),
|
borderRadius: BorderRadius.circular(10), borderSide: BorderSide(color: context.divider)),
|
||||||
borderSide: BorderSide(color: Colors.grey.shade200),
|
|
||||||
),
|
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(10),
|
borderRadius: BorderRadius.circular(10), borderSide: const BorderSide(color: _kPrimary, width: 1.5)),
|
||||||
borderSide: const BorderSide(color: _kPrimary, width: 1.5),
|
|
||||||
),
|
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: const Color(0xFFF8FAFC),
|
fillColor: context.inputFill,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _Divider extends StatelessWidget {
|
class _Divider extends StatelessWidget {
|
||||||
const _Divider();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) =>
|
Widget build(BuildContext context) =>
|
||||||
Divider(height: 16, color: Colors.grey.shade100);
|
Divider(height: 16, color: context.divider);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,18 @@ 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';
|
||||||
|
|
||||||
const _kPrimary = Color(0xFF1565C0);
|
const _kPrimary = Color(0xFF1565C0);
|
||||||
const _kBg = Color(0xFFF4F6FA);
|
|
||||||
const _kCard = Colors.white;
|
extension _Th on BuildContext {
|
||||||
|
ThemeData get _t => Theme.of(this);
|
||||||
|
Color get bg => _t.scaffoldBackgroundColor;
|
||||||
|
Color get card => _t.cardColor;
|
||||||
|
Color get onSurface => _t.colorScheme.onSurface;
|
||||||
|
Color get muted => _t.colorScheme.onSurface.withOpacity(0.55);
|
||||||
|
Color get subtle => _t.colorScheme.onSurface.withOpacity(0.35);
|
||||||
|
bool get isDark => _t.brightness == Brightness.dark;
|
||||||
|
Color get shadow => isDark ? Colors.transparent : Colors.black.withOpacity(0.05);
|
||||||
|
Color get shadowSm => isDark ? Colors.transparent : Colors.black.withOpacity(0.04);
|
||||||
|
}
|
||||||
|
|
||||||
class ServicesRequestsView extends StatelessWidget {
|
class ServicesRequestsView extends StatelessWidget {
|
||||||
const ServicesRequestsView({super.key});
|
const ServicesRequestsView({super.key});
|
||||||
@@ -23,72 +33,51 @@ class ServicesRequestsView extends StatelessWidget {
|
|||||||
Provider.of<AuthProvider>(context, listen: false).user!.id);
|
Provider.of<AuthProvider>(context, listen: false).user!.id);
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
color: _kBg,
|
color: context.bg,
|
||||||
child: Consumer<ServicesProvider>(
|
child: Consumer<ServicesProvider>(
|
||||||
builder: (context, sp, _) {
|
builder: (context, sp, _) {
|
||||||
if (sp.isLoading) {
|
if (sp.isLoading) {
|
||||||
return const Center(
|
return const Center(child: CircularProgressIndicator(color: _kPrimary));
|
||||||
child: CircularProgressIndicator(color: _kPrimary),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ListView(
|
return ListView(
|
||||||
physics: const ClampingScrollPhysics(),
|
physics: const ClampingScrollPhysics(),
|
||||||
padding: const EdgeInsets.only(bottom: 32),
|
padding: const EdgeInsets.only(bottom: 32),
|
||||||
children: [
|
children: [
|
||||||
// Header
|
|
||||||
Center(
|
Center(
|
||||||
child: ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
constraints: const BoxConstraints(maxWidth: 720),
|
constraints: const BoxConstraints(maxWidth: 720),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(16, 20, 16, 4),
|
padding: const EdgeInsets.fromLTRB(16, 20, 16, 4),
|
||||||
child: Row(
|
child: Row(children: [
|
||||||
children: [
|
Container(
|
||||||
Container(
|
width: 36, height: 36,
|
||||||
width: 36,
|
decoration: BoxDecoration(
|
||||||
height: 36,
|
color: _kPrimary.withOpacity(0.08),
|
||||||
decoration: BoxDecoration(
|
borderRadius: BorderRadius.circular(10)),
|
||||||
color: _kPrimary.withOpacity(0.08),
|
child: const Icon(Icons.inbox_outlined, size: 19, color: _kPrimary),
|
||||||
borderRadius: BorderRadius.circular(10),
|
),
|
||||||
),
|
const SizedBox(width: 10),
|
||||||
child: const Icon(Icons.inbox_outlined,
|
Text('Solicitudes',
|
||||||
size: 19, color: _kPrimary),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 10),
|
|
||||||
const Text(
|
|
||||||
'Solicitudes',
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18,
|
fontSize: 18, fontWeight: FontWeight.w800, color: context.onSurface)),
|
||||||
fontWeight: FontWeight.w800,
|
const Spacer(),
|
||||||
color: Color(0xFF1E293B),
|
if (sp.services.isNotEmpty)
|
||||||
),
|
Container(
|
||||||
),
|
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
||||||
const Spacer(),
|
decoration: BoxDecoration(
|
||||||
if (sp.services.isNotEmpty)
|
color: _kPrimary.withOpacity(0.1),
|
||||||
Container(
|
borderRadius: BorderRadius.circular(20)),
|
||||||
padding: const EdgeInsets.symmetric(
|
child: Text('${sp.services.length}',
|
||||||
horizontal: 10, vertical: 4),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: _kPrimary.withOpacity(0.1),
|
|
||||||
borderRadius: BorderRadius.circular(20),
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
'${sp.services.length}',
|
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 13,
|
fontSize: 13, fontWeight: FontWeight.w700, color: _kPrimary)),
|
||||||
fontWeight: FontWeight.w700,
|
),
|
||||||
color: _kPrimary,
|
]),
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
if (sp.services.isEmpty)
|
if (sp.services.isEmpty)
|
||||||
_emptyState()
|
_emptyState(context)
|
||||||
else
|
else
|
||||||
...sp.services.map((data) => _RequestCard(data: data)),
|
...sp.services.map((data) => _RequestCard(data: data)),
|
||||||
],
|
],
|
||||||
@@ -98,7 +87,7 @@ class ServicesRequestsView extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _emptyState() {
|
Widget _emptyState(BuildContext context) {
|
||||||
return Center(
|
return Center(
|
||||||
child: ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
constraints: const BoxConstraints(maxWidth: 720),
|
constraints: const BoxConstraints(maxWidth: 720),
|
||||||
@@ -106,49 +95,24 @@ class ServicesRequestsView extends StatelessWidget {
|
|||||||
margin: const EdgeInsets.fromLTRB(16, 12, 16, 0),
|
margin: const EdgeInsets.fromLTRB(16, 12, 16, 0),
|
||||||
padding: const EdgeInsets.symmetric(vertical: 56, horizontal: 24),
|
padding: const EdgeInsets.symmetric(vertical: 56, horizontal: 24),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: _kCard,
|
color: context.card,
|
||||||
borderRadius: BorderRadius.circular(16),
|
borderRadius: BorderRadius.circular(16),
|
||||||
boxShadow: [
|
boxShadow: [BoxShadow(color: context.shadow, blurRadius: 12, offset: const Offset(0, 2))],
|
||||||
BoxShadow(
|
|
||||||
color: Colors.black.withOpacity(0.05),
|
|
||||||
blurRadius: 12,
|
|
||||||
offset: const Offset(0, 2),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(children: [
|
||||||
children: [
|
Container(
|
||||||
Container(
|
width: 64, height: 64,
|
||||||
width: 64,
|
decoration: BoxDecoration(color: context.subtle.withOpacity(0.1), shape: BoxShape.circle),
|
||||||
height: 64,
|
child: Icon(Icons.inbox_outlined, size: 32, color: context.subtle),
|
||||||
decoration: BoxDecoration(
|
),
|
||||||
color: const Color(0xFF94A3B8).withOpacity(0.1),
|
const SizedBox(height: 16),
|
||||||
shape: BoxShape.circle,
|
Text('Sin solicitudes pendientes',
|
||||||
),
|
style: TextStyle(fontSize: 15, fontWeight: FontWeight.w700, color: context.muted)),
|
||||||
child: const Icon(Icons.inbox_outlined,
|
const SizedBox(height: 6),
|
||||||
size: 32, color: Color(0xFF94A3B8)),
|
Text('Cuando un cliente solicite tus servicios\naparecerá aquí.',
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
const Text(
|
|
||||||
'Sin solicitudes pendientes',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
color: Color(0xFF475569),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 6),
|
|
||||||
const Text(
|
|
||||||
'Cuando un cliente solicite tus servicios\naparecerá aquí.',
|
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(fontSize: 13, color: context.subtle, height: 1.5)),
|
||||||
fontSize: 13,
|
]),
|
||||||
color: Color(0xFF94A3B8),
|
|
||||||
height: 1.5,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -164,8 +128,7 @@ class _RequestCard extends StatelessWidget {
|
|||||||
final service = data.service;
|
final service = data.service;
|
||||||
final user = data.user;
|
final user = data.user;
|
||||||
final statusInfo = _statusInfo(service.status);
|
final statusInfo = _statusInfo(service.status);
|
||||||
final dateStr = DateFormat('dd MMM yyyy', 'es')
|
final dateStr = DateFormat('dd MMM yyyy', 'es').format(DateTime.parse(service.day));
|
||||||
.format(DateTime.parse(service.day));
|
|
||||||
final timeStr = ScheduleEntity.getFormatTime(service.range1Hour1) ?? '';
|
final timeStr = ScheduleEntity.getFormatTime(service.range1Hour1) ?? '';
|
||||||
|
|
||||||
return Center(
|
return Center(
|
||||||
@@ -174,15 +137,9 @@ class _RequestCard extends StatelessWidget {
|
|||||||
child: Container(
|
child: Container(
|
||||||
margin: const EdgeInsets.fromLTRB(16, 8, 16, 0),
|
margin: const EdgeInsets.fromLTRB(16, 8, 16, 0),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: _kCard,
|
color: context.card,
|
||||||
borderRadius: BorderRadius.circular(14),
|
borderRadius: BorderRadius.circular(14),
|
||||||
boxShadow: [
|
boxShadow: [BoxShadow(color: context.shadowSm, blurRadius: 10, offset: const Offset(0, 2))],
|
||||||
BoxShadow(
|
|
||||||
color: Colors.black.withOpacity(0.05),
|
|
||||||
blurRadius: 10,
|
|
||||||
offset: const Offset(0, 2),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(14),
|
borderRadius: BorderRadius.circular(14),
|
||||||
@@ -192,121 +149,74 @@ class _RequestCard extends StatelessWidget {
|
|||||||
onTap: () => NavigationService.replaceTo(
|
onTap: () => NavigationService.replaceTo(
|
||||||
'/dashboard/professional/service/${service.id}'),
|
'/dashboard/professional/service/${service.id}'),
|
||||||
child: IntrinsicHeight(
|
child: IntrinsicHeight(
|
||||||
child: Row(
|
child: Row(children: [
|
||||||
children: [
|
Container(width: 4, color: statusInfo.color),
|
||||||
// Status accent strip
|
Padding(
|
||||||
Container(width: 4, color: statusInfo.color),
|
padding: const EdgeInsets.all(14),
|
||||||
// Avatar
|
child: Container(
|
||||||
Padding(
|
width: 52, height: 52,
|
||||||
padding: const EdgeInsets.all(14),
|
decoration: BoxDecoration(
|
||||||
child: Stack(
|
shape: BoxShape.circle,
|
||||||
children: [
|
border: Border.all(color: statusInfo.color.withOpacity(0.3), width: 2)),
|
||||||
Container(
|
child: ClipOval(
|
||||||
width: 52,
|
child: (user.picture == null || user.picture!.isEmpty)
|
||||||
height: 52,
|
? Container(
|
||||||
decoration: BoxDecoration(
|
color: _kPrimary.withOpacity(0.1),
|
||||||
shape: BoxShape.circle,
|
child: Center(
|
||||||
border: Border.all(
|
child: Text(
|
||||||
color: statusInfo.color.withOpacity(0.3),
|
user.name.isNotEmpty ? user.name[0].toUpperCase() : '?',
|
||||||
width: 2,
|
style: const TextStyle(
|
||||||
),
|
fontSize: 20, fontWeight: FontWeight.w700, color: _kPrimary),
|
||||||
),
|
|
||||||
child: ClipOval(
|
|
||||||
child: (user.picture == null ||
|
|
||||||
user.picture!.isEmpty)
|
|
||||||
? Container(
|
|
||||||
color: _kPrimary.withOpacity(0.1),
|
|
||||||
child: Center(
|
|
||||||
child: Text(
|
|
||||||
user.name.isNotEmpty
|
|
||||||
? user.name[0].toUpperCase()
|
|
||||||
: '?',
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
color: _kPrimary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: FadeInImage.assetNetwork(
|
|
||||||
placeholder: 'loader.gif',
|
|
||||||
image: user.picture!,
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
// Content
|
|
||||||
Expanded(
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.symmetric(vertical: 14),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
user.name,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 14,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
color: Color(0xFF1E293B),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (service.description.isNotEmpty) ...[
|
|
||||||
const SizedBox(height: 2),
|
|
||||||
Text(
|
|
||||||
'"${service.description}"',
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
color: Color(0xFF64748B),
|
|
||||||
fontStyle: FontStyle.italic,
|
|
||||||
),
|
|
||||||
maxLines: 1,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
const SizedBox(height: 6),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
const Icon(Icons.calendar_today_outlined,
|
|
||||||
size: 12,
|
|
||||||
color: Color(0xFF94A3B8)),
|
|
||||||
const SizedBox(width: 4),
|
|
||||||
Text(
|
|
||||||
'$dateStr · $timeStr',
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
color: Color(0xFF64748B),
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
)
|
||||||
),
|
: FadeInImage.assetNetwork(
|
||||||
],
|
placeholder: 'loader.gif', image: user.picture!, fit: BoxFit.cover),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// Status + arrow
|
),
|
||||||
Padding(
|
Expanded(
|
||||||
padding: const EdgeInsets.fromLTRB(8, 14, 12, 14),
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||||
child: Column(
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
|
||||||
children: [
|
children: [
|
||||||
_StatusBadge(info: statusInfo),
|
Text(user.name,
|
||||||
const SizedBox(height: 8),
|
style: TextStyle(
|
||||||
Icon(Icons.chevron_right,
|
fontSize: 14, fontWeight: FontWeight.w700, color: context.onSurface)),
|
||||||
size: 18,
|
if (service.description.isNotEmpty) ...[
|
||||||
color: Colors.grey.shade400),
|
const SizedBox(height: 2),
|
||||||
|
Text('"${service.description}"',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12, color: context.muted, fontStyle: FontStyle.italic),
|
||||||
|
maxLines: 1, overflow: TextOverflow.ellipsis),
|
||||||
|
],
|
||||||
|
const SizedBox(height: 6),
|
||||||
|
Row(children: [
|
||||||
|
Icon(Icons.calendar_today_outlined, size: 12, color: context.subtle),
|
||||||
|
const SizedBox(width: 4),
|
||||||
|
Text('$dateStr · $timeStr',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12, color: context.muted, fontWeight: FontWeight.w500)),
|
||||||
|
]),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(8, 14, 12, 14),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
_StatusBadge(info: statusInfo),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Icon(Icons.chevron_right, size: 18, color: context.subtle),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -324,28 +234,18 @@ class _StatusBadge extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
padding:
|
padding: const EdgeInsets.symmetric(horizontal: 9, vertical: 4),
|
||||||
const EdgeInsets.symmetric(horizontal: 9, vertical: 4),
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: info.color.withOpacity(0.1),
|
color: info.color.withOpacity(0.1),
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
border: Border.all(color: info.color.withOpacity(0.3)),
|
border: Border.all(color: info.color.withOpacity(0.3)),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(mainAxisSize: MainAxisSize.min, children: [
|
||||||
mainAxisSize: MainAxisSize.min,
|
Icon(info.icon, size: 11, color: info.color),
|
||||||
children: [
|
const SizedBox(width: 4),
|
||||||
Icon(info.icon, size: 11, color: info.color),
|
Text(info.label,
|
||||||
const SizedBox(width: 4),
|
style: TextStyle(fontSize: 11, fontWeight: FontWeight.w700, color: info.color)),
|
||||||
Text(
|
]),
|
||||||
info.label,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 11,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
color: info.color,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -357,21 +257,19 @@ class _StatusInfo {
|
|||||||
const _StatusInfo(this.label, this.color, this.icon);
|
const _StatusInfo(this.label, this.color, this.icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
_StatusInfo _statusInfo(ServiceStatus status) {
|
_StatusInfo _statusInfo(ServiceStatus status) => switch (status) {
|
||||||
return switch (status) {
|
ServiceStatus.pending =>
|
||||||
ServiceStatus.pending =>
|
const _StatusInfo('Pendiente', Color(0xFFD97706), Icons.hourglass_top_outlined),
|
||||||
const _StatusInfo('Pendiente', Color(0xFFD97706), Icons.hourglass_top_outlined),
|
ServiceStatus.acepted =>
|
||||||
ServiceStatus.acepted =>
|
const _StatusInfo('Aceptado', Color(0xFF1565C0), Icons.check_circle_outline),
|
||||||
const _StatusInfo('Aceptado', Color(0xFF1565C0), Icons.check_circle_outline),
|
ServiceStatus.active =>
|
||||||
ServiceStatus.active =>
|
const _StatusInfo('En curso', Color(0xFF16A34A), Icons.play_circle_outline),
|
||||||
const _StatusInfo('En curso', Color(0xFF16A34A), Icons.play_circle_outline),
|
ServiceStatus.completed =>
|
||||||
ServiceStatus.completed =>
|
const _StatusInfo('Completado', Color(0xFF64748B), Icons.task_alt_outlined),
|
||||||
const _StatusInfo('Completado', Color(0xFF64748B), Icons.task_alt_outlined),
|
ServiceStatus.denied =>
|
||||||
ServiceStatus.denied =>
|
const _StatusInfo('Rechazado', Color(0xFFDC2626), Icons.cancel_outlined),
|
||||||
const _StatusInfo('Rechazado', Color(0xFFDC2626), Icons.cancel_outlined),
|
ServiceStatus.cancelled =>
|
||||||
ServiceStatus.cancelled =>
|
const _StatusInfo('Cancelado', Color(0xFF9CA3AF), Icons.remove_circle_outline),
|
||||||
const _StatusInfo('Cancelado', Color(0xFF9CA3AF), Icons.remove_circle_outline),
|
ServiceStatus.selfBooked =>
|
||||||
ServiceStatus.selfBooked =>
|
const _StatusInfo('Reservado', Color(0xFF7C3AED), Icons.bookmark_outline),
|
||||||
const _StatusInfo('Reservado', Color(0xFF7C3AED), Icons.bookmark_outline),
|
};
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user