Merge pull request #15 from FRE-Informatica/bugfix/fd-606
Bugfix/fd 606
This commit is contained in:
commit
967754debc
|
@ -1716,7 +1716,7 @@ class RespondeSolicitacaoCall {
|
||||||
}
|
}
|
||||||
|
|
||||||
class GetAccessCall {
|
class GetAccessCall {
|
||||||
Stream<ApiCallResponse> call({
|
Future<ApiCallResponse> call({
|
||||||
String? devUUID = '',
|
String? devUUID = '',
|
||||||
String? userUUID = '',
|
String? userUUID = '',
|
||||||
String? cliID = '',
|
String? cliID = '',
|
||||||
|
@ -1726,11 +1726,8 @@ class GetAccessCall {
|
||||||
String? pesTipo = '',
|
String? pesTipo = '',
|
||||||
}) {
|
}) {
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
final StreamController<ApiCallResponse> controller = StreamController();
|
|
||||||
|
|
||||||
Future.microtask(() async {
|
return ApiManager.instance.makeApiCall(
|
||||||
try {
|
|
||||||
final response = await ApiManager.instance.makeApiCall(
|
|
||||||
callName: 'getAccess',
|
callName: 'getAccess',
|
||||||
apiUrl: '$baseUrl/processRequest.php',
|
apiUrl: '$baseUrl/processRequest.php',
|
||||||
callType: ApiCallType.POST,
|
callType: ApiCallType.POST,
|
||||||
|
@ -1754,15 +1751,6 @@ class GetAccessCall {
|
||||||
isStreamingApi: false,
|
isStreamingApi: false,
|
||||||
alwaysAllowBody: false,
|
alwaysAllowBody: false,
|
||||||
);
|
);
|
||||||
controller.add(response);
|
|
||||||
await controller.close();
|
|
||||||
} catch (e) {
|
|
||||||
controller.addError(e);
|
|
||||||
await controller.close();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return controller.stream;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool? error(dynamic response) => castToType<bool>(getJsonField(
|
bool? error(dynamic response) => castToType<bool>(getJsonField(
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'dart:ffi';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
|
@ -7,7 +8,6 @@ import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'package:hub/flutter_flow/internationalization.dart';
|
import 'package:hub/flutter_flow/internationalization.dart';
|
||||||
|
|
||||||
|
|
||||||
class OptModalWidget extends StatefulWidget {
|
class OptModalWidget extends StatefulWidget {
|
||||||
final String defaultPersonType;
|
final String defaultPersonType;
|
||||||
final String defaultAccessType;
|
final String defaultAccessType;
|
||||||
|
@ -30,10 +30,6 @@ class _OptModalWidgetState extends State<OptModalWidget> {
|
||||||
{'title': 'zok7lu4w', 'value': 'E'},
|
{'title': 'zok7lu4w', 'value': 'E'},
|
||||||
{'title': 'oonqk812', 'value': 'O'},
|
{'title': 'oonqk812', 'value': 'O'},
|
||||||
];
|
];
|
||||||
final List<Map<String, String>> accessTypeOptions = [
|
|
||||||
{'title': '580z80ct', 'value': '0'},
|
|
||||||
{'title': '1nbwqtzs', 'value': '1'},
|
|
||||||
];
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void setState(VoidCallback callback) {
|
void setState(VoidCallback callback) {
|
||||||
|
@ -89,7 +85,8 @@ class _OptModalWidgetState extends State<OptModalWidget> {
|
||||||
Navigator.pop(context, filterResult);
|
Navigator.pop(context, filterResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildCheckboxListTile(String key, List<Map<String, String>> options) {
|
Widget _buildCheckboxListTile(
|
||||||
|
String key, List<Map<String, String>> options, double fontsize) {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
|
@ -97,14 +94,13 @@ class _OptModalWidgetState extends State<OptModalWidget> {
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding:
|
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 3.0, 0.0, 0.0),
|
||||||
const EdgeInsetsDirectional.fromSTEB(0.0, 10.0, 0.0, 0.0),
|
|
||||||
child: Text(
|
child: Text(
|
||||||
FFLocalizations.of(context).getText('l7tw8b92'),
|
FFLocalizations.of(context).getText('l7tw8b92'),
|
||||||
textAlign: TextAlign
|
textAlign: TextAlign.left,
|
||||||
.left, // Adiciona esta linha para alinhar o texto à esquerda
|
|
||||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||||
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||||
|
fontSize: fontsize,
|
||||||
letterSpacing: 0.0,
|
letterSpacing: 0.0,
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily),
|
FlutterFlowTheme.of(context).bodyMediumFamily),
|
||||||
|
@ -115,6 +111,7 @@ class _OptModalWidgetState extends State<OptModalWidget> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
ListView.builder(
|
ListView.builder(
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemCount: options.length,
|
itemCount: options.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
|
@ -125,6 +122,7 @@ class _OptModalWidgetState extends State<OptModalWidget> {
|
||||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||||
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||||
letterSpacing: 0.0,
|
letterSpacing: 0.0,
|
||||||
|
fontSize: fontsize,
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily),
|
FlutterFlowTheme.of(context).bodyMediumFamily),
|
||||||
color: FlutterFlowTheme.of(context).primaryText,
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
|
@ -148,9 +146,10 @@ class _OptModalWidgetState extends State<OptModalWidget> {
|
||||||
checkboxShape: RoundedRectangleBorder(
|
checkboxShape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(100),
|
borderRadius: BorderRadius.circular(100),
|
||||||
),
|
),
|
||||||
|
|
||||||
enableFeedback: true,
|
enableFeedback: true,
|
||||||
side: BorderSide(
|
side: BorderSide(
|
||||||
width: 10,
|
width: 5,
|
||||||
color: FlutterFlowTheme.of(context).secondaryText,
|
color: FlutterFlowTheme.of(context).secondaryText,
|
||||||
),
|
),
|
||||||
controlAffinity:
|
controlAffinity:
|
||||||
|
@ -178,14 +177,13 @@ class _OptModalWidgetState extends State<OptModalWidget> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SafeArea(
|
double screenWidth = MediaQuery.of(context).size.width;
|
||||||
child: Align(
|
double screenHeight = MediaQuery.of(context).size.height;
|
||||||
alignment: const AlignmentDirectional(1.0, -1.0),
|
|
||||||
child: Padding(
|
return Center(
|
||||||
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 50.0, 50.0, 0.0),
|
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 300.0,
|
width: screenWidth * 0.75,
|
||||||
height: 450.0,
|
height: screenHeight * 0.35,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
borderRadius: BorderRadius.circular(24.0),
|
borderRadius: BorderRadius.circular(24.0),
|
||||||
|
@ -204,14 +202,14 @@ class _OptModalWidgetState extends State<OptModalWidget> {
|
||||||
child: Text(
|
child: Text(
|
||||||
FFLocalizations.of(context)
|
FFLocalizations.of(context)
|
||||||
.getText('yfj9pd6k'), // Filtros
|
.getText('yfj9pd6k'), // Filtros
|
||||||
style: FlutterFlowTheme.of(context)
|
style:
|
||||||
.headlineMedium
|
FlutterFlowTheme.of(context).headlineMedium.override(
|
||||||
.override(
|
|
||||||
fontFamily: FlutterFlowTheme.of(context)
|
fontFamily: FlutterFlowTheme.of(context)
|
||||||
.headlineMediumFamily,
|
.headlineMediumFamily,
|
||||||
color: FlutterFlowTheme.of(context).primaryText,
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
fontSize: 16.0,
|
fontSize: 18.0,
|
||||||
letterSpacing: 0.0,
|
letterSpacing: 0.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||||
FlutterFlowTheme.of(context)
|
FlutterFlowTheme.of(context)
|
||||||
.headlineMediumFamily),
|
.headlineMediumFamily),
|
||||||
|
@ -220,115 +218,32 @@ class _OptModalWidgetState extends State<OptModalWidget> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Padding(
|
Expanded(
|
||||||
padding: const EdgeInsetsDirectional.fromSTEB(
|
child: SingleChildScrollView(
|
||||||
8.0, 0.0, 8.0, 0.0),
|
|
||||||
child: TextFormField(
|
|
||||||
controller: _model.textController,
|
|
||||||
focusNode: _model.textFieldFocusNode,
|
|
||||||
autofocus: false,
|
|
||||||
obscureText: false,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
isDense: true,
|
|
||||||
labelText: FFLocalizations.of(context).getText(
|
|
||||||
'0enrtljz' /* Pesquise aqui..... */,
|
|
||||||
),
|
|
||||||
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: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: FlutterFlowTheme.of(context).alternate,
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
borderRadius: BorderRadius.circular(8.0),
|
|
||||||
),
|
|
||||||
focusedBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: FlutterFlowTheme.of(context).primary,
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
borderRadius: BorderRadius.circular(8.0),
|
|
||||||
),
|
|
||||||
errorBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: FlutterFlowTheme.of(context).error,
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
borderRadius: BorderRadius.circular(8.0),
|
|
||||||
),
|
|
||||||
focusedErrorBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: FlutterFlowTheme.of(context).error,
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
borderRadius: BorderRadius.circular(8.0),
|
|
||||||
),
|
|
||||||
filled: true,
|
|
||||||
fillColor: FlutterFlowTheme.of(context).alternate,
|
|
||||||
suffixIcon: const Icon(
|
|
||||||
Icons.search_outlined,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
||||||
fontFamily:
|
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily),
|
|
||||||
),
|
|
||||||
validator:
|
|
||||||
_model.textControllerValidator.asValidator(context),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SingleChildScrollView(
|
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.all(20),
|
padding: const EdgeInsets.all(10),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
_buildCheckboxListTile(
|
_buildCheckboxListTile(
|
||||||
'personType', personTypeOptions),
|
'personType', personTypeOptions, 14),
|
||||||
_buildCheckboxListTile(
|
|
||||||
'accessType', accessTypeOptions),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: _applyFilter,
|
onPressed: _applyFilter,
|
||||||
child:
|
|
||||||
Text(FFLocalizations.of(context).getText('88kshkph')),
|
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
foregroundColor: FlutterFlowTheme.of(context).info,
|
foregroundColor: FlutterFlowTheme.of(context).info,
|
||||||
backgroundColor: FlutterFlowTheme.of(context).primary,
|
backgroundColor: FlutterFlowTheme.of(context).primary,
|
||||||
),
|
),
|
||||||
|
child: Text(FFLocalizations.of(context).getText('88kshkph')),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,8 @@
|
||||||
import 'dart:collection';
|
import 'dart:collection';
|
||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
|
|
||||||
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
|
|
||||||
import '/flutter_flow/flutter_flow_theme.dart';
|
import '/flutter_flow/flutter_flow_theme.dart';
|
||||||
import '/flutter_flow/flutter_flow_util.dart';
|
import '/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
|
@ -12,8 +14,6 @@ export 'card_item_template_component_model.dart';
|
||||||
|
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class CardItemTemplateComponentWidget extends StatefulWidget {
|
class CardItemTemplateComponentWidget extends StatefulWidget {
|
||||||
const CardItemTemplateComponentWidget({
|
const CardItemTemplateComponentWidget({
|
||||||
super.key,
|
super.key,
|
||||||
|
@ -40,7 +40,9 @@ class _CardItemTemplateComponentWidgetState
|
||||||
LinkedHashMap.from(widget.labelsHashMap ?? {});
|
LinkedHashMap.from(widget.labelsHashMap ?? {});
|
||||||
|
|
||||||
List<LinkedHashMap<String, Color>> get statusLinkedHashMap =>
|
List<LinkedHashMap<String, Color>> get statusLinkedHashMap =>
|
||||||
widget.statusHashMap.map((map) => LinkedHashMap<String, Color>.from(map ?? {})).toList();
|
widget.statusHashMap
|
||||||
|
.map((map) => LinkedHashMap<String, Color>.from(map ?? {}))
|
||||||
|
.toList();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void setState(VoidCallback callback) {
|
void setState(VoidCallback callback) {
|
||||||
|
@ -71,12 +73,18 @@ class _CardItemTemplateComponentWidgetState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String truncate(int cutoff, String mytext) {
|
||||||
|
return (mytext.length <= cutoff)
|
||||||
|
? mytext
|
||||||
|
: '${mytext.substring(0, cutoff)}...';
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
double screenWidth = MediaQuery.of(context).size.width;
|
||||||
|
double screenHeight = MediaQuery.of(context).size.height;
|
||||||
context.watch<FFAppState>();
|
context.watch<FFAppState>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return InkWell(
|
return InkWell(
|
||||||
splashColor: Colors.transparent,
|
splashColor: Colors.transparent,
|
||||||
focusColor: Colors.transparent,
|
focusColor: Colors.transparent,
|
||||||
|
@ -123,7 +131,8 @@ class _CardItemTemplateComponentWidgetState
|
||||||
labelsLinkedHashMap.keys.elementAt(index);
|
labelsLinkedHashMap.keys.elementAt(index);
|
||||||
String value = labelsLinkedHashMap[key]!;
|
String value = labelsLinkedHashMap[key]!;
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 5.0),
|
padding:
|
||||||
|
const EdgeInsets.fromLTRB(0, 2, 0, 5),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding:
|
padding:
|
||||||
const EdgeInsets.fromLTRB(20, 0, 0, 0),
|
const EdgeInsets.fromLTRB(20, 0, 0, 0),
|
||||||
|
@ -140,7 +149,7 @@ class _CardItemTemplateComponentWidgetState
|
||||||
fontFamily:
|
fontFamily:
|
||||||
FlutterFlowTheme.of(context)
|
FlutterFlowTheme.of(context)
|
||||||
.bodyMediumFamily,
|
.bodyMediumFamily,
|
||||||
fontSize: 12.5,
|
fontSize: screenWidth * 0.025,
|
||||||
letterSpacing: 0.0,
|
letterSpacing: 0.0,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
useGoogleFonts: GoogleFonts
|
useGoogleFonts: GoogleFonts
|
||||||
|
@ -151,21 +160,23 @@ class _CardItemTemplateComponentWidgetState
|
||||||
.bodyMediumFamily),
|
.bodyMediumFamily),
|
||||||
color:
|
color:
|
||||||
FlutterFlowTheme.of(context)
|
FlutterFlowTheme.of(context)
|
||||||
.primaryText,
|
.customColor6,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width:
|
width:
|
||||||
5.0), // Espaçamento entre o label e o valor
|
5.0), // Espaçamento entre o label e o valor
|
||||||
Text(
|
Text(
|
||||||
value,
|
truncate(20, value),
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
maxLines: 1,
|
||||||
style: FlutterFlowTheme.of(context)
|
style: FlutterFlowTheme.of(context)
|
||||||
.bodyMedium
|
.bodyMedium
|
||||||
.override(
|
.override(
|
||||||
fontFamily:
|
fontFamily:
|
||||||
FlutterFlowTheme.of(context)
|
FlutterFlowTheme.of(context)
|
||||||
.bodyMediumFamily,
|
.bodyMediumFamily,
|
||||||
fontSize: 12.5,
|
fontSize: screenWidth * 0.030,
|
||||||
letterSpacing: 0.0,
|
letterSpacing: 0.0,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
useGoogleFonts: GoogleFonts
|
useGoogleFonts: GoogleFonts
|
||||||
|
@ -183,30 +194,41 @@ class _CardItemTemplateComponentWidgetState
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Row(
|
Padding(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
padding: const EdgeInsets.fromLTRB(20, 0, 0, 0),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
children: statusLinkedHashMap.expand((linkedHashMap) {
|
children:
|
||||||
return linkedHashMap.entries.map((MapEntry<String, Color> item) {
|
statusLinkedHashMap.expand((linkedHashMap) {
|
||||||
|
return linkedHashMap.entries
|
||||||
|
.map((MapEntry<String, Color> item) {
|
||||||
return Container(
|
return Container(
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 1.0, vertical: 3.0),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 1.0, vertical: 3.0),
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 100.0,
|
width: screenWidth * 0.20,
|
||||||
height: 27.0,
|
height: 27.0,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: item.value, // Usa a cor do item atual
|
color: item
|
||||||
borderRadius: BorderRadius.circular(5.0),
|
.value, // Usa a cor do item atual
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(5.0),
|
||||||
),
|
),
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: Text(
|
child: Text(
|
||||||
item.key, // Usa a chave do item atual como texto
|
item.key, // Usa a chave do item atual como texto
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: FlutterFlowTheme.of(context).info, // Ajuste conforme necessário
|
fontSize: screenWidth * 0.03,
|
||||||
|
color: FlutterFlowTheme.of(
|
||||||
|
context)
|
||||||
|
.info, // Ajuste conforme necessário
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -218,6 +240,7 @@ class _CardItemTemplateComponentWidgetState
|
||||||
}).toList();
|
}).toList();
|
||||||
}).toList(),
|
}).toList(),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -546,8 +546,8 @@ final kTranslationsMap = <Map<String, Map<String, String>>>[
|
||||||
// optModal
|
// optModal
|
||||||
{
|
{
|
||||||
'0enrtljz': {
|
'0enrtljz': {
|
||||||
'pt': 'Pesquise aqui.....',
|
'pt': 'Pesquise aqui...',
|
||||||
'en': 'Search here.....',
|
'en': 'Search here...',
|
||||||
},
|
},
|
||||||
'l7tw8b92': {
|
'l7tw8b92': {
|
||||||
'pt': 'Tipo de Pessoa',
|
'pt': 'Tipo de Pessoa',
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import 'package:firebase_core/firebase_core.dart';
|
import 'package:firebase_core/firebase_core.dart';
|
||||||
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
|
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
|
||||||
import 'package:hub/app_state.dart';
|
import 'package:hub/app_state.dart';
|
||||||
|
|
|
@ -11,11 +11,11 @@ import 'package:hub/pages/liberation_history/liberation_history_model.dart';
|
||||||
|
|
||||||
class AcessHistoryPageModel extends FlutterFlowModel<AcessHistoryPageWidget> {
|
class AcessHistoryPageModel extends FlutterFlowModel<AcessHistoryPageWidget> {
|
||||||
final unfocusNode = FocusNode();
|
final unfocusNode = FocusNode();
|
||||||
final _accessHistoryManager = StreamRequestManager<ApiCallResponse>();
|
final _accessHistoryManager = FutureRequestManager<ApiCallResponse>();
|
||||||
Stream<ApiCallResponse> accessHistory({
|
Future<ApiCallResponse> accessHistory({
|
||||||
String? uniqueQueryKey,
|
String? uniqueQueryKey,
|
||||||
bool? overrideCache,
|
bool? overrideCache,
|
||||||
required Stream<ApiCallResponse> Function() requestFn,
|
required Future<ApiCallResponse> Function() requestFn,
|
||||||
}) =>
|
}) =>
|
||||||
_accessHistoryManager.performRequest(
|
_accessHistoryManager.performRequest(
|
||||||
uniqueQueryKey: uniqueQueryKey,
|
uniqueQueryKey: uniqueQueryKey,
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
|
import 'dart:async';
|
||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
|
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
|
@ -7,9 +9,7 @@ import 'package:hub/app_state.dart';
|
||||||
import 'package:hub/backend/api_requests/api_calls.dart';
|
import 'package:hub/backend/api_requests/api_calls.dart';
|
||||||
import 'package:hub/backend/api_requests/api_manager.dart';
|
import 'package:hub/backend/api_requests/api_manager.dart';
|
||||||
import 'package:hub/components/molecular_components/message_opt_modal/opt_modal_widget.dart';
|
import 'package:hub/components/molecular_components/message_opt_modal/opt_modal_widget.dart';
|
||||||
import 'package:hub/components/molecular_components/option_selection_modal/option_selection_modal_widget.dart';
|
|
||||||
import 'package:hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
|
import 'package:hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
|
||||||
import 'package:hub/flutter_flow/custom_functions.dart';
|
|
||||||
import 'package:hub/flutter_flow/flutter_flow_icon_button.dart';
|
import 'package:hub/flutter_flow/flutter_flow_icon_button.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
||||||
|
|
||||||
|
@ -17,11 +17,10 @@ import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'package:hub/flutter_flow/internationalization.dart';
|
import 'package:hub/flutter_flow/internationalization.dart';
|
||||||
import 'package:hub/pages/acess_history_page/acess_history_page_model.dart';
|
import 'package:hub/pages/acess_history_page/acess_history_page_model.dart';
|
||||||
|
import 'package:hub/shared/utils/dialog_util.dart';
|
||||||
|
import 'package:hub/shared/utils/log_util.dart';
|
||||||
import 'package:rxdart/rxdart.dart';
|
import 'package:rxdart/rxdart.dart';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@immutable
|
@immutable
|
||||||
class AcessHistoryPageWidget extends StatefulWidget {
|
class AcessHistoryPageWidget extends StatefulWidget {
|
||||||
late Map<String, String> opt = {
|
late Map<String, String> opt = {
|
||||||
|
@ -43,8 +42,8 @@ class AccessHistoryItemWidget extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Padding(
|
return const Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: EdgeInsets.all(8.0),
|
||||||
child: Column(),
|
child: Column(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -56,18 +55,35 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
||||||
bool _isSubjectClosed = false;
|
bool _isSubjectClosed = false;
|
||||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||||
|
|
||||||
|
late ScrollController _scrollController;
|
||||||
|
int _pageNumber = 1;
|
||||||
|
final int _pageSize = 10;
|
||||||
|
bool _hasData = false;
|
||||||
|
bool _loading = false;
|
||||||
|
|
||||||
|
String _personType = '.*';
|
||||||
|
|
||||||
|
late Future<void> _accessFuture;
|
||||||
|
List<dynamic> _accessWrap = [];
|
||||||
|
|
||||||
_AcessHistoryPageWidgetState(Map<String, String> opt)
|
_AcessHistoryPageWidgetState(Map<String, String> opt)
|
||||||
: selectedTypeSubject = BehaviorSubject.seeded(opt) {
|
: selectedTypeSubject = BehaviorSubject.seeded(opt) {
|
||||||
selectedTypeSubject.listen((value) {
|
selectedTypeSubject.listen((value) {});
|
||||||
log("selectedTypeSubject changed: $value");
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_model = createModel(context, () => AcessHistoryPageModel());
|
_model = createModel(context, () => AcessHistoryPageModel());
|
||||||
log("initState called in _AcessHistoryPageWidgetState");
|
_accessFuture = fetchAccessHistoryService();
|
||||||
|
|
||||||
|
_scrollController = ScrollController()
|
||||||
|
..addListener(() {
|
||||||
|
if (_scrollController.position.atEdge &&
|
||||||
|
_scrollController.position.pixels != 0) {
|
||||||
|
_loadMoreAccess();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -79,31 +95,28 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final theme = FlutterFlowTheme.of(context);
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
key: scaffoldKey,
|
key: scaffoldKey,
|
||||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
appBar: _appBarOrganismWidget(context),
|
appBar: _appBar(context, theme),
|
||||||
body: _accessHistoryListOrganismWidget(context));
|
body: _body(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
// AppBar Widgets
|
PreferredSizeWidget _appBar(BuildContext context, FlutterFlowTheme theme) {
|
||||||
PreferredSizeWidget _appBarOrganismWidget(BuildContext context) {
|
|
||||||
final theme = FlutterFlowTheme.of(context);
|
|
||||||
return AppBar(
|
return AppBar(
|
||||||
backgroundColor: theme.primaryBackground,
|
backgroundColor: theme.primaryBackground,
|
||||||
automaticallyImplyLeading: false,
|
automaticallyImplyLeading: false,
|
||||||
leading: _appBarBackButtonAtomWidget(context, theme),
|
leading: _backButton(context, theme),
|
||||||
title: _appBarTitleMoleculeWidget(context, theme),
|
title: _title(context, theme),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
elevation: 0.0,
|
elevation: 0.0,
|
||||||
actions: [
|
actions: [_filterButton(context)],
|
||||||
_appBarFilterButtonAtomWidget(context),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _appBarBackButtonAtomWidget(
|
Widget _backButton(BuildContext context, FlutterFlowTheme theme) {
|
||||||
BuildContext context, FlutterFlowTheme theme) {
|
|
||||||
return FlutterFlowIconButton(
|
return FlutterFlowIconButton(
|
||||||
borderColor: Colors.transparent,
|
borderColor: Colors.transparent,
|
||||||
borderRadius: 30.0,
|
borderRadius: 30.0,
|
||||||
|
@ -118,8 +131,7 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _appBarTitleMoleculeWidget(
|
Widget _title(BuildContext context, FlutterFlowTheme theme) {
|
||||||
BuildContext context, FlutterFlowTheme theme) {
|
|
||||||
return Text(
|
return Text(
|
||||||
FFLocalizations.of(context).getText('ch8qymga'),
|
FFLocalizations.of(context).getText('ch8qymga'),
|
||||||
style: theme.headlineMedium.override(
|
style: theme.headlineMedium.override(
|
||||||
|
@ -133,34 +145,43 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _appBarFilterButtonAtomWidget(BuildContext context) {
|
Widget _filterButton(BuildContext context) {
|
||||||
log('selectedTypeSubject: ${selectedTypeSubject.value}');
|
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
IconButton(
|
Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(0, 0, 10, 0),
|
||||||
|
child: IconButton(
|
||||||
icon: const Icon(Icons.filter_list),
|
icon: const Icon(Icons.filter_list),
|
||||||
padding: EdgeInsets.fromLTRB(0, 0, 10, 0),
|
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final Map<String, String>? selectedFilter =
|
final Map<String, String>? selectedFilter =
|
||||||
await showModalBottomSheet<Map<String, String>>(
|
await showModalBottomSheet<Map<String, String>>(
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => OptModalWidget(
|
builder: (context) {
|
||||||
defaultAccessType:
|
return GestureDetector(
|
||||||
selectedTypeSubject.value['accessType'] ?? '.*',
|
onTap: () => Navigator.of(context).pop(),
|
||||||
|
child: Container(
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {},
|
||||||
|
child: OptModalWidget(
|
||||||
defaultPersonType:
|
defaultPersonType:
|
||||||
selectedTypeSubject.value['personType'] ?? '.*',
|
selectedTypeSubject.value['personType'] ??
|
||||||
|
'.*',
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
});
|
||||||
|
|
||||||
if (selectedFilter != null) {
|
if (selectedFilter != null) {
|
||||||
log('Selected Filter: $selectedFilter');
|
|
||||||
_updateAccessHistoryAction(selectedFilter);
|
_updateAccessHistoryAction(selectedFilter);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -178,108 +199,126 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
||||||
});
|
});
|
||||||
if (needsUpdate) {
|
if (needsUpdate) {
|
||||||
selectedTypeSubject.add(updatedType);
|
selectedTypeSubject.add(updatedType);
|
||||||
log("updateAccessHistory called with newType: $newType");
|
fetchCardListViewService(updatedType);
|
||||||
safeSetState(() {});
|
safeSetState(() {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<ApiCallResponse> fetchAccessHistoryService(String selectedType) {
|
Future<ApiCallResponse?> fetchAccessHistoryService() async {
|
||||||
log('Calling API with type: $selectedType');
|
try {
|
||||||
switch (selectedType) {
|
setState(() => _loading = true);
|
||||||
case 'E':
|
var response = await PhpGroup.getAccessCall.call(
|
||||||
return _model.accessHistory(
|
|
||||||
requestFn: () => PhpGroup.getAccessCall.call(
|
|
||||||
devUUID: FFAppState().devUUID,
|
devUUID: FFAppState().devUUID,
|
||||||
userUUID: FFAppState().userUUID,
|
userUUID: FFAppState().userUUID,
|
||||||
cliID: FFAppState().cliUUID,
|
cliID: FFAppState().cliUUID,
|
||||||
atividade: 'getAcessos',
|
atividade: 'getAcessos',
|
||||||
pageSize: '100',
|
pageSize: _pageSize.toString(),
|
||||||
pageNumber: '1',
|
pageNumber: _pageNumber.toString(),
|
||||||
pesTipo: 'E',
|
pesTipo: _personType != 'E' && _personType != 'O' ? 'T' : _personType,
|
||||||
),
|
|
||||||
);
|
|
||||||
case 'O':
|
|
||||||
return _model.accessHistory(
|
|
||||||
requestFn: () => PhpGroup.getAccessCall.call(
|
|
||||||
devUUID: FFAppState().devUUID,
|
|
||||||
userUUID: FFAppState().userUUID,
|
|
||||||
cliID: FFAppState().cliUUID,
|
|
||||||
atividade: 'getAcessos',
|
|
||||||
pageSize: '100',
|
|
||||||
pageNumber: '1',
|
|
||||||
pesTipo: 'O',
|
|
||||||
),
|
|
||||||
);
|
|
||||||
default:
|
|
||||||
return _model.accessHistory(
|
|
||||||
requestFn: () => PhpGroup.getAccessCall.call(
|
|
||||||
devUUID: FFAppState().devUUID,
|
|
||||||
userUUID: FFAppState().userUUID,
|
|
||||||
cliID: FFAppState().cliUUID,
|
|
||||||
atividade: 'getAcessos',
|
|
||||||
pageSize: '100',
|
|
||||||
pageNumber: '1',
|
|
||||||
pesTipo: 'T',
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final List<dynamic> accessHistory = response.jsonBody['acessos'] ?? [];
|
||||||
|
|
||||||
|
List<dynamic> filteredAccess = accessHistory.where((item) {
|
||||||
|
final personTypeMatches =
|
||||||
|
_personType == '.*' || item["PES_TIPO"].toString() == _personType;
|
||||||
|
return personTypeMatches;
|
||||||
|
}).toList();
|
||||||
|
|
||||||
|
if (filteredAccess != null && filteredAccess.isNotEmpty) {
|
||||||
|
setState(() {
|
||||||
|
_accessWrap.addAll(filteredAccess);
|
||||||
|
_hasData = true;
|
||||||
|
_loading = false;
|
||||||
|
});
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
_showNoMoreDataSnackbar(context);
|
||||||
|
setState(() {
|
||||||
|
_hasData = false;
|
||||||
|
_loading = false;
|
||||||
|
});
|
||||||
|
return null;
|
||||||
|
} catch (e, s) {
|
||||||
|
DialogUtil.errorDefault(context);
|
||||||
|
LogUtil.requestAPIFailed('processRequest', "", "Busca Acesso", e, s);
|
||||||
|
setState(() {
|
||||||
|
_hasData = false;
|
||||||
|
_loading = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _accessHistoryListOrganismWidget(BuildContext context) {
|
void _showNoMoreDataSnackbar(BuildContext context) {
|
||||||
return SingleChildScrollView(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
child: Column(
|
SnackBar(
|
||||||
children: [
|
content: Text(
|
||||||
StreamBuilder<Map<String, String>>(
|
FFLocalizations.of(context).getVariableText(
|
||||||
stream: selectedTypeSubject.stream,
|
ptText: "Não há mais dados.", enText: "No more data."),
|
||||||
builder: (context, snapshot) {
|
|
||||||
if (!snapshot.hasData) {
|
|
||||||
return Center(child: CircularProgressIndicator());
|
|
||||||
}
|
|
||||||
final selected = snapshot.data!;
|
|
||||||
return _cardListViewOrganismWidget(selected);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
duration: const Duration(seconds: 3),
|
||||||
|
backgroundColor: FlutterFlowTheme.of(context).primary,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _body(BuildContext context) {
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
if (_hasData == false && _pageNumber <= 1 && _loading == false)
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
children: [
|
||||||
|
Center(
|
||||||
|
child: Text(
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: "Nenhum histórico encontrado!",
|
||||||
|
enText: "No history found!"),
|
||||||
|
)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
)
|
||||||
|
else if (_hasData || _pageNumber >= 1)
|
||||||
|
Expanded(child: _cardListViewOrganismWidget()),
|
||||||
|
if (_hasData == true && _loading)
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.only(top: 15, bottom: 15),
|
||||||
|
child: Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
valueColor: AlwaysStoppedAnimation<Color>(
|
||||||
|
FlutterFlowTheme.of(context).primary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<dynamic>> fetchCardListViewService(
|
void _loadMoreAccess() {
|
||||||
Map<String, String> select) async {
|
if (_hasData == true) {
|
||||||
log('Fetching access history');
|
_pageNumber++;
|
||||||
final response =
|
_accessFuture = fetchAccessHistoryService();
|
||||||
await fetchAccessHistoryService(select['personType']!).first;
|
}
|
||||||
log('Response: ${response.jsonBody}');
|
|
||||||
final List<dynamic> accessHistory = response.jsonBody['acessos'] ?? [];
|
|
||||||
log('Access History Before Filtering: $accessHistory');
|
|
||||||
log(
|
|
||||||
'Filtering for: Person Type - ${select['personType']}, Access Type - ${select['accessType']}, Search - ${select['search']}');
|
|
||||||
|
|
||||||
return accessHistory.where((item) {
|
|
||||||
final personTypeMatches = select['personType'] == '.*' ||
|
|
||||||
item["PES_TIPO"].toString() == select['personType'];
|
|
||||||
final accessTypeMatches = select['accessType'] == '.*' ||
|
|
||||||
item["ACE_TIPO"].toString() == select['accessType'];
|
|
||||||
final searchMatches = select['search'] == '.*' ||
|
|
||||||
item["PES_NOME"]
|
|
||||||
.toString()
|
|
||||||
.toLowerCase()
|
|
||||||
.contains(select['search']!.toLowerCase());
|
|
||||||
log('NOMES: ${item["PES_NOME"].toString().toLowerCase()}');
|
|
||||||
return personTypeMatches && accessTypeMatches && searchMatches;
|
|
||||||
}).toList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _cardListViewOrganismWidget(Map<String, String> selected) {
|
void fetchCardListViewService(Map<String, String> select) {
|
||||||
log(
|
_personType = select['personType']!;
|
||||||
'Selected types in Card: ${selected['personType']}, ${selected['accessType']}');
|
_accessWrap = [];
|
||||||
log('_buildAccessHistoryList called');
|
_pageNumber = 1;
|
||||||
return FutureBuilder<List<dynamic>>(
|
_accessFuture = fetchAccessHistoryService();
|
||||||
future: fetchCardListViewService(selected),
|
}
|
||||||
|
|
||||||
|
Widget _cardListViewOrganismWidget() {
|
||||||
|
return FutureBuilder<void>(
|
||||||
|
future: _accessFuture,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
if (snapshot.connectionState == ConnectionState.waiting &&
|
||||||
log('Waiting for data');
|
_accessWrap.isEmpty) {
|
||||||
return Center(
|
return Center(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 50.0,
|
width: 50.0,
|
||||||
|
@ -291,30 +330,29 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else if (snapshot.hasError) {
|
} else if (snapshot.hasError) {
|
||||||
return Text('Error: ${snapshot.error}');
|
return Center(
|
||||||
} else {
|
child: Text(FFLocalizations.of(context).getVariableText(
|
||||||
final accessHistory = snapshot.data!;
|
ptText: "Falha ao efetuar operação!",
|
||||||
log('Access History: $accessHistory');
|
enText: "Failed to perform operation!")),
|
||||||
return ListView.builder(
|
|
||||||
shrinkWrap: true,
|
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
|
||||||
itemCount: accessHistory.length,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
final accessHistoryItem = accessHistory[index];
|
|
||||||
log(
|
|
||||||
'Access History Item: ${accessHistoryItem['PES_TIPO']}');
|
|
||||||
return _accessHistoryCardMoleculeWidget(
|
|
||||||
context, accessHistoryItem);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return ListView.builder(
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: const BouncingScrollPhysics(),
|
||||||
|
controller: _scrollController,
|
||||||
|
itemCount: _accessWrap.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
final accessHistoryItem = _accessWrap[index];
|
||||||
|
return _accessHistoryCardMoleculeWidget(context, accessHistoryItem);
|
||||||
|
},
|
||||||
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _accessHistoryCardMoleculeWidget(
|
Widget _accessHistoryCardMoleculeWidget(
|
||||||
BuildContext context, dynamic accessHistoryItem) {
|
BuildContext context, dynamic accessHistoryItem) {
|
||||||
log('Access History Item: $accessHistoryItem');
|
|
||||||
return CardItemTemplateComponentWidget(
|
return CardItemTemplateComponentWidget(
|
||||||
imageHashMap: Map<String, String>.from({
|
imageHashMap: Map<String, String>.from({
|
||||||
'key': accessHistoryItem['PES_ID'] ?? '',
|
'key': accessHistoryItem['PES_ID'] ?? '',
|
||||||
|
@ -371,183 +409,6 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _cardHeaderAtomWidget(BuildContext context, String urlImagem,
|
|
||||||
String tipoPessoa, Color corFundoTipo, accessHistoryItem) {
|
|
||||||
return Row(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.all(10.0),
|
|
||||||
child: ClipRRect(
|
|
||||||
borderRadius: BorderRadius.circular(100.0),
|
|
||||||
child: Image.network(
|
|
||||||
urlImagem,
|
|
||||||
width: 60.0,
|
|
||||||
height: 60.0,
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Column(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
getJsonField(
|
|
||||||
accessHistoryItem,
|
|
||||||
r'''$.PES_NOME''',
|
|
||||||
).toString(),
|
|
||||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
||||||
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
width: 100.0,
|
|
||||||
height: 25.0,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: (() {
|
|
||||||
// Extrai o valor de PES_TIPO, converte para String, remove espaços em branco e aspas
|
|
||||||
final pesTipo =
|
|
||||||
jsonToStr(getJsonField(
|
|
||||||
accessHistoryItem,
|
|
||||||
r'''$.PES_TIPO''',
|
|
||||||
))
|
|
||||||
.trim()
|
|
||||||
.replaceAll('"', ''); // Remove aspas
|
|
||||||
|
|
||||||
// Debug: Imprime o valor de PES_TIPO ajustado
|
|
||||||
log('PES_TIPO FOR COLORING: $pesTipo');
|
|
||||||
|
|
||||||
// Retorna a cor baseada na condição ajustada
|
|
||||||
return pesTipo == 'E'
|
|
||||||
? FlutterFlowTheme.of(context).warning
|
|
||||||
: FlutterFlowTheme.of(context).primary;
|
|
||||||
})(),
|
|
||||||
borderRadius: BorderRadius.circular(24.0),
|
|
||||||
),
|
|
||||||
child: Align(
|
|
||||||
alignment: const AlignmentDirectional(0.0, 0.0),
|
|
||||||
child: Text(
|
|
||||||
getJsonField(
|
|
||||||
accessHistoryItem,
|
|
||||||
r'''$.PES_TIPO''',
|
|
||||||
).toString() ==
|
|
||||||
'E'
|
|
||||||
? FFLocalizations.of(context).getText(
|
|
||||||
'zok7lu4w',
|
|
||||||
)
|
|
||||||
: FFLocalizations.of(context).getText(
|
|
||||||
'oonqk812',
|
|
||||||
),
|
|
||||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
||||||
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
|
||||||
color: FlutterFlowTheme.of(context).info,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
]
|
|
||||||
.divide(const SizedBox(width: 20.0))
|
|
||||||
.addToStart(const SizedBox(width: 5.0))
|
|
||||||
.addToEnd(const SizedBox(width: 5.0)),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _cardDetailsMoleculeWidget(
|
|
||||||
BuildContext context, dynamic accessHistoryItem) {
|
|
||||||
return Row(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
FFLocalizations.of(context).getText(
|
|
||||||
'2odgr6hg',
|
|
||||||
),
|
|
||||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
||||||
fontFamily:
|
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily,
|
|
||||||
fontSize: 12.5,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
getJsonField(
|
|
||||||
accessHistoryItem,
|
|
||||||
r'''$.ACE_DATAHORA''',
|
|
||||||
).toString(),
|
|
||||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
||||||
fontFamily:
|
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily,
|
|
||||||
fontSize: 12.5,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
].addToStart(const SizedBox(width: 10.0)),
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
FFLocalizations.of(context).getText(
|
|
||||||
'zrde3fke',
|
|
||||||
),
|
|
||||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
||||||
fontFamily:
|
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily,
|
|
||||||
fontSize: 12.5,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
getJsonField(
|
|
||||||
accessHistoryItem,
|
|
||||||
r'''$.ACI_DESCRICAO''',
|
|
||||||
).toString(),
|
|
||||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
||||||
fontFamily:
|
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily,
|
|
||||||
fontSize: 12.5,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
].addToStart(const SizedBox(width: 10.0)),
|
|
||||||
),
|
|
||||||
].divide(const SizedBox(height: 3.0)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
.addToStart(const SizedBox(width: 5.0))
|
|
||||||
.addToEnd(const SizedBox(width: 5.0)),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
String imageUrlAtomWidget(String document, String type) {
|
String imageUrlAtomWidget(String document, String type) {
|
||||||
return valueOrDefault<String>(
|
return valueOrDefault<String>(
|
||||||
"https://freaccess.com.br/freaccess/getImage.php?&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=$document&tipo=$type",
|
"https://freaccess.com.br/freaccess/getImage.php?&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=$document&tipo=$type",
|
||||||
|
|
Loading…
Reference in New Issue