boton depende de hora actual
This commit is contained in:
@@ -250,26 +250,6 @@ class _ProfessionalServiceScreenState extends State<ProfessionalServiceScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
customMapButton(service),
|
customMapButton(service),
|
||||||
|
|
||||||
// ListTile(
|
|
||||||
// leading: const Icon(Icons.near_me),
|
|
||||||
// title: Text(
|
|
||||||
// service.address,
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontSize: 15,
|
|
||||||
// color: Colors.grey[600],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// subtitle: service.aditionalAddress.isEmpty
|
|
||||||
// ? null
|
|
||||||
// : Text(
|
|
||||||
// service.aditionalAddress,
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontSize: 15,
|
|
||||||
// color: Colors.grey[600],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
service.description.isEmpty
|
service.description.isEmpty
|
||||||
? const SizedBox()
|
? const SizedBox()
|
||||||
: Container(
|
: Container(
|
||||||
@@ -503,36 +483,6 @@ class _ProfessionalServiceScreenState extends State<ProfessionalServiceScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget customMessageStatus(ServiceEntity service) {
|
Widget customMessageStatus(ServiceEntity service) {
|
||||||
// if (service.status == ServiceStatus.acepted) {
|
|
||||||
// return Stack(
|
|
||||||
// alignment: AlignmentDirectional.topCenter,
|
|
||||||
// clipBehavior: Clip.none,
|
|
||||||
// children: [
|
|
||||||
// Card(
|
|
||||||
// color: Colors.green.shade50,
|
|
||||||
// child: const Padding(
|
|
||||||
// padding: EdgeInsets.fromLTRB(32, 56, 32, 32),
|
|
||||||
// child: Text(
|
|
||||||
// 'Aceptado',
|
|
||||||
// style: TextStyle(fontSize: 32, color: Colors.green),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Positioned(
|
|
||||||
// top: -40,
|
|
||||||
// child: Container(
|
|
||||||
// padding: const EdgeInsets.all(16),
|
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// color: Colors.white,
|
|
||||||
// border: Border.all(color: Colors.green.shade50, width: 4),
|
|
||||||
// shape: BoxShape.circle,
|
|
||||||
// ),
|
|
||||||
// child: const Icon(Icons.check, color: Colors.green, size: 48),
|
|
||||||
// ),
|
|
||||||
// )
|
|
||||||
// ],
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
if (service.status == ServiceStatus.cancelled) {
|
if (service.status == ServiceStatus.cancelled) {
|
||||||
return Stack(
|
return Stack(
|
||||||
alignment: AlignmentDirectional.topCenter,
|
alignment: AlignmentDirectional.topCenter,
|
||||||
@@ -715,6 +665,16 @@ class _ProfessionalServiceScreenState extends State<ProfessionalServiceScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget customButton(ServiceEntity service, BuildContext context) {
|
Widget customButton(ServiceEntity service, BuildContext context) {
|
||||||
|
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 (service.status == ServiceStatus.pending) {
|
if (service.status == ServiceStatus.pending) {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
@@ -743,17 +703,27 @@ class _ProfessionalServiceScreenState extends State<ProfessionalServiceScreen> {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (service.status == ServiceStatus.acepted) {
|
|
||||||
|
if (now.isAfter(serviceDateTime)) {
|
||||||
return GeneralSecondaryButton(
|
return GeneralSecondaryButton(
|
||||||
label: 'Iniciar servicio',
|
label: 'Volver',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
final currentState = context.read<ServiceBloc>().state;
|
Navigator.pop(context);
|
||||||
if (currentState is ServiceLoaded) {
|
|
||||||
context.read<ServiceBloc>().add(
|
|
||||||
UpdateServiceStatus(widget.serviceId, ServiceStatus.active));
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
if (service.status == ServiceStatus.acepted) {
|
||||||
|
return GeneralSecondaryButton(
|
||||||
|
label: 'Iniciar servicio',
|
||||||
|
onPressed: () {
|
||||||
|
final currentState = context.read<ServiceBloc>().state;
|
||||||
|
if (currentState is ServiceLoaded) {
|
||||||
|
context.read<ServiceBloc>().add(
|
||||||
|
UpdateServiceStatus(widget.serviceId, ServiceStatus.active));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (service.status == ServiceStatus.active) {
|
if (service.status == ServiceStatus.active) {
|
||||||
|
|||||||
Reference in New Issue
Block a user