421 lines
18 KiB
Dart
421 lines
18 KiB
Dart
import '/flutter_flow/flutter_flow_checkbox_group.dart';
|
|
import '/flutter_flow/flutter_flow_theme.dart';
|
|
import '/flutter_flow/flutter_flow_util.dart';
|
|
import '/flutter_flow/flutter_flow_widgets.dart';
|
|
import '/flutter_flow/form_field_controller.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
import 'opt_modal_model.dart';
|
|
export 'opt_modal_model.dart';
|
|
|
|
class OptModalWidget extends StatefulWidget {
|
|
const OptModalWidget({
|
|
super.key,
|
|
required this.togglePersonType,
|
|
});
|
|
|
|
final Future Function(String personType)? togglePersonType;
|
|
|
|
@override
|
|
State<OptModalWidget> createState() => _OptModalWidgetState();
|
|
}
|
|
|
|
class _OptModalWidgetState extends State<OptModalWidget> {
|
|
late OptModalModel _model;
|
|
|
|
@override
|
|
void setState(VoidCallback callback) {
|
|
super.setState(callback);
|
|
_model.onUpdate();
|
|
}
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_model = createModel(context, () => OptModalModel());
|
|
|
|
_model.textController ??= TextEditingController();
|
|
_model.textFieldFocusNode ??= FocusNode();
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_model.maybeDispose();
|
|
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Align(
|
|
alignment: const AlignmentDirectional(1.0, -1.0),
|
|
child: Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 50.0, 20.0, 0.0),
|
|
child: Container(
|
|
width: 300.0,
|
|
height: 400.0,
|
|
decoration: BoxDecoration(
|
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
|
borderRadius: BorderRadius.circular(24.0),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(4.0),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: [
|
|
Row(
|
|
mainAxisSize: MainAxisSize.max,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Padding(
|
|
padding:
|
|
const EdgeInsetsDirectional.fromSTEB(0.0, 10.0, 0.0, 0.0),
|
|
child: Icon(
|
|
Icons.filter_list,
|
|
color: FlutterFlowTheme.of(context).primary,
|
|
size: 24.0,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(8.0, 0.0, 8.0, 0.0),
|
|
child: TextFormField(
|
|
controller: _model.textController,
|
|
focusNode: _model.textFieldFocusNode,
|
|
autofocus: true,
|
|
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: UnderlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).alternate,
|
|
width: 2.0,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
),
|
|
focusedBorder: UnderlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).primary,
|
|
width: 2.0,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
),
|
|
errorBorder: UnderlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).error,
|
|
width: 2.0,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
),
|
|
focusedErrorBorder: UnderlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).error,
|
|
width: 2.0,
|
|
),
|
|
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),
|
|
),
|
|
),
|
|
Column(
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: [
|
|
Row(
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: [
|
|
Text(
|
|
FFLocalizations.of(context).getText(
|
|
'l7tw8b92' /* Tipo de Pessoa */,
|
|
),
|
|
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(width: 24.0)),
|
|
),
|
|
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.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(
|
|
'oonqk812' /* 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(
|
|
'zok7lu4w' /* 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))
|
|
.addToEnd(const SizedBox(height: 10.0)),
|
|
),
|
|
Column(
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: [
|
|
Row(
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: [
|
|
Text(
|
|
FFLocalizations.of(context).getText(
|
|
'pepv7gl9' /* Tipo de Acesso */,
|
|
),
|
|
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(width: 24.0)),
|
|
),
|
|
FlutterFlowCheckboxGroup(
|
|
options: [
|
|
FFLocalizations.of(context).getText(
|
|
'580z80ct' /* Entrada */,
|
|
),
|
|
FFLocalizations.of(context).getText(
|
|
'1nbwqtzs' /* Saida */,
|
|
)
|
|
],
|
|
onChanged: (val) =>
|
|
setState(() => _model.checkboxGroupValues = val),
|
|
controller: _model.checkboxGroupValueController ??=
|
|
FormFieldController<List<String>>(
|
|
List.from([
|
|
FFLocalizations.of(context).getText(
|
|
'5zn9x69v' /* Entrada */,
|
|
),
|
|
FFLocalizations.of(context).getText(
|
|
'8uf522zq' /* Saida */,
|
|
)
|
|
] ??
|
|
[]),
|
|
),
|
|
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),
|
|
),
|
|
checkboxBorderRadius: BorderRadius.circular(6.0),
|
|
initialized: _model.checkboxGroupValues != null,
|
|
),
|
|
]
|
|
.addToStart(const SizedBox(height: 10.0))
|
|
.addToEnd(const SizedBox(height: 10.0)),
|
|
),
|
|
FFButtonWidget(
|
|
onPressed: () async {
|
|
if ((_model.checkboxValue2 == true) &&
|
|
(_model.checkboxValue1 == false)) {
|
|
await widget.togglePersonType?.call(
|
|
'T',
|
|
);
|
|
} else if ((_model.checkboxValue1 == true) &&
|
|
((_model.checkboxValue2 == true) &&
|
|
(_model.checkboxValue1 == false))) {
|
|
await widget.togglePersonType?.call(
|
|
'E',
|
|
);
|
|
} else {
|
|
await widget.togglePersonType?.call(
|
|
'T',
|
|
);
|
|
}
|
|
|
|
Navigator.pop(context);
|
|
},
|
|
text: FFLocalizations.of(context).getText(
|
|
'88kshkph' /* Salvar */,
|
|
),
|
|
options: FFButtonOptions(
|
|
height: 40.0,
|
|
padding:
|
|
const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0),
|
|
iconPadding:
|
|
const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
|
|
color: FlutterFlowTheme.of(context).primary,
|
|
textStyle: FlutterFlowTheme.of(context).titleSmall.override(
|
|
fontFamily:
|
|
FlutterFlowTheme.of(context).titleSmallFamily,
|
|
color: Colors.white,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
FlutterFlowTheme.of(context).titleSmallFamily),
|
|
),
|
|
borderSide: const BorderSide(
|
|
color: Colors.transparent,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
),
|
|
),
|
|
]
|
|
.divide(const SizedBox(height: 10.0))
|
|
.addToStart(const SizedBox(height: 10.0))
|
|
.addToEnd(const SizedBox(height: 10.0)),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|