WIP
This commit is contained in:
parent
330b49ae18
commit
3b41f09a64
|
@ -36,15 +36,11 @@ class ScheduleProvisionalVisitPageModel extends FlutterFlowModel<ScheduleProvisi
|
||||||
String? Function(BuildContext, String?)? personNameTextControllerValidator;
|
String? Function(BuildContext, String?)? personNameTextControllerValidator;
|
||||||
String? _personNameTextControllerValidator(BuildContext context, String? val) {
|
String? _personNameTextControllerValidator(BuildContext context, String? val) {
|
||||||
if (val == null || val.isEmpty) {
|
if (val == null || val.isEmpty) {
|
||||||
return FFLocalizations.of(context).getText(
|
return FFLocalizations.of(context).getText('3hqg8buh');
|
||||||
'3hqg8buh',
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (val.length > 80) {
|
if (val.length > 80) {
|
||||||
return FFLocalizations.of(context).getText(
|
return FFLocalizations.of(context).getText('l0b0zr50');
|
||||||
'l0b0zr50',
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -55,15 +51,11 @@ class ScheduleProvisionalVisitPageModel extends FlutterFlowModel<ScheduleProvisi
|
||||||
String? Function(BuildContext, String?)? dateTimeTextControllerValidator;
|
String? Function(BuildContext, String?)? dateTimeTextControllerValidator;
|
||||||
String? _dateTimeTextControllerValidator(BuildContext context, String? val) {
|
String? _dateTimeTextControllerValidator(BuildContext context, String? val) {
|
||||||
if (val == null || val.isEmpty) {
|
if (val == null || val.isEmpty) {
|
||||||
return FFLocalizations.of(context).getText(
|
return FFLocalizations.of(context).getText('uzefkuf9');
|
||||||
'uzefkuf9',
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DateTime selectedDateTime;
|
DateTime selectedDateTime;
|
||||||
DateTime currentDateTime = DateTime.now().add(const Duration(days: 1));
|
DateTime currentDateTime = DateTime.now().add(const Duration(days: 1));
|
||||||
selectedDateTime = DateFormat('dd/MM/yyyy HH:mm:ss').parse(dateTimeTextController.text);
|
selectedDateTime = DateFormat('dd/MM/yyyy HH:mm:ss').parse(dateTimeTextController.text);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
log('dateTimeTextController.text: ${dateTimeTextController.text}');
|
log('dateTimeTextController.text: ${dateTimeTextController.text}');
|
||||||
selectedDateTime = DateFormat('dd/MM/yyyy HH:mm:ss').parse(dateTimeTextController.text);
|
selectedDateTime = DateFormat('dd/MM/yyyy HH:mm:ss').parse(dateTimeTextController.text);
|
||||||
|
@ -73,14 +65,12 @@ class ScheduleProvisionalVisitPageModel extends FlutterFlowModel<ScheduleProvisi
|
||||||
enText: 'Invalid date/time format',
|
enText: 'Invalid date/time format',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedDateTime.isBefore(currentDateTime)) {
|
if (selectedDateTime.isBefore(currentDateTime)) {
|
||||||
return FFLocalizations.of(context).getVariableText(
|
return FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'A data/hora selecionada deve ser no mínimo 24 horas no futuro',
|
ptText: 'A data/hora selecionada deve ser no mínimo 24 horas no futuro',
|
||||||
enText: 'Selected date/time must be at least 24 hours in the future',
|
enText: 'Selected date/time must be at least 24 hours in the future',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,6 +98,18 @@ class ScheduleProvisionalVisitPageModel extends FlutterFlowModel<ScheduleProvisi
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
personNameFocusNode?.dispose();
|
||||||
|
personNameTextController?.dispose();
|
||||||
|
|
||||||
|
dateTimeFocusNode?.dispose();
|
||||||
|
dateTimeTextController?.dispose();
|
||||||
|
|
||||||
|
notesFocusNode?.dispose();
|
||||||
|
notesTextController?.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
bool isFormValid() {
|
bool isFormValid() {
|
||||||
if (personNameTextController.text == '' || personNameTextController.text.length > 80) {
|
if (personNameTextController.text == '' || personNameTextController.text.length > 80) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -142,16 +144,4 @@ class ScheduleProvisionalVisitPageModel extends FlutterFlowModel<ScheduleProvisi
|
||||||
ownerUUID = StorageUtil().ownerUUID;
|
ownerUUID = StorageUtil().ownerUUID;
|
||||||
setState?.call();
|
setState?.call();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
personNameFocusNode?.dispose();
|
|
||||||
personNameTextController?.dispose();
|
|
||||||
|
|
||||||
dateTimeFocusNode?.dispose();
|
|
||||||
dateTimeTextController?.dispose();
|
|
||||||
|
|
||||||
notesFocusNode?.dispose();
|
|
||||||
notesTextController?.dispose();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue