1053 lines
56 KiB
Dart
1053 lines
56 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
import 'package:hub/components/atomic_components/shared_components_atoms/appbar.dart';
|
|
import 'package:hub/components/atomic_components/shared_components_atoms/custom_input.dart';
|
|
import 'package:hub/components/atomic_components/shared_components_atoms/custom_select.dart';
|
|
import 'package:hub/components/atomic_components/shared_components_atoms/media_upload_button.dart';
|
|
import 'package:hub/components/atomic_components/shared_components_atoms/submit_button.dart';
|
|
import 'package:hub/components/atomic_components/shared_components_atoms/tabview.dart';
|
|
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
|
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
|
import 'package:hub/flutter_flow/form_field_controller.dart';
|
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
|
import 'package:hub/pages/pets_on_the_property_page/pets_history_screen.dart';
|
|
import 'package:hub/pages/pets_page/pets_page_model.dart';
|
|
import 'package:hub/shared/utils/limited_text_size.dart';
|
|
import 'package:material_symbols_icons/symbols.dart';
|
|
|
|
// ignore: must_be_immutable
|
|
class PetsPageWidget extends StatefulWidget {
|
|
dynamic pet;
|
|
|
|
PetsPageWidget({
|
|
super.key,
|
|
this.pet,
|
|
});
|
|
|
|
@override
|
|
State<PetsPageWidget> createState() => _PetsPageWidgetState();
|
|
}
|
|
|
|
class _PetsPageWidgetState extends State<PetsPageWidget>
|
|
with SingleTickerProviderStateMixin {
|
|
late PetsPageModel _model;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_model = createModel(context, () => PetsPageModel(isInteractive: true));
|
|
|
|
_model.updateOnChange = true;
|
|
|
|
_model.onUpdatePet = () {
|
|
safeSetState(() {
|
|
_model.clearFields();
|
|
});
|
|
};
|
|
_model.onRegisterPet = () {
|
|
safeSetState(() {
|
|
_model.clearFields();
|
|
});
|
|
};
|
|
_model.safeSetState = () {
|
|
safeSetState(() {});
|
|
};
|
|
|
|
_model.updateImage = () => setState(() {
|
|
_model.handleUploadComplete(_model.uploadedTempFile!);
|
|
});
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
super.dispose();
|
|
_model.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
_model.buildContext = context;
|
|
|
|
return Scaffold(
|
|
appBar: _buildAppBar(context),
|
|
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
|
body: _buildTabView(context));
|
|
}
|
|
|
|
PreferredSizeWidget _buildAppBar(BuildContext context) {
|
|
return AppBarUtil(
|
|
key: UniqueKey(),
|
|
appBarKey: ValueKey<String>('BackNavigationAppBar'),
|
|
title: FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Cadastrar Pets',
|
|
enText: 'Pets Register',
|
|
),
|
|
onBackButtonPressed: () => context.pop(),
|
|
);
|
|
}
|
|
|
|
void onEditingChanged(bool value) {
|
|
setState(() {
|
|
_model.handleEditingChanged(value);
|
|
});
|
|
}
|
|
|
|
Widget _buildTabView(BuildContext context) {
|
|
return TabViewUtil(
|
|
context: context,
|
|
model: _model,
|
|
labelTab1: _model.isEditing
|
|
? FFLocalizations.of(context)
|
|
.getVariableText(ptText: 'Editar', enText: 'Edit')
|
|
: FFLocalizations.of(context)
|
|
.getVariableText(ptText: 'Cadastrar', enText: 'Register'),
|
|
labelTab2: FFLocalizations.of(context)
|
|
.getVariableText(ptText: 'Consultar', enText: 'History'),
|
|
controller: _model.tabBarController,
|
|
widget1: _model.isEditing
|
|
? _buildEditForm(context)
|
|
: _buildRegisterForm(context),
|
|
widget2: PetsHistoryScreen(model: _model, isApp: false),
|
|
onEditingChanged: onEditingChanged,
|
|
);
|
|
}
|
|
|
|
Widget _buildRegisterForm(BuildContext context) {
|
|
double limitedInputFontSize = LimitedFontSizeUtil.getInputFontSize(context);
|
|
double limitedHeaderFontSize =
|
|
LimitedFontSizeUtil.getHeaderFontSize(context);
|
|
double limitedSubHeaderFontSize =
|
|
LimitedFontSizeUtil.getSubHeaderFontSize(context);
|
|
|
|
return SingleChildScrollView(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: [
|
|
Align(
|
|
alignment: const AlignmentDirectional(-1.0, 0.0),
|
|
child: Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(24.0, 20, 0.0, 15),
|
|
child: Text(
|
|
FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Preencha o formulário com os dados do seu Pet',
|
|
enText: 'Fill out the form with your Pet\'s data',
|
|
),
|
|
textAlign: TextAlign.start,
|
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
FlutterFlowTheme.of(context).bodyMediumFamily),
|
|
fontSize: limitedHeaderFontSize,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Form(
|
|
key: _model.registerFormKey,
|
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.max,
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.fromLTRB(0, 10, 0, 20),
|
|
child: MediaUploadButtonUtil(
|
|
onUploadComplete: _model.handleUploadComplete,
|
|
isUploading: _model.isDataUploading,
|
|
uploadedFiles: _model.uploadedLocalFile,
|
|
labelText: FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Clique para adicionar a foto de seu Pet',
|
|
enText: 'Click to add your Pet\'s photo'),
|
|
),
|
|
),
|
|
CustomInputUtil(
|
|
controller: _model.textControllerName,
|
|
validator: _model.textControllerNameValidator
|
|
.asValidator(context),
|
|
focusNode: _model.textFieldFocusName,
|
|
labelText: FFLocalizations.of(context)
|
|
.getVariableText(ptText: 'Nome', enText: 'Name'),
|
|
hintText: FFLocalizations.of(context)
|
|
.getVariableText(ptText: 'Nome', enText: 'Name'),
|
|
suffixIcon: Symbols.format_color_text,
|
|
haveMaxLength: true,
|
|
onChanged: (value) => setState(() {}),
|
|
maxLength: 80,
|
|
),
|
|
CustomInputUtil(
|
|
controller: _model.textControllerSpecies,
|
|
validator: _model.textControllerSpeciesValidator
|
|
.asValidator(context),
|
|
focusNode: _model.textFieldFocusSpecies,
|
|
labelText: FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Espécie', enText: 'Species'),
|
|
hintText: FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Ex: Cachorro, Gato, Papagaio',
|
|
enText: 'e.g. Dog, Cat, Parrot'),
|
|
suffixIcon: Symbols.sound_detection_dog_barking,
|
|
haveMaxLength: true,
|
|
onChanged: (value) => setState(() {}),
|
|
maxLength: 80,
|
|
),
|
|
CustomInputUtil(
|
|
controller: _model.textControllerRace,
|
|
validator: _model.textControllerRaceValidator
|
|
.asValidator(context),
|
|
focusNode: _model.textFieldFocusRace,
|
|
labelText: FFLocalizations.of(context)
|
|
.getVariableText(ptText: 'Raça', enText: 'Race'),
|
|
hintText: FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Ex: Labrador, Poodle, Siamês, Persa',
|
|
enText: 'e.g. Labrador, Poodle, Siamese, Persian'),
|
|
suffixIcon: Icons.pets_outlined,
|
|
haveMaxLength: true,
|
|
onChanged: (value) => setState(() {}),
|
|
maxLength: 80,
|
|
),
|
|
CustomInputUtil(
|
|
controller: _model.textControllerColor,
|
|
validator: _model.textControllerColorValidator
|
|
.asValidator(context),
|
|
focusNode: _model.textFieldFocusColor,
|
|
labelText: FFLocalizations.of(context)
|
|
.getVariableText(ptText: 'Cor', enText: 'Color'),
|
|
hintText: FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Ex: Preto, Amarelo, Branco',
|
|
enText: 'e.g. Black, Yellow, White'),
|
|
suffixIcon: Symbols.palette,
|
|
haveMaxLength: true,
|
|
onChanged: (value) => setState(() {}),
|
|
maxLength: 80,
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: [
|
|
SizedBox(
|
|
width: MediaQuery.of(context).size.width,
|
|
height: 60.0,
|
|
child: Stack(
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
|
24.0, 0.0, 24.0, 0.0),
|
|
child: TextFormField(
|
|
controller: _model.textControllerData,
|
|
focusNode: _model.textFieldFocusData,
|
|
cursorColor:
|
|
FlutterFlowTheme.of(context).primary,
|
|
readOnly: true,
|
|
autovalidateMode:
|
|
AutovalidateMode.onUserInteraction,
|
|
autofocus: false,
|
|
obscureText: false,
|
|
decoration: InputDecoration(
|
|
isDense: true,
|
|
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),
|
|
fontSize: limitedInputFontSize,
|
|
),
|
|
hintText: FFLocalizations.of(context)
|
|
.getVariableText(
|
|
ptText: 'Data de Nascimento',
|
|
enText: 'Date of Birth',
|
|
),
|
|
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),
|
|
lineHeight: 1.0,
|
|
fontSize: limitedInputFontSize,
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context)
|
|
.customColor6,
|
|
width: 0.5,
|
|
),
|
|
borderRadius:
|
|
BorderRadius.circular(10.0),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context)
|
|
.primary,
|
|
width: 0.5,
|
|
),
|
|
borderRadius:
|
|
BorderRadius.circular(10.0),
|
|
),
|
|
errorBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context)
|
|
.error,
|
|
width: 0.5,
|
|
),
|
|
borderRadius:
|
|
BorderRadius.circular(10.0),
|
|
),
|
|
focusedErrorBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context)
|
|
.error,
|
|
width: 0.5,
|
|
),
|
|
borderRadius:
|
|
BorderRadius.circular(10.0),
|
|
),
|
|
suffixIcon: Icon(
|
|
Icons.date_range,
|
|
color: FlutterFlowTheme.of(context)
|
|
.accent1,
|
|
),
|
|
),
|
|
style: FlutterFlowTheme.of(context)
|
|
.bodyMedium
|
|
.override(
|
|
fontFamily:
|
|
FlutterFlowTheme.of(context)
|
|
.bodyMediumFamily,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap()
|
|
.containsKey(
|
|
FlutterFlowTheme.of(context)
|
|
.bodyMediumFamily),
|
|
lineHeight: 1.8,
|
|
fontSize: limitedInputFontSize,
|
|
),
|
|
textAlign: TextAlign.start,
|
|
validator: _model
|
|
.textControllerDataValidator
|
|
.asValidator(context),
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
|
24.0, 0.0, 24.0, 0.0),
|
|
child: InkWell(
|
|
splashColor: Colors.transparent,
|
|
focusColor: Colors.transparent,
|
|
hoverColor: Colors.transparent,
|
|
highlightColor: Colors.transparent,
|
|
onTap: () async {
|
|
final pickedDate = await showDatePicker(
|
|
context: context,
|
|
initialDate: getCurrentTimestamp,
|
|
firstDate: DateTime(1990),
|
|
lastDate: DateTime.now(),
|
|
builder: (context, child) {
|
|
return wrapInMaterialDatePickerTheme(
|
|
context,
|
|
child!,
|
|
headerBackgroundColor:
|
|
FlutterFlowTheme.of(context)
|
|
.primary,
|
|
headerForegroundColor:
|
|
FlutterFlowTheme.of(context)
|
|
.info,
|
|
headerTextStyle:
|
|
FlutterFlowTheme.of(context)
|
|
.headlineLarge
|
|
.override(
|
|
fontFamily: FlutterFlowTheme
|
|
.of(context)
|
|
.headlineLargeFamily,
|
|
fontSize:
|
|
limitedInputFontSize,
|
|
letterSpacing: 0.0,
|
|
fontWeight:
|
|
FontWeight.w600,
|
|
useGoogleFonts: GoogleFonts
|
|
.asMap()
|
|
.containsKey(
|
|
FlutterFlowTheme.of(
|
|
context)
|
|
.headlineLargeFamily),
|
|
),
|
|
pickerBackgroundColor:
|
|
FlutterFlowTheme.of(context)
|
|
.primaryBackground,
|
|
pickerForegroundColor:
|
|
FlutterFlowTheme.of(context)
|
|
.primaryText,
|
|
selectedDateTimeBackgroundColor:
|
|
FlutterFlowTheme.of(context)
|
|
.primary,
|
|
selectedDateTimeForegroundColor:
|
|
FlutterFlowTheme.of(context)
|
|
.info,
|
|
actionButtonForegroundColor:
|
|
FlutterFlowTheme.of(context)
|
|
.primaryText,
|
|
iconSize: 24.0,
|
|
);
|
|
},
|
|
);
|
|
|
|
if (pickedDate != null) {
|
|
setState(() {
|
|
_model.selectedDate = DateTime(
|
|
pickedDate.year,
|
|
pickedDate.month,
|
|
pickedDate.day,
|
|
);
|
|
|
|
_model.textControllerData =
|
|
TextEditingController(
|
|
text: dateTimeFormat(
|
|
'dd/MM/yyyy',
|
|
_model.selectedDate,
|
|
locale: FFLocalizations.of(context)
|
|
.languageCode,
|
|
));
|
|
_model.textControllerData?.selection =
|
|
TextSelection.collapsed(
|
|
offset: _model.textControllerData!
|
|
.text.length,
|
|
);
|
|
});
|
|
}
|
|
},
|
|
child: Container(
|
|
width: double.infinity,
|
|
height: 80.0,
|
|
decoration: BoxDecoration(
|
|
borderRadius:
|
|
BorderRadius.circular(10.0),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Align(
|
|
alignment: const AlignmentDirectional(-1.0, 0.0),
|
|
child: Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
|
24.0, 0, 0.0, 15),
|
|
child: Text(
|
|
FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Selecione as opções disponíveis',
|
|
enText: 'Select the available options',
|
|
),
|
|
textAlign: TextAlign.start,
|
|
style: FlutterFlowTheme.of(context)
|
|
.bodySmall
|
|
.override(
|
|
fontFamily: FlutterFlowTheme.of(context)
|
|
.bodySmallFamily,
|
|
letterSpacing: 0.0,
|
|
fontWeight: FontWeight.w600,
|
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
FlutterFlowTheme.of(context)
|
|
.bodyMediumFamily),
|
|
fontSize: limitedSubHeaderFontSize,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
|
|
child: CustomSelect(
|
|
options: const ['MAC', 'FEM'],
|
|
controller: _model.dropDownValueController1 ??=
|
|
FormFieldController<String>(
|
|
_model.dropDownValue1 ??= ''),
|
|
isRequired: true,
|
|
changed: (val) => safeSetState(() {
|
|
_model.dropDownValue1 = val;
|
|
}),
|
|
dropDownValue: _model.dropDownValue1,
|
|
optionsLabel: [
|
|
FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Macho', enText: 'Male'),
|
|
FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Fêmea', enText: 'Female')
|
|
],
|
|
hintText: FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Gênero do Pet',
|
|
enText: 'Gender of the Pet')),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
|
|
child: CustomSelect(
|
|
options: const ['MIN', 'PEQ', 'MED', 'GRA', 'GIG'],
|
|
controller: _model.dropDownValueController2 ??=
|
|
FormFieldController<String>(
|
|
_model.dropDownValue2 ??= ''),
|
|
isRequired: true,
|
|
changed: (val) => safeSetState(() {
|
|
_model.dropDownValue2 = val;
|
|
}),
|
|
dropDownValue: _model.dropDownValue2,
|
|
optionsLabel: [
|
|
FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Mini', enText: 'Mini'),
|
|
FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Pequeno', enText: 'Small'),
|
|
FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Médio', enText: 'Medium'),
|
|
FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Grande', enText: 'Big'),
|
|
FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Gigante', enText: 'Giant'),
|
|
],
|
|
hintText: FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Porte do Pet',
|
|
enText: 'Size of the Pet')),
|
|
),
|
|
Align(
|
|
alignment: const AlignmentDirectional(-1.0, 0.0),
|
|
child: Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
|
24.0, 0, 0.0, 15),
|
|
child: Text(
|
|
FFLocalizations.of(context).getVariableText(
|
|
ptText:
|
|
'Você tem alguma observação sobre o seu Pet?',
|
|
enText:
|
|
'Do you have any observations about your Pet?',
|
|
),
|
|
textAlign: TextAlign.start,
|
|
style: FlutterFlowTheme.of(context)
|
|
.bodySmall
|
|
.override(
|
|
fontFamily: FlutterFlowTheme.of(context)
|
|
.bodySmallFamily,
|
|
letterSpacing: 0.0,
|
|
fontWeight: FontWeight.w600,
|
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
FlutterFlowTheme.of(context)
|
|
.bodyMediumFamily),
|
|
fontSize: limitedInputFontSize,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
CustomInputUtil(
|
|
controller: _model.textControllerObservation,
|
|
validator: _model.textControllerObservationValidator
|
|
.asValidator(context),
|
|
focusNode: _model.textFieldFocusObservation,
|
|
labelText: FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Escreva as suas observações aqui...',
|
|
enText: 'Write your observations here...'),
|
|
hintText: FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Escreva as suas observações aqui...',
|
|
enText: 'Write your observations here...'),
|
|
suffixIcon: Icons.text_fields,
|
|
haveMaxLength: true,
|
|
onChanged: (value) => setState(() {}),
|
|
maxLength: 250,
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.fromLTRB(70, 20, 70, 30),
|
|
child: SubmitButtonUtil(
|
|
labelText: FFLocalizations.of(context)
|
|
.getVariableText(
|
|
ptText: 'Cadastrar', enText: 'Register'),
|
|
onPressed: _model.isFormValid(context)
|
|
? _model.registerPet
|
|
: null),
|
|
),
|
|
])),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildEditForm(BuildContext context) {
|
|
return SingleChildScrollView(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: [
|
|
Align(
|
|
alignment: const AlignmentDirectional(-1.0, 0.0),
|
|
child: Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(24.0, 20, 0.0, 15),
|
|
child: Text(
|
|
FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Preencha o formulário com os dados do seu Pet',
|
|
enText: 'Fill out the form with your Pet\'s data',
|
|
),
|
|
textAlign: TextAlign.start,
|
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
FlutterFlowTheme.of(context).bodyMediumFamily),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Form(
|
|
key: _model.updateFormKey,
|
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.max,
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.fromLTRB(0, 10, 0, 20),
|
|
child: MediaUploadButtonUtil(
|
|
onUploadComplete: _model.handleUploadComplete,
|
|
isUploading: _model.isDataUploading,
|
|
uploadedFiles: _model.uploadedLocalFile,
|
|
labelText: FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Clique para adicionar a foto de seu Pet',
|
|
enText: 'Click to add your Pet\'s photo'),
|
|
),
|
|
),
|
|
CustomInputUtil(
|
|
controller: _model.textControllerName,
|
|
validator: _model.textControllerNameValidator
|
|
.asValidator(context),
|
|
focusNode: _model.textFieldFocusName,
|
|
labelText: FFLocalizations.of(context)
|
|
.getVariableText(ptText: 'Nome', enText: 'Name'),
|
|
hintText: FFLocalizations.of(context)
|
|
.getVariableText(ptText: 'Nome', enText: 'Name'),
|
|
suffixIcon: Symbols.format_color_text,
|
|
haveMaxLength: true,
|
|
onChanged: (value) => setState(() {}),
|
|
maxLength: 80,
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
|
|
child: CustomInputUtil(
|
|
controller: _model.textControllerSpecies,
|
|
validator: _model.textControllerSpeciesValidator
|
|
.asValidator(context),
|
|
focusNode: _model.textFieldFocusSpecies,
|
|
labelText: FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Espécie', enText: 'Species'),
|
|
hintText: FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Ex: Cachorro, Gato, Papagaio',
|
|
enText: 'e.g. Dog, Cat, Parrot'),
|
|
suffixIcon: Symbols.sound_detection_dog_barking,
|
|
haveMaxLength: true,
|
|
onChanged: (value) => setState(() {}),
|
|
maxLength: 80,
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
|
|
child: CustomInputUtil(
|
|
controller: _model.textControllerRace,
|
|
validator: _model.textControllerRaceValidator
|
|
.asValidator(context),
|
|
focusNode: _model.textFieldFocusRace,
|
|
labelText: FFLocalizations.of(context)
|
|
.getVariableText(ptText: 'Raça', enText: 'Race'),
|
|
hintText: FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Ex: Labrador, Poodle, Siamês, Persa',
|
|
enText: 'e.g. Labrador, Poodle, Siamese, Persian'),
|
|
suffixIcon: Icons.pets_outlined,
|
|
haveMaxLength: true,
|
|
onChanged: (value) => setState(() {}),
|
|
maxLength: 80,
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
|
|
child: CustomInputUtil(
|
|
controller: _model.textControllerColor,
|
|
validator: _model.textControllerColorValidator
|
|
.asValidator(context),
|
|
focusNode: _model.textFieldFocusColor,
|
|
labelText: FFLocalizations.of(context)
|
|
.getVariableText(ptText: 'Cor', enText: 'Color'),
|
|
hintText: FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Ex: Preto, Amarelo, Branco',
|
|
enText: 'e.g. Black, Yellow, White'),
|
|
suffixIcon: Symbols.palette,
|
|
haveMaxLength: true,
|
|
onChanged: (value) => setState(() {}),
|
|
maxLength: 80,
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: [
|
|
SizedBox(
|
|
width: MediaQuery.of(context).size.width,
|
|
height: 60.0,
|
|
child: Stack(
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
|
24.0, 0.0, 24.0, 0.0),
|
|
child: TextFormField(
|
|
controller: _model.textControllerData,
|
|
focusNode: _model.textFieldFocusData,
|
|
cursorColor:
|
|
FlutterFlowTheme.of(context).primary,
|
|
readOnly: true,
|
|
autovalidateMode:
|
|
AutovalidateMode.onUserInteraction,
|
|
autofocus: false,
|
|
obscureText: false,
|
|
decoration: InputDecoration(
|
|
isDense: true,
|
|
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),
|
|
),
|
|
hintText: FFLocalizations.of(context)
|
|
.getVariableText(
|
|
ptText: 'Data de Nascimento',
|
|
enText: 'Date of Birth',
|
|
),
|
|
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),
|
|
lineHeight: 1.0,
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context)
|
|
.customColor6,
|
|
width: 0.5,
|
|
),
|
|
borderRadius:
|
|
BorderRadius.circular(10.0),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context)
|
|
.primary,
|
|
width: 0.5,
|
|
),
|
|
borderRadius:
|
|
BorderRadius.circular(10.0),
|
|
),
|
|
errorBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context)
|
|
.error,
|
|
width: 0.5,
|
|
),
|
|
borderRadius:
|
|
BorderRadius.circular(10.0),
|
|
),
|
|
focusedErrorBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context)
|
|
.error,
|
|
width: 0.5,
|
|
),
|
|
borderRadius:
|
|
BorderRadius.circular(10.0),
|
|
),
|
|
suffixIcon: Icon(
|
|
Icons.date_range,
|
|
color: FlutterFlowTheme.of(context)
|
|
.accent1,
|
|
),
|
|
),
|
|
style: FlutterFlowTheme.of(context)
|
|
.bodyMedium
|
|
.override(
|
|
fontFamily:
|
|
FlutterFlowTheme.of(context)
|
|
.bodyMediumFamily,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap()
|
|
.containsKey(
|
|
FlutterFlowTheme.of(context)
|
|
.bodyMediumFamily),
|
|
lineHeight: 1.8,
|
|
),
|
|
textAlign: TextAlign.start,
|
|
validator: _model
|
|
.textControllerDataValidator
|
|
.asValidator(context),
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
|
24.0, 0.0, 24.0, 0.0),
|
|
child: InkWell(
|
|
splashColor: Colors.transparent,
|
|
focusColor: Colors.transparent,
|
|
hoverColor: Colors.transparent,
|
|
highlightColor: Colors.transparent,
|
|
onTap: () async {
|
|
final pickedDate = await showDatePicker(
|
|
context: context,
|
|
initialDate: DateFormat('dd/MM/yyyy')
|
|
.tryParse(
|
|
_model.textControllerData.text),
|
|
firstDate: DateTime(1990),
|
|
lastDate: DateTime.now(),
|
|
builder: (context, child) {
|
|
return wrapInMaterialDatePickerTheme(
|
|
context,
|
|
child!,
|
|
headerBackgroundColor:
|
|
FlutterFlowTheme.of(context)
|
|
.primary,
|
|
headerForegroundColor:
|
|
FlutterFlowTheme.of(context)
|
|
.info,
|
|
headerTextStyle:
|
|
FlutterFlowTheme.of(context)
|
|
.headlineLarge
|
|
.override(
|
|
fontFamily: FlutterFlowTheme
|
|
.of(context)
|
|
.headlineLargeFamily,
|
|
fontSize: 32.0,
|
|
letterSpacing: 0.0,
|
|
fontWeight:
|
|
FontWeight.w600,
|
|
useGoogleFonts: GoogleFonts
|
|
.asMap()
|
|
.containsKey(
|
|
FlutterFlowTheme.of(
|
|
context)
|
|
.headlineLargeFamily),
|
|
),
|
|
pickerBackgroundColor:
|
|
FlutterFlowTheme.of(context)
|
|
.primaryBackground,
|
|
pickerForegroundColor:
|
|
FlutterFlowTheme.of(context)
|
|
.primaryText,
|
|
selectedDateTimeBackgroundColor:
|
|
FlutterFlowTheme.of(context)
|
|
.primary,
|
|
selectedDateTimeForegroundColor:
|
|
FlutterFlowTheme.of(context)
|
|
.info,
|
|
actionButtonForegroundColor:
|
|
FlutterFlowTheme.of(context)
|
|
.primaryText,
|
|
iconSize: 24.0,
|
|
);
|
|
},
|
|
);
|
|
|
|
if (pickedDate != null) {
|
|
setState(() {
|
|
_model.selectedDate = DateTime(
|
|
pickedDate.year,
|
|
pickedDate.month,
|
|
pickedDate.day,
|
|
);
|
|
|
|
_model.textControllerData =
|
|
TextEditingController(
|
|
text: dateTimeFormat(
|
|
'dd/MM/yyyy',
|
|
_model.selectedDate,
|
|
locale: FFLocalizations.of(context)
|
|
.languageCode,
|
|
));
|
|
_model.textControllerData?.selection =
|
|
TextSelection.collapsed(
|
|
offset: _model.textControllerData!
|
|
.text.length,
|
|
);
|
|
});
|
|
}
|
|
},
|
|
child: Container(
|
|
width: double.infinity,
|
|
height: 80.0,
|
|
decoration: BoxDecoration(
|
|
borderRadius:
|
|
BorderRadius.circular(10.0),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Align(
|
|
alignment: const AlignmentDirectional(-1.0, 0.0),
|
|
child: Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
|
24.0, 0, 0.0, 15),
|
|
child: Text(
|
|
FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Selecione as opções disponíveis',
|
|
enText: 'Select the available options',
|
|
),
|
|
textAlign: TextAlign.start,
|
|
style: FlutterFlowTheme.of(context)
|
|
.bodySmall
|
|
.override(
|
|
fontFamily: FlutterFlowTheme.of(context)
|
|
.bodySmallFamily,
|
|
letterSpacing: 0.0,
|
|
fontWeight: FontWeight.w600,
|
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
FlutterFlowTheme.of(context)
|
|
.bodyMediumFamily),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
|
|
child: CustomSelect(
|
|
options: const ['MAC', 'FEM'],
|
|
controller: _model.dropDownValueController1 ??=
|
|
FormFieldController<String>(
|
|
_model.dropDownValue1 ??= ''),
|
|
isRequired: true,
|
|
changed: (val) => safeSetState(() {
|
|
_model.dropDownValue1 = val;
|
|
}),
|
|
dropDownValue: _model.dropDownValue1,
|
|
optionsLabel: [
|
|
FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Macho', enText: 'Male'),
|
|
FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Fêmea', enText: 'Female')
|
|
],
|
|
hintText: FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Selecione o gênero do Pet',
|
|
enText: 'Select the gender of the Pet')),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
|
|
child: CustomSelect(
|
|
options: const ['MIN', 'PEQ', 'MED', 'GRA', 'GIG'],
|
|
controller: _model.dropDownValueController2 ??=
|
|
FormFieldController<String>(
|
|
_model.dropDownValue2 ??= ''),
|
|
isRequired: true,
|
|
changed: (val) => safeSetState(() {
|
|
_model.dropDownValue2 = val;
|
|
}),
|
|
dropDownValue: _model.dropDownValue1,
|
|
optionsLabel: [
|
|
FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Mini', enText: 'Mini'),
|
|
FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Pequeno', enText: 'Small'),
|
|
FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Médio', enText: 'Medium'),
|
|
FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Grande', enText: 'Big'),
|
|
FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Gigante', enText: 'Giant'),
|
|
],
|
|
hintText: FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Selecione o porte do Pet',
|
|
enText: 'Select the size of the Pet')),
|
|
),
|
|
Align(
|
|
alignment: const AlignmentDirectional(-1.0, 0.0),
|
|
child: Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
|
24.0, 0, 0.0, 15),
|
|
child: Text(
|
|
FFLocalizations.of(context).getVariableText(
|
|
ptText:
|
|
'Você tem alguma observação sobre o seu Pet?',
|
|
enText:
|
|
'Do you have any observations about your Pet?',
|
|
),
|
|
textAlign: TextAlign.start,
|
|
style: FlutterFlowTheme.of(context)
|
|
.bodySmall
|
|
.override(
|
|
fontFamily: FlutterFlowTheme.of(context)
|
|
.bodySmallFamily,
|
|
letterSpacing: 0.0,
|
|
fontWeight: FontWeight.w600,
|
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
FlutterFlowTheme.of(context)
|
|
.bodyMediumFamily),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
CustomInputUtil(
|
|
controller: _model.textControllerObservation,
|
|
validator: _model.textControllerObservationValidator
|
|
.asValidator(context),
|
|
focusNode: _model.textFieldFocusObservation,
|
|
labelText: FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Escreva as suas observações aqui...',
|
|
enText: 'Write your observations here...'),
|
|
hintText: FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Escreva as suas observações aqui...',
|
|
enText: 'Write your observations here...'),
|
|
suffixIcon: Icons.text_fields,
|
|
haveMaxLength: true,
|
|
maxLength: 250,
|
|
onChanged: (value) => setState(() {}),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.fromLTRB(70, 20, 70, 30),
|
|
child: SubmitButtonUtil(
|
|
labelText: FFLocalizations.of(context)
|
|
.getVariableText(
|
|
ptText: 'Salvar', enText: 'Save'),
|
|
onPressed: _model.isFormValid(context)
|
|
? _model.updatePet
|
|
: null),
|
|
),
|
|
])),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|