notificaciones al cancelar servicio
This commit is contained in:
@@ -6,6 +6,7 @@ import 'package:injector/injector.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:professional_repository/professional_repository.dart';
|
||||
import 'package:prosappco/blocs/service_bloc/service_bloc.dart';
|
||||
import 'package:prosappco/local_notifications/local_notifications.dart';
|
||||
import 'package:service_repository/service_repository.dart';
|
||||
import 'package:setting_repository/setting_repository.dart';
|
||||
import 'package:user_repository/user_repository.dart';
|
||||
@@ -276,7 +277,7 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
||||
vertical: 10,
|
||||
horizontal: 15,
|
||||
),
|
||||
child: customButton(service, context),
|
||||
child: customButton(service, context, userInfo),
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -372,7 +373,8 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
ElevatedButton customButton(ServiceEntity service, BuildContext context) {
|
||||
ElevatedButton customButton(
|
||||
ServiceEntity service, BuildContext context, MyUser userInfo) {
|
||||
if (service.status == ServiceStatus.pending) {
|
||||
return ElevatedButton(
|
||||
onPressed: () {
|
||||
@@ -384,6 +386,14 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
||||
ServiceStatus.cancelled,
|
||||
),
|
||||
);
|
||||
|
||||
if (userInfo.token != null) {
|
||||
LocalNotifications.sendPushNotification(
|
||||
userInfo.token!,
|
||||
'Servicio cancelado',
|
||||
'Servicio cancelado por ${userInfo.name}',
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
style: FilledButton.styleFrom(
|
||||
|
||||
Reference in New Issue
Block a user