diff --git a/lib/backend/push_notification/pushNotificationService.dart b/lib/backend/push_notification/pushNotificationService.dart index 537e780a..c4a068b7 100644 --- a/lib/backend/push_notification/pushNotificationService.dart +++ b/lib/backend/push_notification/pushNotificationService.dart @@ -288,7 +288,9 @@ class PushNotificationService { } static Future _firebaseMessagingBackgroundHandler( - RemoteMessage message) async {} + RemoteMessage message) async { + log('Handling a background message: ${message.messageId}'); + } } class NotificationHandler { diff --git a/lib/components/templates_components/details_component/details_component_action.dart b/lib/components/templates_components/details_component/details_component_action.dart index dd023556..d3805086 100644 --- a/lib/components/templates_components/details_component/details_component_action.dart +++ b/lib/components/templates_components/details_component/details_component_action.dart @@ -10,6 +10,7 @@ import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:hub/flutter_flow/flutter_flow_widgets.dart'; import 'package:hub/flutter_flow/internationalization.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; +import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart'; import 'package:rxdart/rxdart.dart'; import 'package:share_plus/share_plus.dart'; @@ -111,24 +112,15 @@ Widget buildDetails( Navigator.pop(context); Navigator.pop(context); - context.pushNamed( - 'scheduleCompleteVisitPage', - queryParameters: { - 'dropdownValue1': visitaWrapItem['MOT_DESCRICAO'], - 'dropdownValue2': serializeParam( - visitaWrapItem['NAC_DESCRICAO'], - ParamType.String, - ), - 'visitorStrList': serializeParam( - visitaWrapItem['VTE_DOCUMENTO'], - ParamType.String, - ), - 'visitorJsonList': serializeParam( - [visitaWrapItem], - ParamType.JSON, - isList: true, - ), - }.withoutNulls, + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ScheduleCompleteVisitPageWidget( + dropdownValue1: visitaWrapItem['MOT_DESCRICAO'], + dropdownValue2: visitaWrapItem['NAC_DESCRICAO'], + visitorJsonList: [visitaWrapItem], + visitorStrList: visitaWrapItem['VTE_DOCUMENTO'], + )), ); }, options: FFButtonOptions( diff --git a/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart b/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart index 2b8c7afb..16f06d15 100644 --- a/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart +++ b/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart @@ -30,10 +30,14 @@ import 'package:provider/provider.dart'; class ScheduleCompleteVisitPageWidget extends StatefulWidget { const ScheduleCompleteVisitPageWidget({ super.key, + this.dropdownValue1, + this.dropdownValue2, this.visitorStrList, this.visitorJsonList, }); + final String? dropdownValue1; + final String? dropdownValue2; final String? visitorStrList; final List? visitorJsonList; @@ -75,12 +79,23 @@ class _ScheduleCompleteVisitPageWidgetState .toList() .cast(); _model.visitorStrList = widget.visitorStrList!; + + safeSetState(() {}); + } else { + return; + } + + if ((widget.dropdownValue1 != null && widget.dropdownValue1 != '') && + (widget.dropdownValue2 != null && widget.dropdownValue2 != '')) { + _model.dropDownValue1 = widget.dropdownValue1!; + log('_model.dropdownValue1: ${_model.dropDownValue1 ?? ''}'); + _model.dropDownValue2 = widget.dropdownValue2!; + log('_model.dropdownValue2: ${_model.dropDownValue2 ?? ''}'); safeSetState(() {}); } else { return; } }); - _model.tabBarController = TabController( vsync: this, length: 2, @@ -1075,7 +1090,6 @@ Widget scheduleVisit(BuildContext context, atividade: 'getDados', ), builder: (context, snapshot) { - // Customize what your widget looks like when it's loading. if (!snapshot.hasData) { return Center( child: SizedBox( @@ -1095,14 +1109,32 @@ Widget scheduleVisit(BuildContext context, PhpGroup.getDadosCall.reasonsJsonList( dropDownGetDadosResponse.jsonBody, ); + // Algoritmo de match + if (_model.dropDownValue1 != null && + _model.dropDownValue1!.isNotEmpty) { + final matchedValue = + reasonsJsonList?.firstWhere( + (element) => + element.toString() == + _model.dropDownValue1, + orElse: () => null, + ); + if (matchedValue != null) { + WidgetsBinding.instance + .addPostFrameCallback((_) { + _model.dropDownValueController1 + ?.value = matchedValue.toString(); + }); + } + } + return FlutterFlowDropDown( fillColor: FlutterFlowTheme.of(context) .primaryBackground, controller: _model.dropDownValueController1 ??= FormFieldController( - _model.dropDownValue1 ??= '', - ), + _model.dropDownValue1 ?? ''), options: reasonsJsonList != null && reasonsJsonList != [] ? List.from(