update servicio caducado
This commit is contained in:
@@ -319,6 +319,19 @@ class _ProfessionalServiceScreenState extends State<ProfessionalServiceScreen> {
|
||||
}
|
||||
|
||||
Widget customActionButtons(ServiceEntity service, MyUser user) {
|
||||
DateTime serviceDate = DateTime.parse(service.day);
|
||||
DateTime now = DateTime.now();
|
||||
DateTime serviceDateTime = DateTime(
|
||||
serviceDate.year,
|
||||
serviceDate.month,
|
||||
serviceDate.day,
|
||||
service.range1Hour2.hour,
|
||||
service.range1Hour2.minute,
|
||||
);
|
||||
|
||||
if (now.isAfter(serviceDateTime)) {
|
||||
return const SizedBox();
|
||||
} else {
|
||||
if (service.status == ServiceStatus.acepted ||
|
||||
service.status == ServiceStatus.active) {
|
||||
return Wrap(
|
||||
@@ -412,6 +425,7 @@ class _ProfessionalServiceScreenState extends State<ProfessionalServiceScreen> {
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return const SizedBox();
|
||||
}
|
||||
@@ -433,7 +447,6 @@ class _ProfessionalServiceScreenState extends State<ProfessionalServiceScreen> {
|
||||
onPressed: () async {
|
||||
final Uri url = Uri.parse(
|
||||
'https://www.google.com/maps/search/?api=1&query=${service.latitude},${service.longitude}');
|
||||
|
||||
if (!await launchUrl(url)) {
|
||||
throw Exception('Could not launch $url');
|
||||
}
|
||||
@@ -498,6 +511,57 @@ class _ProfessionalServiceScreenState extends State<ProfessionalServiceScreen> {
|
||||
}
|
||||
|
||||
Widget customMessageStatus(ServiceEntity service) {
|
||||
DateTime serviceDate = DateTime.parse(service.day);
|
||||
DateTime now = DateTime.now();
|
||||
DateTime serviceDateTime = DateTime(
|
||||
serviceDate.year,
|
||||
serviceDate.month,
|
||||
serviceDate.day,
|
||||
service.range1Hour2.hour,
|
||||
service.range1Hour2.minute,
|
||||
);
|
||||
|
||||
if (now.isAfter(serviceDateTime)) {
|
||||
return Stack(
|
||||
alignment: AlignmentDirectional.topCenter,
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Card(
|
||||
color: Colors.red.shade100,
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.fromLTRB(32, 56, 32, 32),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'Caducado',
|
||||
style: TextStyle(fontSize: 32, color: Colors.red),
|
||||
),
|
||||
Text(
|
||||
'Tu servicio ha excedido \n el tiempo de espera',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 18, color: Colors.red),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: -40,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
border: Border.all(color: Colors.red.shade100, width: 4),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child:
|
||||
const Icon(Icons.close_rounded, color: Colors.red, size: 48),
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
} else {
|
||||
if (service.status == ServiceStatus.cancelled) {
|
||||
return Stack(
|
||||
alignment: AlignmentDirectional.topCenter,
|
||||
@@ -522,8 +586,8 @@ class _ProfessionalServiceScreenState extends State<ProfessionalServiceScreen> {
|
||||
border: Border.all(color: Colors.red.shade100, width: 4),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child:
|
||||
const Icon(Icons.close_rounded, color: Colors.red, size: 48),
|
||||
child: const Icon(Icons.close_rounded,
|
||||
color: Colors.red, size: 48),
|
||||
),
|
||||
)
|
||||
],
|
||||
@@ -553,8 +617,8 @@ class _ProfessionalServiceScreenState extends State<ProfessionalServiceScreen> {
|
||||
border: Border.all(color: Colors.red.shade100, width: 4),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child:
|
||||
const Icon(Icons.close_rounded, color: Colors.red, size: 48),
|
||||
child: const Icon(Icons.close_rounded,
|
||||
color: Colors.red, size: 48),
|
||||
),
|
||||
)
|
||||
],
|
||||
@@ -675,6 +739,7 @@ class _ProfessionalServiceScreenState extends State<ProfessionalServiceScreen> {
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return const SizedBox();
|
||||
}
|
||||
@@ -757,13 +822,8 @@ class _ProfessionalServiceScreenState extends State<ProfessionalServiceScreen> {
|
||||
label: 'Volver',
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
});
|
||||
// customStatusButton(
|
||||
// label: 'Volver',
|
||||
// onPressed: () {
|
||||
// Navigator.pop(context);
|
||||
// },
|
||||
// );
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
String formatCurrency(int number) {
|
||||
|
||||
Reference in New Issue
Block a user