notificaciones al cancelar servicio
This commit is contained in:
@@ -10,6 +10,7 @@ import 'package:professional_repository/professional_repository.dart';
|
||||
import 'package:prosappco/blocs/service_bloc/service_bloc.dart';
|
||||
import 'package:prosappco/components/general_primary_button.dart';
|
||||
import 'package:prosappco/components/general_secondary_button.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';
|
||||
@@ -255,7 +256,7 @@ class _UserServiceScreenState extends State<UserServiceScreen> {
|
||||
vertical: 10,
|
||||
horizontal: 15,
|
||||
),
|
||||
child: customButton(service, context),
|
||||
child: customButton(service, context, userInfo),
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -352,7 +353,7 @@ class _UserServiceScreenState extends State<UserServiceScreen> {
|
||||
}
|
||||
|
||||
GeneralSecondaryButton customButton(
|
||||
ServiceEntity service, BuildContext context) {
|
||||
ServiceEntity service, BuildContext context, MyUser userInfo) {
|
||||
if (service.status == ServiceStatus.pending) {
|
||||
return GeneralSecondaryButton(
|
||||
onPressed: () {
|
||||
@@ -364,6 +365,14 @@ class _UserServiceScreenState extends State<UserServiceScreen> {
|
||||
ServiceStatus.cancelled,
|
||||
),
|
||||
);
|
||||
|
||||
if (userInfo.token != null) {
|
||||
LocalNotifications.sendPushNotification(
|
||||
userInfo.token!,
|
||||
'Servicio cancelado',
|
||||
'Servicio cancelado por ${userInfo.name}',
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
color: Colors.red,
|
||||
|
||||
Reference in New Issue
Block a user