fix: add form validador
This commit is contained in:
parent
1ee6c90520
commit
0b57716abe
|
@ -52,8 +52,8 @@ Future<List<SelectedFile>?> selectMediaWithSourceBottomSheet({
|
||||||
required bool allowPhoto,
|
required bool allowPhoto,
|
||||||
bool allowVideo = false,
|
bool allowVideo = false,
|
||||||
String pickerFontFamily = 'Roboto',
|
String pickerFontFamily = 'Roboto',
|
||||||
Color textColor = const Color(0xFF111417),
|
// Color textColor = const Color(0xFF111417),
|
||||||
Color backgroundColor = const Color(0xFFF5F5F5),
|
// Color backgroundColor = const Color(0xFFF5F5F5),
|
||||||
bool includeDimensions = false,
|
bool includeDimensions = false,
|
||||||
bool includeBlurHash = false,
|
bool includeBlurHash = false,
|
||||||
}) async {
|
}) async {
|
||||||
|
@ -63,12 +63,12 @@ Future<List<SelectedFile>?> selectMediaWithSourceBottomSheet({
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: GoogleFonts.getFont(
|
style: GoogleFonts.getFont(
|
||||||
pickerFontFamily,
|
pickerFontFamily,
|
||||||
color: textColor,
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
tileColor: backgroundColor,
|
tileColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
dense: false,
|
dense: false,
|
||||||
onTap: () => Navigator.pop(
|
onTap: () => Navigator.pop(
|
||||||
context,
|
context,
|
||||||
|
@ -77,7 +77,7 @@ Future<List<SelectedFile>?> selectMediaWithSourceBottomSheet({
|
||||||
);
|
);
|
||||||
final mediaSource = await showModalBottomSheet<MediaSource>(
|
final mediaSource = await showModalBottomSheet<MediaSource>(
|
||||||
context: context,
|
context: context,
|
||||||
backgroundColor: backgroundColor,
|
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
@ -91,13 +91,13 @@ Future<List<SelectedFile>?> selectMediaWithSourceBottomSheet({
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: GoogleFonts.getFont(
|
style: GoogleFonts.getFont(
|
||||||
pickerFontFamily,
|
pickerFontFamily,
|
||||||
color: textColor.withOpacity(0.65),
|
color: FlutterFlowTheme.of(context).primaryText.withOpacity(0.65),
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
tileColor: backgroundColor,
|
tileColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
dense: false,
|
dense: true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
|
|
|
@ -17,10 +17,28 @@ class RegisterVisitorPageModel
|
||||||
FocusNode? textFieldFocusNode1;
|
FocusNode? textFieldFocusNode1;
|
||||||
TextEditingController? textController1;
|
TextEditingController? textController1;
|
||||||
String? Function(BuildContext, String?)? textController1Validator;
|
String? Function(BuildContext, String?)? textController1Validator;
|
||||||
|
String? _textController1Validator(BuildContext context, String? val) {
|
||||||
|
if (val == null || val.isEmpty) {
|
||||||
|
return FFLocalizations.of(context).getVariableText(
|
||||||
|
enText: 'This field is required',
|
||||||
|
ptText: 'Este campo é obrigatório',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
// 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;
|
||||||
|
String? _textController2Validator(BuildContext context, String? val) {
|
||||||
|
if (val == null || val.isEmpty) {
|
||||||
|
return FFLocalizations.of(context).getVariableText(
|
||||||
|
enText: 'This field is required',
|
||||||
|
ptText: 'Este campo é obrigatório',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
// State field(s) for DropDown widget.
|
// State field(s) for DropDown widget.
|
||||||
String? dropDownValue;
|
String? dropDownValue;
|
||||||
FormFieldController<String>? dropDownValueController;
|
FormFieldController<String>? dropDownValueController;
|
||||||
|
@ -28,17 +46,56 @@ class RegisterVisitorPageModel
|
||||||
FocusNode? textFieldFocusNode3;
|
FocusNode? textFieldFocusNode3;
|
||||||
TextEditingController? textController3;
|
TextEditingController? textController3;
|
||||||
String? Function(BuildContext, String?)? textController3Validator;
|
String? Function(BuildContext, String?)? textController3Validator;
|
||||||
|
String? _textController3Validator(BuildContext context, String? val) {
|
||||||
|
if (val == null || val.isEmpty) {
|
||||||
|
return FFLocalizations.of(context).getVariableText(
|
||||||
|
enText: 'This field is required',
|
||||||
|
ptText: 'Este campo é obrigatório',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
// State field(s) for TextField widget.
|
// State field(s) for TextField widget.
|
||||||
FocusNode? textFieldFocusNode4;
|
FocusNode? textFieldFocusNode4;
|
||||||
TextEditingController? textController4;
|
TextEditingController? textController4;
|
||||||
String? Function(BuildContext, String?)? textController4Validator;
|
String? Function(BuildContext, String?)? textController4Validator;
|
||||||
|
String? _textController4Validator(BuildContext context, String? val) {
|
||||||
|
if (val == null || val.isEmpty) {
|
||||||
|
return FFLocalizations.of(context).getVariableText(
|
||||||
|
enText: 'This field is required',
|
||||||
|
ptText: 'Este campo é obrigatório',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
// Stores action output result for [Custom Action - convertImageFileToBase64] action in Button widget.
|
// Stores action output result for [Custom Action - convertImageFileToBase64] action in Button widget.
|
||||||
String? imgBase64;
|
String? imgBase64;
|
||||||
// Stores action output result for [Backend Call - API (postScheduleVisitor)] action in Button widget.
|
// Stores action output result for [Backend Call - API (postScheduleVisitor)] action in Button widget.
|
||||||
ApiCallResponse? scheduleVisitor;
|
ApiCallResponse? scheduleVisitor;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState(BuildContext context) {}
|
void initState(BuildContext context) {
|
||||||
|
|
||||||
|
textFieldFocusNode1 = FocusNode();
|
||||||
|
textController1 = TextEditingController();
|
||||||
|
textController1Validator = _textController1Validator;
|
||||||
|
|
||||||
|
textFieldFocusNode2 = FocusNode();
|
||||||
|
textController2 = TextEditingController();
|
||||||
|
textController2Validator = _textController2Validator;
|
||||||
|
|
||||||
|
|
||||||
|
dropDownValue = '';
|
||||||
|
// dropDownValueController = FormFieldController<String>(initialValue: dropDownValue);
|
||||||
|
|
||||||
|
textFieldFocusNode3 = FocusNode();
|
||||||
|
textController3 = TextEditingController();
|
||||||
|
textController3Validator = _textController3Validator;
|
||||||
|
|
||||||
|
textFieldFocusNode4 = FocusNode();
|
||||||
|
textController4 = TextEditingController();
|
||||||
|
textController4Validator = _textController4Validator;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue