fix MediaUploadFile and TextFormField validate
This commit is contained in:
parent
5d8d56cb70
commit
a9135c5f58
|
@ -14,13 +14,13 @@ class MediaUploadButtonUtil extends StatefulWidget {
|
||||||
final String labelText;
|
final String labelText;
|
||||||
FFUploadedFile? uploadedFiles;
|
FFUploadedFile? uploadedFiles;
|
||||||
|
|
||||||
MediaUploadButtonUtil(
|
MediaUploadButtonUtil({
|
||||||
{Key? key,
|
Key? key,
|
||||||
required this.onUploadComplete,
|
required this.onUploadComplete,
|
||||||
required this.isUploading,
|
required this.isUploading,
|
||||||
required this.labelText,
|
required this.labelText,
|
||||||
this.uploadedFiles})
|
this.uploadedFiles,
|
||||||
: super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<MediaUploadButtonUtil> createState() => _MediaUploadButtonUtilState();
|
State<MediaUploadButtonUtil> createState() => _MediaUploadButtonUtilState();
|
||||||
|
|
|
@ -13,6 +13,8 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
late final TabController tabBarController;
|
late final TabController tabBarController;
|
||||||
VoidCallback? onUpdatePet;
|
VoidCallback? onUpdatePet;
|
||||||
VoidCallback? onRegisterPet;
|
VoidCallback? onRegisterPet;
|
||||||
|
VoidCallback? safeSetState;
|
||||||
|
|
||||||
final GlobalKey<FormState> registerFormKey = GlobalKey<FormState>();
|
final GlobalKey<FormState> registerFormKey = GlobalKey<FormState>();
|
||||||
final GlobalKey<FormState> updateFormKey = GlobalKey<FormState>();
|
final GlobalKey<FormState> updateFormKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
|
@ -152,7 +154,7 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
|
|
||||||
// Validador do formulário
|
// Validador do formulário
|
||||||
bool isFormValid(BuildContext context) {
|
bool isFormValid(BuildContext context) {
|
||||||
if (uploadedLocalFile == null) {
|
if (uploadedLocalFile == null || uploadedLocalFile!.bytes!.isEmpty) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (textControllerName.text.isEmpty ||
|
if (textControllerName.text.isEmpty ||
|
||||||
|
@ -272,6 +274,7 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
|
|
||||||
void handleUploadComplete(FFUploadedFile uploadedFile) {
|
void handleUploadComplete(FFUploadedFile uploadedFile) {
|
||||||
uploadedLocalFile = uploadedFile;
|
uploadedLocalFile = uploadedFile;
|
||||||
|
safeSetState?.call();
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleEditingChanged(bool editing) {
|
void handleEditingChanged(bool editing) {
|
||||||
|
|
|
@ -67,6 +67,9 @@ class _PetsPageWidgetState extends State<PetsPageWidget>
|
||||||
_model.clearFields();
|
_model.clearFields();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
_model.safeSetState = () {
|
||||||
|
safeSetState(() {});
|
||||||
|
};
|
||||||
|
|
||||||
widget.pet != null ? _model.isEditing = true : _model.isEditing = false;
|
widget.pet != null ? _model.isEditing = true : _model.isEditing = false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue