fix null safety issue in schema_util.dart

This commit is contained in:
Jonatas Antunes Messias 2024-06-20 11:20:45 -03:00
commit 61d221cb88
20 changed files with 1067 additions and 831 deletions

View File

@ -44,7 +44,7 @@
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
6436409C27A31CD100820AF7 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = "<group>"; }; 6436409227A31CD500820AF7 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = "<group>"; };
6436409227A31CD300820AF7 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; }; 6436409227A31CD300820AF7 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
@ -225,7 +225,7 @@
6436409C27A31CD800820AF7 /* InfoPlist.strings */ = { 6436409C27A31CD800820AF7 /* InfoPlist.strings */ = {
isa = PBXVariantGroup; isa = PBXVariantGroup;
children = ( children = (
6436409C27A31CD100820AF7 /* pt */, 6436409227A31CD500820AF7 /* pt */,
6436409227A31CD300820AF7 /* en */, 6436409227A31CD300820AF7 /* en */,
); );
name = InfoPlist.strings; name = InfoPlist.strings;

View File

@ -113,6 +113,7 @@ Future singInActionApp(
false, false,
), ),
); );
if (PhpGroup.loginCall.error( if (PhpGroup.loginCall.error(
(loginCall.jsonBody ?? ''), (loginCall.jsonBody ?? ''),
) == ) ==
@ -214,6 +215,7 @@ Future<bool> signUpActionApp(
false, false,
), ),
); );
if (PhpGroup.registerCall.error( if (PhpGroup.registerCall.error(
(registerCall.jsonBody ?? ''), (registerCall.jsonBody ?? ''),
) == ) ==
@ -266,6 +268,7 @@ Future forgotPasswdAction(
forgotPasswd = await PhpGroup.forgotPasswordCall.call( forgotPasswd = await PhpGroup.forgotPasswordCall.call(
email: email, email: email,
); );
if (PhpGroup.forgotPasswordCall.error( if (PhpGroup.forgotPasswordCall.error(
(forgotPasswd.jsonBody ?? ''), (forgotPasswd.jsonBody ?? ''),
) == ) ==

View File

@ -32,6 +32,8 @@ class PhpGroup {
static GetVisitsCall getVisitsCall = GetVisitsCall(); static GetVisitsCall getVisitsCall = GetVisitsCall();
static DeleteVisitCall deleteVisitCall = DeleteVisitCall(); static DeleteVisitCall deleteVisitCall = DeleteVisitCall();
static GetPessoasLocalCall getPessoasLocalCall = GetPessoasLocalCall(); static GetPessoasLocalCall getPessoasLocalCall = GetPessoasLocalCall();
static RespondeSolicitacaoCall respondeSolicitacaoCall =
RespondeSolicitacaoCall();
} }
class UpdToken { class UpdToken {
@ -98,6 +100,7 @@ class LoginCall {
encodeBodyUtf8: false, encodeBodyUtf8: false,
decodeUtf8: false, decodeUtf8: false,
cache: false, cache: false,
isStreamingApi: false,
alwaysAllowBody: false, alwaysAllowBody: false,
); );
} }
@ -182,6 +185,7 @@ class RegisterCall {
encodeBodyUtf8: false, encodeBodyUtf8: false,
decodeUtf8: false, decodeUtf8: false,
cache: false, cache: false,
isStreamingApi: false,
alwaysAllowBody: false, alwaysAllowBody: false,
); );
} }
@ -237,6 +241,7 @@ class ForgotPasswordCall {
encodeBodyUtf8: false, encodeBodyUtf8: false,
decodeUtf8: false, decodeUtf8: false,
cache: false, cache: false,
isStreamingApi: false,
alwaysAllowBody: false, alwaysAllowBody: false,
); );
} }
@ -274,6 +279,7 @@ class GetLocalsCall {
encodeBodyUtf8: false, encodeBodyUtf8: false,
decodeUtf8: false, decodeUtf8: false,
cache: false, cache: false,
isStreamingApi: false,
alwaysAllowBody: false, alwaysAllowBody: false,
); );
} }
@ -360,6 +366,7 @@ class PostScheduleVisitorCall {
encodeBodyUtf8: false, encodeBodyUtf8: false,
decodeUtf8: false, decodeUtf8: false,
cache: false, cache: false,
isStreamingApi: false,
alwaysAllowBody: false, alwaysAllowBody: false,
); );
} }
@ -417,6 +424,7 @@ class PostScheduleVisitCall {
encodeBodyUtf8: false, encodeBodyUtf8: false,
decodeUtf8: false, decodeUtf8: false,
cache: false, cache: false,
isStreamingApi: false,
alwaysAllowBody: false, alwaysAllowBody: false,
); );
} }
@ -474,6 +482,7 @@ class DebugCallCall {
encodeBodyUtf8: false, encodeBodyUtf8: false,
decodeUtf8: false, decodeUtf8: false,
cache: false, cache: false,
isStreamingApi: false,
alwaysAllowBody: false, alwaysAllowBody: false,
); );
} }
@ -521,6 +530,7 @@ class GetScheduleVisitCall {
encodeBodyUtf8: false, encodeBodyUtf8: false,
decodeUtf8: false, decodeUtf8: false,
cache: false, cache: false,
isStreamingApi: false,
alwaysAllowBody: false, alwaysAllowBody: false,
); );
} }
@ -791,6 +801,7 @@ class GetDadosCall {
encodeBodyUtf8: false, encodeBodyUtf8: false,
decodeUtf8: false, decodeUtf8: false,
cache: false, cache: false,
isStreamingApi: false,
alwaysAllowBody: false, alwaysAllowBody: false,
); );
} }
@ -1033,6 +1044,7 @@ class GetVisitorByDocCall {
encodeBodyUtf8: false, encodeBodyUtf8: false,
decodeUtf8: false, decodeUtf8: false,
cache: false, cache: false,
isStreamingApi: false,
alwaysAllowBody: false, alwaysAllowBody: false,
); );
} }
@ -1102,6 +1114,7 @@ class GetFotoVisitanteCall {
encodeBodyUtf8: false, encodeBodyUtf8: false,
decodeUtf8: false, decodeUtf8: false,
cache: false, cache: false,
isStreamingApi: false,
alwaysAllowBody: false, alwaysAllowBody: false,
); );
} }
@ -1142,6 +1155,7 @@ class PostProvVisitSchedulingCall {
encodeBodyUtf8: false, encodeBodyUtf8: false,
decodeUtf8: false, decodeUtf8: false,
cache: false, cache: false,
isStreamingApi: false,
alwaysAllowBody: false, alwaysAllowBody: false,
); );
} }
@ -1183,6 +1197,7 @@ class GetVisitsCall {
encodeBodyUtf8: false, encodeBodyUtf8: false,
decodeUtf8: false, decodeUtf8: false,
cache: false, cache: false,
isStreamingApi: false,
alwaysAllowBody: false, alwaysAllowBody: false,
); );
} }
@ -1443,6 +1458,7 @@ class DeleteVisitCall {
encodeBodyUtf8: false, encodeBodyUtf8: false,
decodeUtf8: false, decodeUtf8: false,
cache: false, cache: false,
isStreamingApi: false,
alwaysAllowBody: false, alwaysAllowBody: false,
); );
} }
@ -1484,6 +1500,7 @@ class GetPessoasLocalCall {
encodeBodyUtf8: false, encodeBodyUtf8: false,
decodeUtf8: false, decodeUtf8: false,
cache: false, cache: false,
isStreamingApi: false,
alwaysAllowBody: false, alwaysAllowBody: false,
); );
} }
@ -1517,6 +1534,45 @@ class GetPessoasLocalCall {
.toList(); .toList();
} }
class RespondeSolicitacaoCall {
Future<ApiCallResponse> call({
String? userUUID = '',
String? devUUID = '',
String? atividade = '',
String? referencia = '',
String? tarefa = '',
String? idDestino = '',
String? idVisitante = '',
}) async {
final baseUrl = PhpGroup.getBaseUrl();
return ApiManager.instance.makeApiCall(
callName: 'respondeSolicitacao',
apiUrl: '$baseUrl/processRequest.php',
callType: ApiCallType.POST,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
params: {
'userUUID': userUUID,
'devUUID': devUUID,
'atividade': atividade,
'referencia': referencia,
'tarefa': tarefa,
'idDestino': idDestino,
'idVisitante': idVisitante,
},
bodyType: BodyType.X_WWW_FORM_URL_ENCODED,
returnBody: true,
encodeBodyUtf8: false,
decodeUtf8: false,
cache: false,
isStreamingApi: false,
alwaysAllowBody: false,
);
}
}
/// End PHP Group Code /// End PHP Group Code
class ApiPagingParams { class ApiPagingParams {

View File

@ -13,6 +13,8 @@ import 'package:mime_type/mime_type.dart';
import '/flutter_flow/uploaded_file.dart'; import '/flutter_flow/uploaded_file.dart';
import 'get_streamed_response.dart';
enum ApiCallType { enum ApiCallType {
GET, GET,
POST, POST,
@ -43,6 +45,7 @@ class ApiCallOptions extends Equatable {
this.decodeUtf8 = false, this.decodeUtf8 = false,
this.alwaysAllowBody = false, this.alwaysAllowBody = false,
this.cache = false, this.cache = false,
this.isStreamingApi = false,
}); });
final String callName; final String callName;
@ -57,6 +60,7 @@ class ApiCallOptions extends Equatable {
final bool decodeUtf8; final bool decodeUtf8;
final bool alwaysAllowBody; final bool alwaysAllowBody;
final bool cache; final bool cache;
final bool isStreamingApi;
ApiCallOptions clone() => ApiCallOptions( ApiCallOptions clone() => ApiCallOptions(
callName: callName, callName: callName,
@ -71,6 +75,7 @@ class ApiCallOptions extends Equatable {
decodeUtf8: decodeUtf8, decodeUtf8: decodeUtf8,
alwaysAllowBody: alwaysAllowBody, alwaysAllowBody: alwaysAllowBody,
cache: cache, cache: cache,
isStreamingApi: isStreamingApi,
); );
@override @override
@ -87,6 +92,7 @@ class ApiCallOptions extends Equatable {
decodeUtf8, decodeUtf8,
alwaysAllowBody, alwaysAllowBody,
cache, cache,
isStreamingApi,
]; ];
static Map<String, dynamic> _cloneMap(Map<String, dynamic> map) { static Map<String, dynamic> _cloneMap(Map<String, dynamic> map) {
@ -104,12 +110,14 @@ class ApiCallResponse {
this.headers, this.headers,
this.statusCode, { this.statusCode, {
this.response, this.response,
this.streamedResponse,
this.exception, this.exception,
}); });
final dynamic jsonBody; final dynamic jsonBody;
final Map<String, String> headers; final Map<String, String> headers;
final int statusCode; final int statusCode;
final http.Response? response; final http.Response? response;
final http.StreamedResponse? streamedResponse;
final Object? exception; final Object? exception;
// Whether we received a 2xx status (which generally marks success). // Whether we received a 2xx status (which generally marks success).
bool get succeeded => statusCode >= 200 && statusCode < 300; bool get succeeded => statusCode >= 200 && statusCode < 300;
@ -183,7 +191,8 @@ class ApiManager {
Map<String, dynamic> headers, Map<String, dynamic> headers,
Map<String, dynamic> params, Map<String, dynamic> params,
bool returnBody, bool returnBody,
bool decodeUtf8, { bool decodeUtf8,
bool isStreamingApi, {
http.Client? client, http.Client? client,
}) async { }) async {
if (params.isNotEmpty) { if (params.isNotEmpty) {
@ -191,6 +200,19 @@ class ApiManager {
Uri.parse(apiUrl).queryParameters.isNotEmpty ? '&' : '?'; Uri.parse(apiUrl).queryParameters.isNotEmpty ? '&' : '?';
apiUrl = '$apiUrl$specifier${asQueryParams(params)}'; apiUrl = '$apiUrl$specifier${asQueryParams(params)}';
} }
if (isStreamingApi) {
client ??= http.Client();
final request =
http.Request(callType.toString().split('.').last, Uri.parse(apiUrl))
..headers.addAll(toStringMap(headers));
final streamedResponse = await getStreamedResponse(request);
return ApiCallResponse(
null,
streamedResponse.headers,
streamedResponse.statusCode,
streamedResponse: streamedResponse,
);
}
final makeRequest = callType == ApiCallType.GET final makeRequest = callType == ApiCallType.GET
? (client != null ? client.get : http.get) ? (client != null ? client.get : http.get)
: (client != null ? client.delete : http.delete); : (client != null ? client.delete : http.delete);
@ -209,7 +231,8 @@ class ApiManager {
bool returnBody, bool returnBody,
bool encodeBodyUtf8, bool encodeBodyUtf8,
bool decodeUtf8, bool decodeUtf8,
bool alwaysAllowBody, { bool alwaysAllowBody,
bool isStreamingApi, {
http.Client? client, http.Client? client,
}) async { }) async {
assert( assert(
@ -219,6 +242,20 @@ class ApiManager {
); );
final postBody = final postBody =
createBody(headers, params, body, bodyType, encodeBodyUtf8); createBody(headers, params, body, bodyType, encodeBodyUtf8);
if (isStreamingApi) {
client ??= http.Client();
final request =
http.Request(type.toString().split('.').last, Uri.parse(apiUrl))
..headers.addAll(toStringMap(headers));
request.body = postBody;
final streamedResponse = await getStreamedResponse(request);
return ApiCallResponse(
null,
streamedResponse.headers,
streamedResponse.statusCode,
streamedResponse: streamedResponse,
);
}
if (bodyType == BodyType.MULTIPART) { if (bodyType == BodyType.MULTIPART) {
return multipartRequest(type, apiUrl, headers, params, returnBody, return multipartRequest(type, apiUrl, headers, params, returnBody,
@ -352,6 +389,7 @@ class ApiManager {
decodeUtf8: options.decodeUtf8, decodeUtf8: options.decodeUtf8,
alwaysAllowBody: options.alwaysAllowBody, alwaysAllowBody: options.alwaysAllowBody,
cache: options.cache, cache: options.cache,
isStreamingApi: options.isStreamingApi,
options: options, options: options,
); );
@ -368,6 +406,7 @@ class ApiManager {
bool decodeUtf8 = false, bool decodeUtf8 = false,
bool alwaysAllowBody = false, bool alwaysAllowBody = false,
bool cache = false, bool cache = false,
bool isStreamingApi = false,
ApiCallOptions? options, ApiCallOptions? options,
http.Client? client, http.Client? client,
}) async { }) async {
@ -385,6 +424,7 @@ class ApiManager {
decodeUtf8: decodeUtf8, decodeUtf8: decodeUtf8,
alwaysAllowBody: alwaysAllowBody, alwaysAllowBody: alwaysAllowBody,
cache: cache, cache: cache,
isStreamingApi: isStreamingApi,
); );
// Modify for your specific needs if this differs from your API. // Modify for your specific needs if this differs from your API.
if (_accessToken != null) { if (_accessToken != null) {
@ -411,6 +451,7 @@ class ApiManager {
params, params,
returnBody, returnBody,
decodeUtf8, decodeUtf8,
isStreamingApi,
client: client, client: client,
); );
break; break;
@ -427,6 +468,7 @@ class ApiManager {
encodeBodyUtf8, encodeBodyUtf8,
decodeUtf8, decodeUtf8,
alwaysAllowBody, alwaysAllowBody,
isStreamingApi,
client: client, client: client,
) )
: await urlRequest( : await urlRequest(
@ -436,6 +478,7 @@ class ApiManager {
params, params,
returnBody, returnBody,
decodeUtf8, decodeUtf8,
isStreamingApi,
client: client, client: client,
); );
break; break;
@ -453,6 +496,7 @@ class ApiManager {
encodeBodyUtf8, encodeBodyUtf8,
decodeUtf8, decodeUtf8,
alwaysAllowBody, alwaysAllowBody,
isStreamingApi,
client: client, client: client,
); );
break; break;

View File

@ -0,0 +1,4 @@
import 'package:http/http.dart';
Future<StreamedResponse> getStreamedResponse(Request request) =>
Client().send(request);

View File

@ -77,11 +77,3 @@ List<Color>? getColorsList(dynamic value) =>
List<T>? getDataList<T>(dynamic value) => List<T>? getDataList<T>(dynamic value) =>
value is! List ? null : value.map((e) => castToType<T>(e)!).toList(); value is! List ? null : value.map((e) => castToType<T>(e)!).toList();
extension MapDataExtensions on Map<String, dynamic> {
Map<String, dynamic> get withoutNulls => Map.fromEntries(
entries
.where((e) => e.value != null)
.map((e) => MapEntry(e.key, e.value!)),
);
}

View File

@ -65,59 +65,84 @@ class _ThrowExceptionWidgetState extends State<ThrowExceptionWidget>
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Stack( Padding(
children: [ padding: const EdgeInsetsDirectional.fromSTEB(10.0, 0.0, 10.0, 0.0),
Align( child: Container(
alignment: const AlignmentDirectional(0.0, 0.0), height: 400.0,
child: Icon( decoration: BoxDecoration(
Icons.circle_outlined, color: FlutterFlowTheme.of(context).primaryBackground,
color: FlutterFlowTheme.of(context).error, borderRadius: const BorderRadius.only(
size: 200.0, bottomLeft: Radius.circular(10.0),
bottomRight: Radius.circular(10.0),
topLeft: Radius.circular(10.0),
topRight: Radius.circular(10.0),
), ),
), ),
Align( child: Column(
alignment: const AlignmentDirectional(0.0, 0.0), mainAxisSize: MainAxisSize.max,
child: Icon( mainAxisAlignment: MainAxisAlignment.center,
Icons.close_outlined, children: [
color: FlutterFlowTheme.of(context).error, Stack(
size: 200.0, children: [
), Align(
), alignment: const AlignmentDirectional(0.0, 0.0),
], child: Icon(
).animateOnPageLoad(animationsMap['stackOnPageLoadAnimation']!), Icons.circle_outlined,
Column( color: FlutterFlowTheme.of(context).error,
mainAxisSize: MainAxisSize.max, size: 200.0,
mainAxisAlignment: MainAxisAlignment.start, ),
children: [
Text(
FFLocalizations.of(context).getText(
'e58xxxiq' /* ERRO */,
),
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
fontSize: 20.0,
letterSpacing: 0.0,
fontWeight: FontWeight.bold,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).bodyMediumFamily),
),
),
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 10.0, 0.0, 0.0),
child: Text(
valueOrDefault<String>(
widget.msg,
'Message Not Found',
),
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).bodyMediumFamily),
), ),
), Align(
alignment: const AlignmentDirectional(0.0, 0.0),
child: Icon(
Icons.close_outlined,
color: FlutterFlowTheme.of(context).error,
size: 200.0,
),
),
],
).animateOnPageLoad(animationsMap['stackOnPageLoadAnimation']!),
Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
FFLocalizations.of(context).getText(
'e58xxxiq' /* ERRO */,
),
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily:
FlutterFlowTheme.of(context).bodyMediumFamily,
fontSize: 20.0,
letterSpacing: 0.0,
fontWeight: FontWeight.bold,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).bodyMediumFamily),
),
),
Padding(
padding:
const EdgeInsetsDirectional.fromSTEB(0.0, 10.0, 0.0, 0.0),
child: Text(
valueOrDefault<String>(
widget.msg,
'Message Not Found',
),
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily:
FlutterFlowTheme.of(context).bodyMediumFamily,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context)
.bodyMediumFamily),
),
),
),
].addToStart(const SizedBox(height: 50.0)),
),
],
), ),
].addToStart(const SizedBox(height: 50.0)), ),
), ),
], ],
); );

View File

@ -933,6 +933,7 @@ class _ScheduleVisitDetailWidgetState extends State<ScheduleVisitDetailWidget> {
obs: widget.visitObsStr, obs: widget.visitObsStr,
cliID: FFAppState().cliUUID, cliID: FFAppState().cliUUID,
); );
if (PhpGroup.postScheduleVisitCall.error( if (PhpGroup.postScheduleVisitCall.error(
(_model.postScheduleVisit?.jsonBody ?? ''), (_model.postScheduleVisit?.jsonBody ?? ''),
) == ) ==

View File

@ -793,6 +793,7 @@ class _ViewVisitDetailWidgetState extends State<ViewVisitDetailWidget> {
atividade: 'cancelaVisita', atividade: 'cancelaVisita',
idVisita: widget.visitIdStr, idVisita: widget.visitIdStr,
); );
if (PhpGroup.deleteVisitCall.error( if (PhpGroup.deleteVisitCall.error(
(_model.deleteVisit?.jsonBody ?? ''), (_model.deleteVisit?.jsonBody ?? ''),
) == ) ==

View File

@ -242,6 +242,7 @@ class _ForgotPasswordTemplateComponentWidgetState
_model.req = await PhpGroup.forgotPasswordCall.call( _model.req = await PhpGroup.forgotPasswordCall.call(
email: _model.emailAddressTextController.text, email: _model.emailAddressTextController.text,
); );
shouldSetState = true; shouldSetState = true;
if (PhpGroup.forgotPasswordCall.error( if (PhpGroup.forgotPasswordCall.error(
(_model.req?.jsonBody ?? ''), (_model.req?.jsonBody ?? ''),

View File

@ -722,6 +722,7 @@ class _RegisiterVistorTemplateComponentWidgetState
: 'P', : 'P',
foto: 'base64;jpeg,klajsalkjslkajslkajl', foto: 'base64;jpeg,klajsalkjslkajslkajl',
); );
if (PhpGroup.postScheduleVisitorCall.error( if (PhpGroup.postScheduleVisitorCall.error(
(_model.registerVisitor?.jsonBody ?? ''), (_model.registerVisitor?.jsonBody ?? ''),
) == ) ==

View File

@ -11,16 +11,30 @@ export 'visit_request_template_component_model.dart';
class VisitRequestTemplateComponentWidget extends StatefulWidget { class VisitRequestTemplateComponentWidget extends StatefulWidget {
const VisitRequestTemplateComponentWidget({ const VisitRequestTemplateComponentWidget({
super.key, super.key,
required this.name, this.vteName,
required this.reason, this.vteReason,
required this.message, this.vteMsg,
required this.document, this.vteDocument,
this.cliUUID,
this.vteUUID,
this.vawName,
this.msgUUID,
this.vawRef,
this.vawUUID,
this.vawDestino,
}); });
final String? name; final String? vteName;
final String? reason; final String? vteReason;
final String? message; final String? vteMsg;
final String? document; final String? vteDocument;
final String? cliUUID;
final String? vteUUID;
final String? vawName;
final String? msgUUID;
final String? vawRef;
final String? vawUUID;
final String? vawDestino;
@override @override
State<VisitRequestTemplateComponentWidget> createState() => State<VisitRequestTemplateComponentWidget> createState() =>
@ -42,13 +56,13 @@ class _VisitRequestTemplateComponentWidgetState
super.initState(); super.initState();
_model = createModel(context, () => VisitRequestTemplateComponentModel()); _model = createModel(context, () => VisitRequestTemplateComponentModel());
_model.textController1 ??= TextEditingController(text: widget.name); _model.textController1 ??= TextEditingController(text: widget.vteName);
_model.textFieldFocusNode1 ??= FocusNode(); _model.textFieldFocusNode1 ??= FocusNode();
_model.textController2 ??= TextEditingController(text: widget.reason); _model.textController2 ??= TextEditingController(text: widget.vteReason);
_model.textFieldFocusNode2 ??= FocusNode(); _model.textFieldFocusNode2 ??= FocusNode();
_model.textController3 ??= TextEditingController(text: widget.message); _model.textController3 ??= TextEditingController(text: widget.vteMsg);
_model.textFieldFocusNode3 ??= FocusNode(); _model.textFieldFocusNode3 ??= FocusNode();
_model.textController4 ??= TextEditingController(); _model.textController4 ??= TextEditingController();
@ -71,6 +85,7 @@ class _VisitRequestTemplateComponentWidgetState
child: Padding( child: Padding(
padding: const EdgeInsetsDirectional.fromSTEB(10.0, 0.0, 10.0, 0.0), padding: const EdgeInsetsDirectional.fromSTEB(10.0, 0.0, 10.0, 0.0),
child: Container( child: Container(
width: MediaQuery.sizeOf(context).width * 0.9,
decoration: BoxDecoration( decoration: BoxDecoration(
color: FlutterFlowTheme.of(context).primaryBackground, color: FlutterFlowTheme.of(context).primaryBackground,
borderRadius: const BorderRadius.only( borderRadius: const BorderRadius.only(
@ -90,17 +105,17 @@ class _VisitRequestTemplateComponentWidgetState
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Container( Container(
width: 200.0, width: 150.0,
height: 200.0, height: 150.0,
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
decoration: const BoxDecoration( decoration: const BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
), ),
child: CachedNetworkImage( child: CachedNetworkImage(
fadeInDuration: const Duration(milliseconds: 500), fadeInDuration: const Duration(milliseconds: 100),
fadeOutDuration: const Duration(milliseconds: 500), fadeOutDuration: const Duration(milliseconds: 100),
imageUrl: valueOrDefault<String>( imageUrl: valueOrDefault<String>(
'https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${widget.document}&tipo=E', 'https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${widget.vteDocument}&tipo=E',
'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg', 'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg',
), ),
fit: BoxFit.cover, fit: BoxFit.cover,
@ -272,6 +287,124 @@ class _VisitRequestTemplateComponentWidgetState
_model.textController2Validator.asValidator(context), _model.textController2Validator.asValidator(context),
), ),
), ),
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(
24.0, 0.0, 24.0, 0.0),
child: TextFormField(
controller: _model.textController1,
focusNode: _model.textFieldFocusNode1,
autofocus: false,
textInputAction: TextInputAction.next,
readOnly: true,
obscureText: false,
decoration: InputDecoration(
isDense: true,
labelText: FFLocalizations.of(context).getText(
'ivfw4j04' /* Nome */,
),
labelStyle: FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily:
FlutterFlowTheme.of(context).labelMediumFamily,
color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).labelMediumFamily),
),
hintStyle: FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily:
FlutterFlowTheme.of(context).labelMediumFamily,
color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).labelMediumFamily),
),
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
errorBorder: InputBorder.none,
focusedErrorBorder: InputBorder.none,
suffixIcon: Icon(
Icons.person,
color: FlutterFlowTheme.of(context).accent1,
),
),
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily:
FlutterFlowTheme.of(context).bodyMediumFamily,
color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).bodyMediumFamily),
),
textAlign: TextAlign.start,
maxLines: null,
keyboardType: TextInputType.name,
validator:
_model.textController1Validator.asValidator(context),
),
),
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(
24.0, 0.0, 24.0, 0.0),
child: TextFormField(
controller: _model.textController2,
focusNode: _model.textFieldFocusNode2,
autofocus: false,
textInputAction: TextInputAction.next,
readOnly: true,
obscureText: false,
decoration: InputDecoration(
isDense: true,
labelText: FFLocalizations.of(context).getText(
'ndzkqehm' /* Motivo */,
),
labelStyle: FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily:
FlutterFlowTheme.of(context).labelMediumFamily,
color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).labelMediumFamily),
),
hintStyle: FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily:
FlutterFlowTheme.of(context).labelMediumFamily,
color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).labelMediumFamily),
),
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
errorBorder: InputBorder.none,
focusedErrorBorder: InputBorder.none,
suffixIcon: Icon(
Icons.history_edu,
color: FlutterFlowTheme.of(context).accent1,
),
),
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily:
FlutterFlowTheme.of(context).bodyMediumFamily,
color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).bodyMediumFamily),
),
textAlign: TextAlign.start,
maxLines: null,
keyboardType: TextInputType.name,
validator:
_model.textController2Validator.asValidator(context),
),
),
Padding( Padding(
padding: const EdgeInsetsDirectional.fromSTEB( padding: const EdgeInsetsDirectional.fromSTEB(
24.0, 0.0, 24.0, 0.0), 24.0, 0.0, 24.0, 0.0),
@ -284,6 +417,7 @@ class _VisitRequestTemplateComponentWidgetState
readOnly: true, readOnly: true,
obscureText: false, obscureText: false,
decoration: InputDecoration( decoration: InputDecoration(
isDense: true,
labelText: FFLocalizations.of(context).getText( labelText: FFLocalizations.of(context).getText(
'kt87omsz' /* Mensagem */, 'kt87omsz' /* Mensagem */,
), ),
@ -306,34 +440,10 @@ class _VisitRequestTemplateComponentWidgetState
useGoogleFonts: GoogleFonts.asMap().containsKey( useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).labelMediumFamily), FlutterFlowTheme.of(context).labelMediumFamily),
), ),
enabledBorder: OutlineInputBorder( enabledBorder: InputBorder.none,
borderSide: BorderSide( focusedBorder: InputBorder.none,
color: FlutterFlowTheme.of(context).accent1, errorBorder: InputBorder.none,
width: 0.5, focusedErrorBorder: InputBorder.none,
),
borderRadius: BorderRadius.circular(10.0),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).primary,
width: 0.5,
),
borderRadius: BorderRadius.circular(10.0),
),
errorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).error,
width: 0.5,
),
borderRadius: BorderRadius.circular(10.0),
),
focusedErrorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).error,
width: 0.5,
),
borderRadius: BorderRadius.circular(10.0),
),
suffixIcon: Icon( suffixIcon: Icon(
Icons.message, Icons.message,
color: FlutterFlowTheme.of(context).accent1, color: FlutterFlowTheme.of(context).accent1,
@ -347,13 +457,14 @@ class _VisitRequestTemplateComponentWidgetState
useGoogleFonts: GoogleFonts.asMap().containsKey( useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).bodyMediumFamily), FlutterFlowTheme.of(context).bodyMediumFamily),
), ),
textAlign: TextAlign.start,
validator: validator:
_model.textController3Validator.asValidator(context), _model.textController3Validator.asValidator(context),
), ),
), ),
Padding( Padding(
padding: const EdgeInsetsDirectional.fromSTEB( padding: const EdgeInsetsDirectional.fromSTEB(
24.0, 0.0, 24.0, 0.0), 24.0, 20.0, 24.0, 20.0),
child: TextFormField( child: TextFormField(
controller: _model.textController4, controller: _model.textController4,
focusNode: _model.textFieldFocusNode4, focusNode: _model.textFieldFocusNode4,
@ -361,6 +472,7 @@ class _VisitRequestTemplateComponentWidgetState
textInputAction: TextInputAction.next, textInputAction: TextInputAction.next,
obscureText: false, obscureText: false,
decoration: InputDecoration( decoration: InputDecoration(
isDense: true,
labelText: FFLocalizations.of(context).getText( labelText: FFLocalizations.of(context).getText(
'ssz899es' /* Pergunta */, 'ssz899es' /* Pergunta */,
), ),
@ -437,9 +549,9 @@ class _VisitRequestTemplateComponentWidgetState
borderRadius: 20.0, borderRadius: 20.0,
borderWidth: 1.0, borderWidth: 1.0,
buttonSize: 40.0, buttonSize: 40.0,
fillColor: FlutterFlowTheme.of(context).success, fillColor: FlutterFlowTheme.of(context).error,
icon: Icon( icon: Icon(
Icons.done, Icons.close,
color: FlutterFlowTheme.of(context).primaryBackground, color: FlutterFlowTheme.of(context).primaryBackground,
size: 24.0, size: 24.0,
), ),
@ -451,9 +563,9 @@ class _VisitRequestTemplateComponentWidgetState
borderRadius: 20.0, borderRadius: 20.0,
borderWidth: 1.0, borderWidth: 1.0,
buttonSize: 40.0, buttonSize: 40.0,
fillColor: FlutterFlowTheme.of(context).error, fillColor: FlutterFlowTheme.of(context).success,
icon: Icon( icon: Icon(
Icons.close, Icons.done,
color: FlutterFlowTheme.of(context).primaryBackground, color: FlutterFlowTheme.of(context).primaryBackground,
size: 24.0, size: 24.0,
), ),
@ -464,7 +576,7 @@ class _VisitRequestTemplateComponentWidgetState
].divide(const SizedBox(width: 20.0)), ].divide(const SizedBox(width: 20.0)),
), ),
] ]
.divide(const SizedBox(height: 20.0)) .divide(const SizedBox(height: 10.0))
.addToStart(const SizedBox(height: 20.0)) .addToStart(const SizedBox(height: 20.0))
.addToEnd(const SizedBox(height: 20.0)), .addToEnd(const SizedBox(height: 20.0)),
), ),

