diff --git a/lib/pages/people_on_the_property_page/people_on_the_property_page_widget.dart b/lib/pages/people_on_the_property_page/people_on_the_property_page_widget.dart index 0dbfce20..a8a20a8c 100644 --- a/lib/pages/people_on_the_property_page/people_on_the_property_page_widget.dart +++ b/lib/pages/people_on_the_property_page/people_on_the_property_page_widget.dart @@ -1,8 +1,11 @@ +import 'dart:developer'; + import 'package:hub/backend/api_requests/api_calls.dart'; import 'package:hub/flutter_flow/flutter_flow_icon_button.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; +import 'package:hub/flutter_flow/internationalization.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:hub/pages/people_on_the_property_page/people_on_the_property_page_model.dart'; @@ -13,6 +16,9 @@ import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; +import '../../shared/utils/dialog_util.dart'; +import '../../shared/utils/log_util.dart'; + class PeopleOnThePropertyPageWidget extends StatefulWidget { const PeopleOnThePropertyPageWidget({super.key}); @@ -106,9 +112,30 @@ class _PeopleOnThePropertyPageWidgetState ), ); } + + if (snapshot.hasError || snapshot.data?.exception != null) { + if (snapshot.error != null && snapshot.stackTrace != null) { + LogUtil.requestAPIFailed('getPessoasLocal.php', "", 'Busca Pessoas no Local', snapshot.error, snapshot.stackTrace!); + } + + return Center( + child: SizedBox( + width: double.infinity, + height: 100, + child: Text( + FFLocalizations.of(context).getVariableText( + ptText: "Pessoas não encontradas", + enText: "Persons not found" + ), + textAlign: TextAlign.center, + ), + ), + ); + } + final columnGetPessoasLocalResponse = snapshot.data!; - final getPoepleProperty = PhpGroup.getPessoasLocalCall.pessoas(columnGetPessoasLocalResponse.jsonBody,)?.toList() ?? - []; + final getPoepleProperty = PhpGroup.getPessoasLocalCall.pessoas(columnGetPessoasLocalResponse.jsonBody,)?.toList() ?? []; + return ListView.builder( physics: const AlwaysScrollableScrollPhysics(), shrinkWrap: true,