diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 0b01462d..89256115 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -44,8 +44,8 @@ 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; - 6436409427A31CD300820AF7 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = ""; }; - 6436409F27A31CD500820AF7 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 6436409227A31CDD00820AF7 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = ""; }; + 6436409F27A31CDD00820AF7 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; /* End PBXFileReference section */ @@ -225,8 +225,8 @@ 6436409C27A31CD800820AF7 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( - 6436409427A31CD300820AF7 /* pt */, - 6436409F27A31CD500820AF7 /* en */, + 6436409227A31CDD00820AF7 /* pt */, + 6436409F27A31CDD00820AF7 /* en */, ); name = InfoPlist.strings; sourceTree = ""; diff --git a/lib/components/molecular_components/opt_modal/opt_modal_model.dart b/lib/components/molecular_components/opt_modal/opt_modal_model.dart index 70a264fc..51674c2a 100644 --- a/lib/components/molecular_components/opt_modal/opt_modal_model.dart +++ b/lib/components/molecular_components/opt_modal/opt_modal_model.dart @@ -10,19 +10,15 @@ class OptModalModel extends FlutterFlowModel { FocusNode? textFieldFocusNode; TextEditingController? textController; String? Function(BuildContext, String?)? textControllerValidator; + // State field(s) for Checkbox widget. + bool? checkboxValue1; + // State field(s) for Checkbox widget. + bool? checkboxValue2; // State field(s) for CheckboxGroup widget. - FormFieldController>? checkboxGroupValueController1; - List? get checkboxGroupValues1 => - checkboxGroupValueController1?.value; - set checkboxGroupValues1(List? v) => - checkboxGroupValueController1?.value = v; - - // State field(s) for CheckboxGroup widget. - FormFieldController>? checkboxGroupValueController2; - List? get checkboxGroupValues2 => - checkboxGroupValueController2?.value; - set checkboxGroupValues2(List? v) => - checkboxGroupValueController2?.value = v; + FormFieldController>? checkboxGroupValueController; + List? get checkboxGroupValues => checkboxGroupValueController?.value; + set checkboxGroupValues(List? v) => + checkboxGroupValueController?.value = v; @override void initState(BuildContext context) {} diff --git a/lib/components/molecular_components/opt_modal/opt_modal_widget.dart b/lib/components/molecular_components/opt_modal/opt_modal_widget.dart index 76b6881e..5fd8606c 100644 --- a/lib/components/molecular_components/opt_modal/opt_modal_widget.dart +++ b/lib/components/molecular_components/opt_modal/opt_modal_widget.dart @@ -9,7 +9,12 @@ import 'opt_modal_model.dart'; export 'opt_modal_model.dart'; class OptModalWidget extends StatefulWidget { - const OptModalWidget({super.key}); + const OptModalWidget({ + super.key, + required this.togglePersonType, + }); + + final Future Function(String personType)? togglePersonType; @override State createState() => _OptModalWidgetState(); @@ -173,44 +178,119 @@ class _OptModalWidgetState extends State { ), ].addToStart(const SizedBox(width: 24.0)), ), - FlutterFlowCheckboxGroup( - options: [ - FFLocalizations.of(context).getText( - 'zok7lu4w' /* Visitante */, - ), - FFLocalizations.of(context).getText( - 'oonqk812' /* Morador */, - ) - ], - onChanged: (val) => - setState(() => _model.checkboxGroupValues1 = val), - controller: _model.checkboxGroupValueController1 ??= - FormFieldController>( - List.from([ - FFLocalizations.of(context).getText( - 'yfj9pd6k' /* Visitante */, + Row( + mainAxisSize: MainAxisSize.max, + children: [ + Theme( + data: ThemeData( + checkboxTheme: CheckboxThemeData( + visualDensity: VisualDensity.compact, + materialTapTargetSize: + MaterialTapTargetSize.shrinkWrap, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(4.0), ), - FFLocalizations.of(context).getText( - 'svfcf5xs' /* Morador */, - ) - ] ?? - []), - ), - activeColor: FlutterFlowTheme.of(context).primary, - checkColor: FlutterFlowTheme.of(context).info, - checkboxBorderColor: - FlutterFlowTheme.of(context).secondaryText, - textStyle: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: - FlutterFlowTheme.of(context).bodyMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey( - FlutterFlowTheme.of(context).bodyMediumFamily), + ), + unselectedWidgetColor: + FlutterFlowTheme.of(context).secondaryText, ), - checkboxBorderRadius: BorderRadius.circular(6.0), - initialized: _model.checkboxGroupValues1 != null, + child: Checkbox( + value: _model.checkboxValue1 ??= true, + onChanged: (newValue) async { + setState(() => _model.checkboxValue1 = newValue!); + if (newValue!) { + if (_model.checkboxValue2 == true) { + await widget.togglePersonType?.call( + 'T', + ); + } else { + await widget.togglePersonType?.call( + 'E', + ); + } + } + }, + side: BorderSide( + width: 2, + color: FlutterFlowTheme.of(context).secondaryText, + ), + activeColor: FlutterFlowTheme.of(context).primary, + checkColor: FlutterFlowTheme.of(context).info, + ), + ), + Text( + FFLocalizations.of(context).getText( + '20wie2n3' /* Morador */, + ), + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .bodyMediumFamily, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + ), + ], + ), + Row( + mainAxisSize: MainAxisSize.max, + children: [ + Theme( + data: ThemeData( + checkboxTheme: CheckboxThemeData( + visualDensity: VisualDensity.compact, + materialTapTargetSize: + MaterialTapTargetSize.shrinkWrap, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(4.0), + ), + ), + unselectedWidgetColor: + FlutterFlowTheme.of(context).secondaryText, + ), + child: Checkbox( + value: _model.checkboxValue2 ??= true, + onChanged: (newValue) async { + setState(() => _model.checkboxValue2 = newValue!); + if (newValue!) { + if (_model.checkboxValue2 == true) { + await widget.togglePersonType?.call( + 'T', + ); + } else { + await widget.togglePersonType?.call( + 'O', + ); + } + } + }, + side: BorderSide( + width: 2, + color: FlutterFlowTheme.of(context).secondaryText, + ), + activeColor: FlutterFlowTheme.of(context).primary, + checkColor: FlutterFlowTheme.of(context).info, + ), + ), + Text( + FFLocalizations.of(context).getText( + 'pglvsv6g' /* Visitante */, + ), + 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: 10.0)) @@ -249,8 +329,8 @@ class _OptModalWidgetState extends State { ) ], onChanged: (val) => - setState(() => _model.checkboxGroupValues2 = val), - controller: _model.checkboxGroupValueController2 ??= + setState(() => _model.checkboxGroupValues = val), + controller: _model.checkboxGroupValueController ??= FormFieldController>( List.from([ FFLocalizations.of(context).getText( @@ -276,7 +356,7 @@ class _OptModalWidgetState extends State { FlutterFlowTheme.of(context).bodyMediumFamily), ), checkboxBorderRadius: BorderRadius.circular(6.0), - initialized: _model.checkboxGroupValues2 != null, + initialized: _model.checkboxGroupValues != null, ), ] .addToStart(const SizedBox(height: 10.0)) diff --git a/lib/flutter_flow/internationalization.dart b/lib/flutter_flow/internationalization.dart index 963f505e..2d387238 100644 --- a/lib/flutter_flow/internationalization.dart +++ b/lib/flutter_flow/internationalization.dart @@ -492,20 +492,12 @@ final kTranslationsMap = >>[ 'pt': 'Tipo de Pessoa', 'en': 'Type of Person', }, - 'zok7lu4w': { - 'pt': 'Visitante', - 'en': 'Visitor', - }, - 'oonqk812': { + '20wie2n3': { 'pt': 'Morador', - 'en': 'Resident', - }, - 'yfj9pd6k': { - 'pt': 'Visitante', 'en': '', }, - 'svfcf5xs': { - 'pt': 'Morador', + 'pglvsv6g': { + 'pt': 'Visitante', 'en': '', }, 'pepv7gl9': { diff --git a/lib/pages/acess_history_page/acess_history_page_model.dart b/lib/pages/acess_history_page/acess_history_page_model.dart index 9744f4f0..71a5824f 100644 --- a/lib/pages/acess_history_page/acess_history_page_model.dart +++ b/lib/pages/acess_history_page/acess_history_page_model.dart @@ -7,6 +7,10 @@ import 'acess_history_page_widget.dart' show AcessHistoryPageWidget; import 'package:flutter/material.dart'; class AcessHistoryPageModel extends FlutterFlowModel { + /// Local state fields for this page. + + String pesType = 'T'; + /// State fields for stateful widgets in this page. final unfocusNode = FocusNode(); @@ -54,7 +58,12 @@ class AcessHistoryPageModel extends FlutterFlowModel { : FocusScope.of(context).unfocus(), child: Padding( padding: MediaQuery.viewInsetsOf(context), - child: const OptModalWidget(), + child: OptModalWidget( + togglePersonType: (personType) async { + _model.pesType = personType; + setState(() {}); + }, + ), ), ); }, diff --git a/lib/pages/acess_history_page/acess_history_page_widget.dart b/lib/pages/acess_history_page/acess_history_page_widget.dart index 45cf0a21..59970ede 100644 --- a/lib/pages/acess_history_page/acess_history_page_widget.dart +++ b/lib/pages/acess_history_page/acess_history_page_widget.dart @@ -120,7 +120,12 @@ class _AcessHistoryPageWidgetState extends State { : FocusScope.of(context).unfocus(), child: Padding( padding: MediaQuery.viewInsetsOf(context), - child: const OptModalWidget(), + child: OptModalWidget( + togglePersonType: (personType) async { + _model.pesType = personType; + setState(() {}); + }, + ), ), ); }, @@ -150,7 +155,7 @@ class _AcessHistoryPageWidgetState extends State { atividade: 'getAcessos', pageSize: '100', pageNumber: '1', - pesTipo: 'T', + pesTipo: _model.pesType, ), ), builder: (context, snapshot) { 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 a17396b6..36ef3ca6 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 @@ -1,5 +1,4 @@ import '/backend/api_requests/api_calls.dart'; -import '/components/molecular_components/opt_modal/opt_modal_widget.dart'; import '/components/molecular_components/throw_exception/throw_exception_widget.dart'; import '/components/templates_components/visit_details_modal_template_component/visit_details_modal_template_component_widget.dart'; import '/components/templates_components/visitor_details_modal_template_component/visitor_details_modal_template_component_widget.dart'; @@ -2257,28 +2256,8 @@ class _ScheduleCompleteVisitPageWidgetState color: FlutterFlowTheme.of(context).primary, size: 24.0, ), - onPressed: () async { - await showModalBottomSheet( - isScrollControlled: true, - backgroundColor: Colors.transparent, - context: context, - builder: (context) { - return GestureDetector( - onTap: () => _model - .unfocusNode.canRequestFocus - ? FocusScope.of(context) - .requestFocus( - _model.unfocusNode) - : FocusScope.of(context) - .unfocus(), - child: Padding( - padding: MediaQuery.viewInsetsOf( - context), - child: const OptModalWidget(), - ), - ); - }, - ).then((value) => safeSetState(() {})); + onPressed: () { + print('IconButton pressed ...'); }, ), ],