116 lines
5.1 KiB
Dart
116 lines
5.1 KiB
Dart
part of 'vehicles_on_the_property.dart';
|
|
|
|
/// [VehicleUpdateScreen] is a StatefulWidget that displays a form to update a vehicle.
|
|
|
|
// ignore: must_be_immutable
|
|
class VehicleUpdateScreen extends StatefulWidget {
|
|
VehicleUpdateScreen(this.model, {super.key});
|
|
late VehicleModel model;
|
|
|
|
@override
|
|
State<VehicleUpdateScreen> createState() => _VehicleUpdateScreenState();
|
|
}
|
|
|
|
class _VehicleUpdateScreenState extends State<VehicleUpdateScreen> {
|
|
@override
|
|
Widget build(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 de alteração com os dados do seu veículo',
|
|
enText: 'Fill out the update form with your vehicle 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: widget.model.updateFormKey,
|
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.max,
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
children: [
|
|
CustomInputUtil(
|
|
controller: widget.model.textFieldControllerLicensePlate,
|
|
validator: widget.model.textControllerLicensePlateValidator
|
|
.asValidator(context),
|
|
focusNode: widget.model.textFieldFocusLicensePlate,
|
|
labelText: FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Placa', enText: 'License Plate'),
|
|
hintText: FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Placa', enText: 'License Plate'),
|
|
suffixIcon: Symbols.format_color_text,
|
|
haveMaxLength: true,
|
|
onChanged: (value) => setState(() {}),
|
|
maxLength: 80,
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
|
|
child: CustomInputUtil(
|
|
controller: widget.model.textFieldControllerModel,
|
|
validator: widget.model.textControllerModelValidator
|
|
.asValidator(context),
|
|
focusNode: widget.model.textFieldFocusModel,
|
|
labelText: FFLocalizations.of(context)
|
|
.getVariableText(ptText: 'Modelo', enText: 'Model'),
|
|
hintText: FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Ex: Voyage, Ford',
|
|
enText: 'e.g. Voyage, Ford',
|
|
),
|
|
suffixIcon: Icons.car_repair,
|
|
haveMaxLength: true,
|
|
onChanged: (value) => setState(() {}),
|
|
maxLength: 80,
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
|
|
child: CustomInputUtil(
|
|
controller: widget.model.textFieldControllerColor,
|
|
validator: widget.model.textControllerColorValidator
|
|
.asValidator(context),
|
|
focusNode: widget.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: Icons.pets_outlined,
|
|
haveMaxLength: true,
|
|
onChanged: (value) => setState(() {}),
|
|
maxLength: 80,
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.fromLTRB(70, 20, 70, 30),
|
|
child: SubmitButtonUtil(
|
|
labelText: FFLocalizations.of(context)
|
|
.getVariableText(ptText: 'Salvar', enText: 'Save'),
|
|
onPressed: widget.model.isFormValid(context)
|
|
? widget.model.updateVehicle
|
|
: null),
|
|
),
|
|
],
|
|
)),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|