design change
parent
b49af31d2c
commit
f325e27f8b
|
@ -35,13 +35,6 @@ class MyCustomFormState extends StatelessWidget with InputValidationMixin {
|
|||
final _controllerEndSpeed = TextEditingController();
|
||||
final _controllerWeight = TextEditingController();
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_controllerStartSpeed.dispose();
|
||||
_controllerEndSpeed.dispose();
|
||||
_controllerWeight.dispose();
|
||||
}
|
||||
|
||||
void _changeJoule(BuildContext context) {
|
||||
Provider.of<ResultModel>(context, listen: false).changeJoule(
|
||||
double.parse(_controllerWeight.text),
|
||||
|
@ -121,19 +114,27 @@ class MyCustomFormState extends StatelessWidget with InputValidationMixin {
|
|||
}
|
||||
},
|
||||
),
|
||||
Text('$_joule Joule \n'
|
||||
'$_energyWater Liter Wasser können damit erhitzt werden \n'
|
||||
'$_energyIron kg Eisen können damit zu glühen gebracht werden'),
|
||||
FittedBox(
|
||||
child: Text(
|
||||
'$_joule Joule \n'
|
||||
'$_energyWater Liter Wasser können damit erhitzt werden \n'
|
||||
'$_energyIron kg Eisen können damit zu glühen gebracht werden',
|
||||
style: new TextStyle(
|
||||
fontSize: 20.0,
|
||||
color: Colors.black,
|
||||
))),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||
child: ElevatedButton(
|
||||
onPressed: () => {
|
||||
if (formGlobalKey.currentState!.validate()) {
|
||||
formGlobalKey.currentState!.save()
|
||||
},
|
||||
if (formGlobalKey.currentState!.validate())
|
||||
{formGlobalKey.currentState!.save()},
|
||||
_changeJoule(context),
|
||||
},
|
||||
child: const Text('Submit'),
|
||||
child: Text('Submit',
|
||||
style: new TextStyle(
|
||||
fontSize: 20.0,
|
||||
)),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -143,5 +144,6 @@ class MyCustomFormState extends StatelessWidget with InputValidationMixin {
|
|||
}
|
||||
|
||||
mixin InputValidationMixin {
|
||||
bool isInputValid(String value) => !new RegExp(r'[0-9]+.?[0-9]*').hasMatch(value);
|
||||
bool isInputValid(String value) =>
|
||||
!new RegExp(r'[0-9]+.?[0-9]*').hasMatch(value);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue