diff --git a/lib/main.dart b/lib/main.dart index 97d4cba..a544f8f 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -86,7 +86,7 @@ class MyApp extends StatelessWidget { theme: ThemeData(fontFamily: 'Poppins'), debugShowCheckedModeBanner: false, title: 'ProsApp', - initialRoute: '/splash', + initialRoute: '/', routes: { '/splash': (context) => const SplashScreen(), '/': (context) => const LoginScreen(), diff --git a/lib/src/screens/cita.dart b/lib/src/screens/cita.dart index 1de66df..6dcc0a2 100644 --- a/lib/src/screens/cita.dart +++ b/lib/src/screens/cita.dart @@ -71,7 +71,8 @@ class _CitaScreenState extends State { 'data': { 'click_action': 'FLUTTER_NOTIFICATION_CLICK', 'id': '1', - 'status': 'done' + 'status': 'done', + 'screen': 'misservicios', }, 'to': user }, diff --git a/lib/src/screens/service.dart b/lib/src/screens/service.dart index ae2abd0..8b448ad 100644 --- a/lib/src/screens/service.dart +++ b/lib/src/screens/service.dart @@ -14,12 +14,14 @@ import 'package:prosappco/src/authentication/authentication_repository.dart'; import 'package:prosappco/src/components/drawer_menu.dart'; import 'package:prosappco/src/models/event_model.dart'; import 'package:prosappco/src/models/user_model.dart'; +import 'package:prosappco/src/screens/my_services.dart'; import 'package:prosappco/src/screens/professional.dart'; import 'package:intl/intl.dart'; import 'package:prosappco/src/screens/profile.dart'; import 'package:prosappco/src/screens/profile_web.dart'; import 'package:prosappco/src/screens/service_after.dart'; import 'package:prosappco/src/screens/service_type.dart'; +import 'package:prosappco/src/screens/solicitudes.dart'; import 'package:prosappco/src/screens/ubicacion.dart'; import 'package:http/http.dart' as http; import 'package:prosappco/src/components/network_utility.dart'; @@ -47,6 +49,26 @@ class _ServiceScreenState extends State { } } + void _handleBackgroundMessage(RemoteMessage message) async { + final Map data = message.data; + + if (data['click_action'] == 'FLUTTER_NOTIFICATION_CLICK') { + final String screen = data['screen']; + + if (screen == 'solicitud') { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => SolicitudScreen()), + ); + } else if (screen == 'misservicios') { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => MyServicesScreen()), + ); + } + } + } + Future sendPushNotification(String pro) async { try { http.Response response = await http.post(