View File

@ -107,6 +107,7 @@ class _VisitorSearchModalTemplateComponentWidgetState
atividade: 'getVisitante', atividade: 'getVisitante',
documento: _model.textController.text, documento: _model.textController.text,
); );
if (PhpGroup.getVisitorByDocCall.vistanteId( if (PhpGroup.getVisitorByDocCall.vistanteId(
(_model.getVisitorByDoc?.jsonBody ?? ''), (_model.getVisitorByDoc?.jsonBody ?? ''),
) != ) !=

View File

@ -453,6 +453,14 @@ extension ListFilterExt<T> on Iterable<T?> {
List<T> get withoutNulls => where((s) => s != null).map((e) => e!).toList(); List<T> get withoutNulls => where((s) => s != null).map((e) => e!).toList();
} }
extension MapFilterExtensions<T> on Map<String, T?> {
Map<String, T> get withoutNulls => Map.fromEntries(
entries
.where((e) => e.value != null)
.map((e) => MapEntry(e.key, e.value as T)),
);
}
extension MapListContainsExt on List<dynamic> { extension MapListContainsExt on List<dynamic> {
bool containsMap(dynamic map) => map is Map bool containsMap(dynamic map) => map is Map
? any((e) => e is Map && const DeepCollectionEquality().equals(e, map)) ? any((e) => e is Map && const DeepCollectionEquality().equals(e, map))

View File

@ -4,6 +4,7 @@ import 'package:auto_size_text/auto_size_text.dart';
class FFButtonOptions { class FFButtonOptions {
const FFButtonOptions({ const FFButtonOptions({
this.textAlign,
this.textStyle, this.textStyle,
this.elevation, this.elevation,
this.height, this.height,
@ -25,6 +26,7 @@ class FFButtonOptions {
this.maxLines, this.maxLines,
}); });
final TextAlign? textAlign;
final TextStyle? textStyle; final TextStyle? textStyle;
final double? elevation; final double? elevation;
final double? height; final double? height;
@ -98,6 +100,7 @@ class _FFButtonWidgetState extends State<FFButtonWidget> {
text ?? '', text ?? '',
style: style:
text == null ? null : widget.options.textStyle?.withoutColor(), text == null ? null : widget.options.textStyle?.withoutColor(),
textAlign: widget.options.textAlign,
maxLines: maxLines, maxLines: maxLines,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
); );

View File

@ -8,3 +8,16 @@ class FormFieldController<T> extends ValueNotifier<T?> {
void reset() => value = initialValue; void reset() => value = initialValue;
void update() => notifyListeners(); void update() => notifyListeners();
} }
// If the initial value is a list (which it is for multiselect),
// we need to use this controller to avoid a pass by reference issue
// that can result in the initial value being modified.
class FormListFieldController<T> extends FormFieldController<List<T>> {
final List<T>? _initialListValue;
FormListFieldController(super.initialValue)
: _initialListValue = List<T>.from(initialValue ?? []);
@override
void reset() => value = List<T>.from(_initialListValue ?? []);
}

View File

@ -174,6 +174,10 @@ final kTranslationsMap = <Map<String, Map<String, String>>>[
'pt': 'Nome', 'pt': 'Nome',
'en': 'Name', 'en': 'Name',
}, },
'rl8tvwnr': {
'pt': 'Documento',
'en': 'Document',
},
'yp23q90m': { 'yp23q90m': {
'pt': 'Selecione o tipo:', 'pt': 'Selecione o tipo:',
'en': 'Select type:', 'en': 'Select type:',
@ -194,10 +198,6 @@ final kTranslationsMap = <Map<String, Map<String, String>>>[
'pt': 'Search for an item...', 'pt': 'Search for an item...',
'en': '', 'en': '',
}, },
'rl8tvwnr': {
'pt': 'Documento',
'en': 'Document',
},
'bqpucwh0': { 'bqpucwh0': {
'pt': 'Contatos', 'pt': 'Contatos',
'en': 'Contacts', 'en': 'Contacts',
@ -869,14 +869,6 @@ final kTranslationsMap = <Map<String, Map<String, String>>>[
'pt': '', 'pt': '',
'en': '', 'en': '',
}, },
'tg5rb52p': {
'pt': 'Aprovar',
'en': 'Allow',
},
'zz1jjh5j': {
'pt': 'Reprovar',
'en': 'Block',
},
}, },
// Miscellaneous // Miscellaneous
{ {

View File

@ -17,13 +17,13 @@ class RegisterVisitorPageModel
FocusNode? textFieldFocusNode1; FocusNode? textFieldFocusNode1;
TextEditingController? textController1; TextEditingController? textController1;
String? Function(BuildContext, String?)? textController1Validator; String? Function(BuildContext, String?)? textController1Validator;
// State field(s) for DropDown widget.
String? dropDownValue;
FormFieldController<String>? dropDownValueController;
// State field(s) for TextField widget. // State field(s) for TextField widget.
FocusNode? textFieldFocusNode2; FocusNode? textFieldFocusNode2;
TextEditingController? textController2; TextEditingController? textController2;
String? Function(BuildContext, String?)? textController2Validator; String? Function(BuildContext, String?)? textController2Validator;
// State field(s) for DropDown widget.
String? dropDownValue;
FormFieldController<String>? dropDownValueController;
// State field(s) for TextField widget. // State field(s) for TextField widget.
FocusNode? textFieldFocusNode3; FocusNode? textFieldFocusNode3;
TextEditingController? textController3; TextEditingController? textController3;

View File

@ -857,6 +857,7 @@ class _ScheduleProvisionalVisitPageWidgetState
nome: _model.textController2.text, nome: _model.textController2.text,
proID: FFAppState().ownerUUID, proID: FFAppState().ownerUUID,
); );
if (PhpGroup.postProvVisitSchedulingCall.error( if (PhpGroup.postProvVisitSchedulingCall.error(
(_model.provisionalVisitScheduling?.jsonBody ?? ''), (_model.provisionalVisitScheduling?.jsonBody ?? ''),
) == ) ==