boton depende de hora actual
This commit is contained in:
@@ -250,26 +250,6 @@ class _ProfessionalServiceScreenState extends State<ProfessionalServiceScreen> {
|
||||
),
|
||||
),
|
||||
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
|
||||
? const SizedBox()
|
||||
: Container(
|
||||
@@ -503,36 +483,6 @@ class _ProfessionalServiceScreenState extends State<ProfessionalServiceScreen> {
|
||||
}
|
||||
|
||||
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) {
|
||||
return Stack(
|
||||
alignment: AlignmentDirectional.topCenter,
|
||||
@@ -715,6 +665,16 @@ class _ProfessionalServiceScreenState extends State<ProfessionalServiceScreen> {
|
||||
}
|
||||
|
||||
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) {
|
||||
return Column(
|
||||
children: [
|
||||
@@ -743,17 +703,27 @@ class _ProfessionalServiceScreenState extends State<ProfessionalServiceScreen> {
|
||||
],
|
||||
);
|
||||
}
|
||||
if (service.status == ServiceStatus.acepted) {
|
||||
|
||||
if (now.isAfter(serviceDateTime)) {
|
||||
return GeneralSecondaryButton(
|
||||
label: 'Iniciar servicio',
|
||||
label: 'Volver',
|
||||
onPressed: () {
|
||||
final currentState = context.read<ServiceBloc>().state;
|
||||
if (currentState is ServiceLoaded) {
|
||||
context.read<ServiceBloc>().add(
|
||||
UpdateServiceStatus(widget.serviceId, ServiceStatus.active));
|
||||
}
|
||||
Navigator.pop(context);
|
||||
},
|
||||
);
|
||||
} 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) {
|
||||
|
||||
Reference in New Issue
Block a user