flutter-freaccess-hub/lib/pages/pets_page/pets_page_model.dart

81 lines
2.5 KiB
Dart

import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/flutter_flow/form_field_controller.dart';
import 'package:hub/pages/pets_page/pets_page_widget.dart';
class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
late final TabController tabBarController;
final unfocusNode = FocusNode();
// Controller para o Upload de Arquivos
bool isDataUploading = false;
FFUploadedFile uploadedLocalFile =
FFUploadedFile(bytes: Uint8List.fromList([]));
// Controller para o DropDown
String? dropDownValue1;
FormFieldController<String>? dropDownValueController1;
String? dropDownValue2;
FormFieldController<String>? dropDownValueController2;
// Controller para o TextField
FocusNode? textFieldFocusName;
TextEditingController? textControllerName;
String? Function(BuildContext, String?)? textControllerNameValidator;
String? _textControllerNameValidator(BuildContext context, String? val) {
log('Chamou esta merda');
if (val == null || val.isEmpty) {
return FFLocalizations.of(context).getVariableText(
enText: 'This field is required',
ptText: 'Este campo é obrigatório',
);
}
return null;
}
FocusNode? textFieldFocusSpecies;
TextEditingController? textControllerSpecies;
String? Function(BuildContext, String?)? textControllerSpeciesValidator;
FocusNode? textFieldFocusRace;
TextEditingController? textControllerRace;
String? Function(BuildContext, String?)? textControllerRaceValidator;
FocusNode? textFieldFocusColor;
TextEditingController? textControllerColor;
String? Function(BuildContext, String?)? textControllerColorValidator;
FocusNode? textFieldFocusData;
TextEditingController? textControllerData;
String? Function(BuildContext, String?)? textControllerDataValidator;
FocusNode? textFieldFocusObservation;
TextEditingController? textControllerObservation;
String? Function(BuildContext, String?)? textControllerObservationValidator;
@override
void initState(BuildContext context) {
// Se liga! Esse é o controller do TabBar
tabBarController = TabController(
vsync: Navigator.of(context),
length: 2,
);
textFieldFocusName = FocusNode();
textControllerName = TextEditingController();
textControllerNameValidator =
(context, value) => _textControllerNameValidator(context, value);
}
@override
void dispose() {
tabBarController.dispose();
textFieldFocusName?.dispose();
textControllerName?.dispose();
}
}