This commit is contained in:
FlutterFlow 2024-06-26 18:03:29 +00:00
parent d73d38b66c
commit b85e75fbf8
7 changed files with 154 additions and 93 deletions

View File

@ -44,8 +44,8 @@
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>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
6436409427A31CD300820AF7 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = "<group>"; };
6436409F27A31CD500820AF7 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
6436409227A31CDD00820AF7 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = "<group>"; };
6436409F27A31CDD00820AF7 /* 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>"; };
/* 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 = "<group>";

View File

@ -10,19 +10,15 @@ class OptModalModel extends FlutterFlowModel<OptModalWidget> {
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<List<String>>? checkboxGroupValueController1;
List<String>? get checkboxGroupValues1 =>
checkboxGroupValueController1?.value;
set checkboxGroupValues1(List<String>? v) =>
checkboxGroupValueController1?.value = v;
// State field(s) for CheckboxGroup widget.
FormFieldController<List<String>>? checkboxGroupValueController2;
List<String>? get checkboxGroupValues2 =>
checkboxGroupValueController2?.value;
set checkboxGroupValues2(List<String>? v) =>
checkboxGroupValueController2?.value = v;
FormFieldController<List<String>>? checkboxGroupValueController;
List<String>? get checkboxGroupValues => checkboxGroupValueController?.value;
set checkboxGroupValues(List<String>? v) =>
checkboxGroupValueController?.value = v;
@override
void initState(BuildContext context) {}

View File

@ -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<OptModalWidget> createState() => _OptModalWidgetState();
@ -173,44 +178,119 @@ class _OptModalWidgetState extends State<OptModalWidget> {
),
].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<String>>(
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<OptModalWidget> {
)
],
onChanged: (val) =>
setState(() => _model.checkboxGroupValues2 = val),
controller: _model.checkboxGroupValueController2 ??=
setState(() => _model.checkboxGroupValues = val),
controller: _model.checkboxGroupValueController ??=
FormFieldController<List<String>>(
List.from([
FFLocalizations.of(context).getText(
@ -276,7 +356,7 @@ class _OptModalWidgetState extends State<OptModalWidget> {
FlutterFlowTheme.of(context).bodyMediumFamily),
),
checkboxBorderRadius: BorderRadius.circular(6.0),
initialized: _model.checkboxGroupValues2 != null,
initialized: _model.checkboxGroupValues != null,
),
]
.addToStart(const SizedBox(height: 10.0))

View File

@ -492,20 +492,12 @@ final kTranslationsMap = <Map<String, Map<String, String>>>[
'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': {

View File

@ -7,6 +7,10 @@ import 'acess_history_page_widget.dart' show AcessHistoryPageWidget;
import 'package:flutter/material.dart';
class AcessHistoryPageModel extends FlutterFlowModel<AcessHistoryPageWidget> {
/// 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<AcessHistoryPageWidget> {
: FocusScope.of(context).unfocus(),
child: Padding(
padding: MediaQuery.viewInsetsOf(context),
child: const OptModalWidget(),
child: OptModalWidget(
togglePersonType: (personType) async {
_model.pesType = personType;
setState(() {});
},
),
),
);
},

View File

@ -120,7 +120,12 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
: 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<AcessHistoryPageWidget> {
atividade: 'getAcessos',
pageSize: '100',
pageNumber: '1',
pesTipo: 'T',
pesTipo: _model.pesType,
),
),
builder: (context, snapshot) {

View File

@ -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 ...');
},
),
],