Fix: Arrumado o input de data e de dropdown agora está passando os parametros corretamente
This commit is contained in:
parent
0dd0990523
commit
6ba19e548c
|
@ -1,10 +1,12 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||
|
||||
class CustomDatePickerUtil extends StatefulWidget {
|
||||
final TextEditingController? controller;
|
||||
TextEditingController? controller;
|
||||
final FocusNode? focusNode;
|
||||
final String hintText;
|
||||
final String dateFormat;
|
||||
|
@ -15,7 +17,7 @@ class CustomDatePickerUtil extends StatefulWidget {
|
|||
final bool timePicker;
|
||||
final FormFieldValidator<String>? validator;
|
||||
|
||||
const CustomDatePickerUtil({
|
||||
CustomDatePickerUtil({
|
||||
Key? key,
|
||||
this.controller,
|
||||
this.focusNode,
|
||||
|
@ -40,13 +42,19 @@ class _CustomDatePickerState extends State<CustomDatePickerUtil> {
|
|||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
log('Chamou o initState');
|
||||
_selectedDate = widget.initialDate;
|
||||
}
|
||||
|
||||
Future<void> _selectDate(BuildContext context) async {
|
||||
final DateTime? pickedDate = await showDatePicker(
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
_selectDate(BuildContext context) async {
|
||||
final pickedDate = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: _selectedDate ?? DateTime.now(),
|
||||
initialDate: getCurrentTimestamp,
|
||||
firstDate: widget.firstDate,
|
||||
lastDate: widget.lastDate ?? DateTime(2100),
|
||||
builder: (context, child) {
|
||||
|
@ -131,12 +139,18 @@ class _CustomDatePickerState extends State<CustomDatePickerUtil> {
|
|||
}
|
||||
} else {
|
||||
setState(() {
|
||||
_selectedDate = pickedDate;
|
||||
widget.controller?.text = dateTimeFormat(
|
||||
log('Chamou o setState da datinha');
|
||||
_selectedDate = DateTime(
|
||||
pickedDate.year,
|
||||
pickedDate.month,
|
||||
pickedDate.day,
|
||||
);
|
||||
widget.controller = TextEditingController(
|
||||
text: dateTimeFormat(
|
||||
widget.dateFormat,
|
||||
_selectedDate,
|
||||
locale: widget.locale,
|
||||
);
|
||||
));
|
||||
widget.controller?.selection = TextSelection.collapsed(
|
||||
offset: widget.controller!.text.length,
|
||||
);
|
||||
|
|
|
@ -5,13 +5,14 @@ import 'package:hub/components/atomic_components/shared_components_atoms/tabview
|
|||
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||
|
||||
class CustomInputUtil extends StatelessWidget {
|
||||
class CustomInputUtil extends StatefulWidget {
|
||||
final TextEditingController? controller;
|
||||
final String? labelText;
|
||||
final String? hintText;
|
||||
final bool? obscureText;
|
||||
final IconData? suffixIcon;
|
||||
final bool autoFocus;
|
||||
FocusNode? focusNode;
|
||||
final TextInputAction textInputAction;
|
||||
final TextInputType keyboardType;
|
||||
final int maxLength;
|
||||
|
@ -25,6 +26,7 @@ class CustomInputUtil extends StatelessWidget {
|
|||
required this.hintText,
|
||||
required this.suffixIcon,
|
||||
this.autoFocus = false,
|
||||
required this.focusNode,
|
||||
this.textInputAction = TextInputAction.next,
|
||||
this.keyboardType = TextInputType.text,
|
||||
this.maxLength = 80,
|
||||
|
@ -33,6 +35,16 @@ class CustomInputUtil extends StatelessWidget {
|
|||
required this.haveMaxLength})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
State<CustomInputUtil> createState() => _CustomInputUtilState();
|
||||
}
|
||||
|
||||
class _CustomInputUtilState extends State<CustomInputUtil> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
|
@ -40,14 +52,15 @@ class CustomInputUtil extends StatelessWidget {
|
|||
child: Column(
|
||||
children: [
|
||||
TextFormField(
|
||||
controller: controller,
|
||||
controller: widget.controller,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
autofocus: autoFocus,
|
||||
textInputAction: textInputAction,
|
||||
autofocus: widget.autoFocus,
|
||||
focusNode: widget.focusNode,
|
||||
textInputAction: widget.textInputAction,
|
||||
obscureText: false,
|
||||
decoration: InputDecoration(
|
||||
isDense: true,
|
||||
labelText: labelText,
|
||||
labelText: widget.labelText,
|
||||
labelStyle: FlutterFlowTheme.of(context).labelMedium.override(
|
||||
fontFamily: FlutterFlowTheme.of(context).labelMediumFamily,
|
||||
color: FlutterFlowTheme.of(context).primaryText,
|
||||
|
@ -55,7 +68,7 @@ class CustomInputUtil extends StatelessWidget {
|
|||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||
FlutterFlowTheme.of(context).labelMediumFamily),
|
||||
),
|
||||
hintText: hintText,
|
||||
hintText: widget.hintText,
|
||||
hintStyle: FlutterFlowTheme.of(context).labelMedium.override(
|
||||
fontFamily: FlutterFlowTheme.of(context).labelMediumFamily,
|
||||
color: FlutterFlowTheme.of(context).primaryText,
|
||||
|
@ -92,7 +105,7 @@ class CustomInputUtil extends StatelessWidget {
|
|||
borderRadius: BorderRadius.circular(10.0),
|
||||
),
|
||||
suffixIcon: Icon(
|
||||
suffixIcon,
|
||||
widget.suffixIcon,
|
||||
color: FlutterFlowTheme.of(context).accent1,
|
||||
),
|
||||
),
|
||||
|
@ -104,10 +117,12 @@ class CustomInputUtil extends StatelessWidget {
|
|||
FlutterFlowTheme.of(context).bodyMediumFamily),
|
||||
),
|
||||
maxLines: null,
|
||||
maxLength: haveMaxLength ? maxLength : null,
|
||||
keyboardType: keyboardType,
|
||||
inputFormatters: [LengthLimitingTextInputFormatter(maxLength)],
|
||||
validator: validator,
|
||||
maxLength: widget.haveMaxLength ? widget.maxLength : null,
|
||||
keyboardType: widget.keyboardType,
|
||||
inputFormatters: [
|
||||
LengthLimitingTextInputFormatter(widget.maxLength)
|
||||
],
|
||||
validator: widget.validator,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
import 'dart:developer';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:hub/components/organism_components/message_well_component/message_well_component_widget.dart';
|
||||
import 'package:hub/flutter_flow/flutter_flow_drop_down.dart';
|
||||
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||
|
@ -10,14 +14,20 @@ class CustomSelect extends StatefulWidget {
|
|||
final List<String> options;
|
||||
final List<String> optionsLabel;
|
||||
final String hintText;
|
||||
final FormFieldController<String>? controller;
|
||||
final bool isMultiSelect;
|
||||
FormFieldController<String> controller;
|
||||
dynamic Function(String?)? changed;
|
||||
String? dropDownValue;
|
||||
|
||||
const CustomSelect({
|
||||
CustomSelect({
|
||||
Key? key,
|
||||
required this.options,
|
||||
required this.optionsLabel,
|
||||
required this.hintText,
|
||||
this.controller,
|
||||
required this.controller,
|
||||
required this.changed,
|
||||
this.dropDownValue,
|
||||
this.isMultiSelect = false,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
|
@ -25,12 +35,9 @@ class CustomSelect extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _CustomSelectState extends State<CustomSelect> {
|
||||
late FormFieldController<String> _controller;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_controller = widget.controller ?? FormFieldController<String>(null);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -53,12 +60,13 @@ class _CustomSelectState extends State<CustomSelect> {
|
|||
child: FlutterFlowDropDown<String>(
|
||||
fillColor:
|
||||
FlutterFlowTheme.of(context).secondaryBackground,
|
||||
controller: _controller,
|
||||
controller: widget.controller ??=
|
||||
FormFieldController<String>(
|
||||
widget.dropDownValue ??= ''),
|
||||
options: widget.options,
|
||||
optionLabels: widget.optionsLabel,
|
||||
onChanged: (val) {
|
||||
setState(() => _controller.value = val);
|
||||
},
|
||||
onChanged: widget.changed,
|
||||
isMultiSelect: false,
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
textStyle: FlutterFlowTheme.of(context)
|
||||
|
@ -85,7 +93,6 @@ class _CustomSelectState extends State<CustomSelect> {
|
|||
hidesUnderline: true,
|
||||
isOverButton: true,
|
||||
isSearchable: false,
|
||||
isMultiSelect: false,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
||||
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
|
||||
import 'package:hub/flutter_flow/internationalization.dart';
|
||||
|
||||
class SubmitButtonUtil extends StatelessWidget {
|
||||
final String labelText;
|
||||
final VoidCallback onPressed;
|
||||
|
||||
const SubmitButtonUtil({
|
||||
required this.labelText,
|
||||
required this.onPressed,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return FFButtonWidget(
|
||||
onPressed: onPressed,
|
||||
text: labelText,
|
||||
options: FFButtonOptions(
|
||||
width: 250.0,
|
||||
height: 36.0,
|
||||
disabledColor: FlutterFlowTheme.of(context).customColor5,
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(80.0, 0.0, 80.0, 0.0),
|
||||
iconPadding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
|
||||
color: FlutterFlowTheme.of(context).primary,
|
||||
textStyle: FlutterFlowTheme.of(context).titleSmall.override(
|
||||
fontFamily: FlutterFlowTheme.of(context).titleSmallFamily,
|
||||
color: FlutterFlowTheme.of(context).info,
|
||||
letterSpacing: 0.0,
|
||||
useGoogleFonts: GoogleFonts.asMap()
|
||||
.containsKey(FlutterFlowTheme.of(context).titleSmallFamily),
|
||||
),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.transparent,
|
||||
width: 30.0,
|
||||
),
|
||||
borderRadius: const BorderRadius.only(
|
||||
bottomLeft: Radius.circular(15.0),
|
||||
bottomRight: Radius.circular(15.0),
|
||||
topLeft: Radius.circular(15.0),
|
||||
topRight: Radius.circular(15.0),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ 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';
|
||||
import 'package:hub/shared/utils/log_util.dart';
|
||||
|
||||
class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||
late final TabController tabBarController;
|
||||
|
@ -26,14 +27,12 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -49,9 +48,19 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
|||
TextEditingController? textControllerColor;
|
||||
String? Function(BuildContext, String?)? textControllerColorValidator;
|
||||
|
||||
DateTime? selectedDate;
|
||||
FocusNode? textFieldFocusData;
|
||||
TextEditingController? textControllerData;
|
||||
String? Function(BuildContext, String?)? textControllerDataValidator;
|
||||
String? _textControllerDataValidator(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;
|
||||
}
|
||||
|
||||
FocusNode? textFieldFocusObservation;
|
||||
TextEditingController? textControllerObservation;
|
||||
|
@ -69,12 +78,30 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
|||
textControllerName = TextEditingController();
|
||||
textControllerNameValidator =
|
||||
(context, value) => _textControllerNameValidator(context, value);
|
||||
|
||||
textFieldFocusData = FocusNode();
|
||||
textControllerData = TextEditingController(
|
||||
text: dateTimeFormat(
|
||||
'dd/MM/yyyy',
|
||||
DateTime.now(),
|
||||
));
|
||||
textControllerDataValidator = _textControllerDataValidator;
|
||||
|
||||
dropDownValueController1 =
|
||||
FormFieldController<String>(dropDownValue1 ??= 'Selecione uma opção');
|
||||
|
||||
dropDownValueController2 =
|
||||
FormFieldController<String>(dropDownValue2 ??= 'Selecione uma opção');
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
tabBarController.dispose();
|
||||
|
||||
textFieldFocusName?.dispose();
|
||||
textControllerName?.dispose();
|
||||
|
||||
textFieldFocusData?.dispose();
|
||||
textControllerData?.dispose();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,16 +11,19 @@ import 'package:hub/components/atomic_components/shared_components_atoms/custom_
|
|||
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/flutter_flow_widgets.dart';
|
||||
import 'package:hub/flutter_flow/form_field_controller.dart';
|
||||
import 'package:hub/flutter_flow/internationalization.dart';
|
||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||
import 'package:hub/flutter_flow/upload_data.dart';
|
||||
|
||||
import 'package:hub/pages/pets_page/pets_page_model.dart';
|
||||
import 'package:sqflite/sqflite.dart';
|
||||
|
||||
class PetsPageWidget extends StatefulWidget {
|
||||
PetsPageWidget({super.key});
|
||||
|
@ -43,10 +46,44 @@ class _PetsPageWidgetState extends State<PetsPageWidget>
|
|||
_model.textFieldFocusName ??= FocusNode();
|
||||
|
||||
_model.textControllerSpecies ??= TextEditingController();
|
||||
_model.textFieldFocusSpecies ??= FocusNode();
|
||||
|
||||
_model.textControllerRace ??= TextEditingController();
|
||||
_model.textFieldFocusRace ??= FocusNode();
|
||||
|
||||
_model.textControllerColor ??= TextEditingController();
|
||||
_model.textFieldFocusColor ??= FocusNode();
|
||||
|
||||
_model.textControllerData ??= TextEditingController();
|
||||
_model.textFieldFocusData ??= FocusNode();
|
||||
|
||||
_model.textControllerObservation ??= TextEditingController();
|
||||
_model.textFieldFocusObservation ??= FocusNode();
|
||||
|
||||
_model.dropDownValueController1 ??=
|
||||
FormFieldController<String>(_model.dropDownValue1 ??= '');
|
||||
|
||||
_model.dropDownValueController2 ??=
|
||||
FormFieldController<String>(_model.dropDownValue2 ??= '');
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_model.textControllerName?.dispose();
|
||||
_model.textFieldFocusName?.dispose();
|
||||
|
||||
_model.textControllerSpecies?.dispose();
|
||||
_model.textFieldFocusSpecies?.dispose();
|
||||
|
||||
_model.textControllerRace?.dispose();
|
||||
_model.textFieldFocusRace?.dispose();
|
||||
|
||||
_model.textControllerColor?.dispose();
|
||||
_model.textFieldFocusColor?.dispose();
|
||||
|
||||
_model.textControllerData?.dispose();
|
||||
_model.textFieldFocusData?.dispose();
|
||||
|
||||
_model.tabBarController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
@ -140,6 +177,9 @@ Widget formAddPets(BuildContext context, PetsPageModel _model,
|
|||
controller: _model.textControllerName,
|
||||
validator:
|
||||
_model.textControllerNameValidator.asValidator(context),
|
||||
focusNode: _model.textFieldFocusName,
|
||||
autoFocus: false,
|
||||
keyboardType: TextInputType.text,
|
||||
labelText: FFLocalizations.of(context)
|
||||
.getVariableText(ptText: 'Nome', enText: 'Name'),
|
||||
hintText: FFLocalizations.of(context)
|
||||
|
@ -152,6 +192,7 @@ Widget formAddPets(BuildContext context, PetsPageModel _model,
|
|||
padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
|
||||
child: CustomInputUtil(
|
||||
controller: _model.textControllerSpecies,
|
||||
focusNode: _model.textFieldFocusSpecies,
|
||||
labelText: FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Espécie', enText: 'Species'),
|
||||
hintText: FFLocalizations.of(context).getVariableText(
|
||||
|
@ -164,6 +205,7 @@ Widget formAddPets(BuildContext context, PetsPageModel _model,
|
|||
padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
|
||||
child: CustomInputUtil(
|
||||
controller: _model.textControllerRace,
|
||||
focusNode: _model.textFieldFocusRace,
|
||||
labelText: FFLocalizations.of(context)
|
||||
.getVariableText(ptText: 'Raça', enText: 'Race'),
|
||||
hintText: FFLocalizations.of(context)
|
||||
|
@ -176,6 +218,7 @@ Widget formAddPets(BuildContext context, PetsPageModel _model,
|
|||
padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
|
||||
child: CustomInputUtil(
|
||||
controller: _model.textControllerColor,
|
||||
focusNode: _model.textFieldFocusColor,
|
||||
labelText: FFLocalizations.of(context)
|
||||
.getVariableText(ptText: 'Cor', enText: 'Color'),
|
||||
hintText: FFLocalizations.of(context)
|
||||
|
@ -186,22 +229,215 @@ Widget formAddPets(BuildContext context, PetsPageModel _model,
|
|||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
|
||||
child: CustomDatePickerUtil(
|
||||
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,
|
||||
hintText: FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Data de Nascimento', enText: 'Birth Date'),
|
||||
dateFormat: 'dd/MM/yyyy HH:mm:ss',
|
||||
locale: FFLocalizations.of(context).languageCode,
|
||||
firstDate: DateTime(2000),
|
||||
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: 'Birth Date',
|
||||
),
|
||||
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: getCurrentTimestamp,
|
||||
firstDate: DateTime(1990),
|
||||
lastDate: DateTime.now(),
|
||||
timePicker: false,
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Por favor, selecione uma data';
|
||||
}
|
||||
return null;
|
||||
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(() {
|
||||
log('Chamou o setState da datinha');
|
||||
|
||||
_model.selectedDate = DateTime(
|
||||
pickedDate.year,
|
||||
pickedDate.month,
|
||||
pickedDate.day,
|
||||
);
|
||||
|
||||
log(_model.selectedDate.toString());
|
||||
_model.textControllerData =
|
||||
TextEditingController(
|
||||
text: dateTimeFormat(
|
||||
'dd/MM/yyyy',
|
||||
_model.selectedDate,
|
||||
locale: FFLocalizations.of(context)
|
||||
.languageCode,
|
||||
));
|
||||
log(_model.textControllerData.text);
|
||||
_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(
|
||||
|
@ -231,7 +467,13 @@ Widget formAddPets(BuildContext context, PetsPageModel _model,
|
|||
padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
|
||||
child: CustomSelect(
|
||||
options: const ['MAC', 'FEM'],
|
||||
controller: _model.dropDownValueController1,
|
||||
controller: _model.dropDownValueController1 ??=
|
||||
FormFieldController<String>(
|
||||
_model.dropDownValue1 ??= ''),
|
||||
changed: (val) => safeSetState(() {
|
||||
_model.dropDownValue1 = val;
|
||||
}),
|
||||
dropDownValue: _model.dropDownValue1,
|
||||
optionsLabel: [
|
||||
FFLocalizations.of(context)
|
||||
.getVariableText(ptText: 'Macho', enText: 'Male'),
|
||||
|
@ -246,7 +488,12 @@ Widget formAddPets(BuildContext context, PetsPageModel _model,
|
|||
padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
|
||||
child: CustomSelect(
|
||||
options: const ['MIN', 'PEQ', 'MED', 'GRA', 'GIG'],
|
||||
controller: _model.dropDownValueController1,
|
||||
controller: _model.dropDownValueController2 ??=
|
||||
FormFieldController<String>(
|
||||
_model.dropDownValue2 ??= ''),
|
||||
changed: (val) => safeSetState(() {
|
||||
_model.dropDownValue2 = val;
|
||||
}),
|
||||
optionsLabel: [
|
||||
FFLocalizations.of(context)
|
||||
.getVariableText(ptText: 'Mini', enText: 'Mini'),
|
||||
|
@ -289,6 +536,7 @@ Widget formAddPets(BuildContext context, PetsPageModel _model,
|
|||
),
|
||||
CustomInputUtil(
|
||||
controller: _model.textControllerObservation,
|
||||
focusNode: _model.textFieldFocusObservation,
|
||||
labelText: FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Escreva as suas observações aqui...',
|
||||
enText: 'Write your observations here...'),
|
||||
|
@ -299,9 +547,13 @@ Widget formAddPets(BuildContext context, PetsPageModel _model,
|
|||
haveMaxLength: true,
|
||||
maxLength: 80,
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: _isFormValid(context) ? () {} : () {},
|
||||
child: Text('Cadastrar')),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(70, 20, 70, 30),
|
||||
child: SubmitButtonUtil(
|
||||
labelText: FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Cadastrar', enText: 'Register'),
|
||||
onPressed: () {}),
|
||||
),
|
||||
])),
|
||||
],
|
||||
),
|
||||
|
|
Loading…
Reference in New Issue