notificaciones al cancelar servicio
This commit is contained in:
@@ -9,6 +9,7 @@ import 'package:professional_repository/professional_repository.dart';
|
||||
import 'package:prosappco/blocs/service_bloc/service_bloc.dart';
|
||||
import 'package:prosappco/components/drawer_reputation.dart';
|
||||
import 'package:prosappco/components/general_reputation.dart';
|
||||
import 'package:prosappco/local_notifications/local_notifications.dart';
|
||||
import 'package:prosappco/screens/chat/chat_screen.dart';
|
||||
import 'package:prosappco/components/general_secondary_button.dart';
|
||||
import 'package:prosappco/screens/score/score_screen.dart';
|
||||
@@ -420,7 +421,7 @@ class _UserServiceScreenState extends State<UserServiceScreen> {
|
||||
vertical: 10,
|
||||
horizontal: 15,
|
||||
),
|
||||
child: customButton(service, context),
|
||||
child: customButton(service, context, userInfo),
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -892,7 +893,8 @@ class _UserServiceScreenState extends State<UserServiceScreen> {
|
||||
return const SizedBox();
|
||||
}
|
||||
|
||||
Widget customButton(ServiceEntity service, BuildContext context) {
|
||||
Widget customButton(
|
||||
ServiceEntity service, BuildContext context, MyUser userInfo) {
|
||||
if (service.status == ServiceStatus.pending) {
|
||||
return GeneralSecondaryButton(
|
||||
label: 'Cancelar servicio',
|
||||
@@ -903,6 +905,14 @@ class _UserServiceScreenState extends State<UserServiceScreen> {
|
||||
context.read<ServiceBloc>().add(
|
||||
UpdateServiceStatus(widget.serviceId, ServiceStatus.cancelled));
|
||||
}
|
||||
|
||||
if (userInfo.token != null) {
|
||||
LocalNotifications.sendPushNotification(
|
||||
userInfo.token!,
|
||||
'Servicio cancelado',
|
||||
'Servicio cancelado por ${userInfo.name}',
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user