more design changes

master
ibal 2022-11-09 08:55:45 +01:00
parent f325e27f8b
commit 41de20703a
1 changed files with 89 additions and 84 deletions

View File

@ -54,92 +54,97 @@ class MyCustomFormState extends StatelessWidget with InputValidationMixin {
appBar: AppBar( appBar: AppBar(
title: Text(title), title: Text(title),
), ),
body: Form( body: Padding(
key: formGlobalKey, padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Column( child: Form(
crossAxisAlignment: CrossAxisAlignment.start, key: formGlobalKey,
children: [ child: Column(
TextFormField( crossAxisAlignment: CrossAxisAlignment.start,
controller: _controllerStartHeight, children: [
decoration: const InputDecoration( TextFormField(
labelText: 'Start height', controller: _controllerStartHeight,
hintText: 'Enter the height at the start (in meters)'), decoration: const InputDecoration(
validator: (value) { labelText: 'Start height',
if (isInputValid(value.toString())) { hintText: 'Enter the height at the start (in meters)'),
return 'Please enter a floating point number'; validator: (value) {
} if (isInputValid(value.toString())) {
}, return 'Please enter a floating point number';
), }
TextFormField( },
controller: _controllerEndHeight, ),
decoration: const InputDecoration( TextFormField(
labelText: 'End height', controller: _controllerEndHeight,
hintText: 'Enter the height at the end (in meters)'), decoration: const InputDecoration(
validator: (value) { labelText: 'End height',
if (isInputValid(value.toString())) { hintText: 'Enter the height at the end (in meters)'),
return 'Please enter a floating point number'; validator: (value) {
} if (isInputValid(value.toString())) {
}, return 'Please enter a floating point number';
), }
TextFormField( },
controller: _controllerStartSpeed, ),
decoration: const InputDecoration( TextFormField(
labelText: 'Start speed', controller: _controllerStartSpeed,
hintText: 'Enter the speed at the end (in m/s)'), decoration: const InputDecoration(
validator: (value) { labelText: 'Start speed',
if (isInputValid(value.toString())) { hintText: 'Enter the speed at the end (in m/s)'),
return 'Please enter a floating point number'; validator: (value) {
} if (isInputValid(value.toString())) {
}, return 'Please enter a floating point number';
), }
TextFormField( },
controller: _controllerEndSpeed, ),
decoration: const InputDecoration( TextFormField(
labelText: 'End speed', controller: _controllerEndSpeed,
hintText: 'Enter the speed at the end (in m/s)'), decoration: const InputDecoration(
validator: (value) { labelText: 'End speed',
if (isInputValid(value.toString())) { hintText: 'Enter the speed at the end (in m/s)'),
return 'Please enter a floating point number'; validator: (value) {
} if (isInputValid(value.toString())) {
}, return 'Please enter a floating point number';
), }
TextFormField( },
controller: _controllerWeight, ),
decoration: const InputDecoration( TextFormField(
labelText: 'Weight', controller: _controllerWeight,
hintText: 'Enter the weight of the object (in kg)'), decoration: const InputDecoration(
validator: (value) { labelText: 'Weight',
if (isInputValid(value.toString())) { hintText: 'Enter the weight of the object (in kg)'),
return 'Please enter a floating point number'; validator: (value) {
} if (isInputValid(value.toString())) {
}, return 'Please enter a floating point number';
), }
FittedBox( },
child: Text( ),
'$_joule Joule \n' Padding(
'$_energyWater Liter Wasser können damit erhitzt werden \n' padding: const EdgeInsets.symmetric(horizontal: 225.0),
'$_energyIron kg Eisen können damit zu glühen gebracht werden', child: FittedBox(
style: new TextStyle( child: Text(
fontSize: 20.0, '$_joule Joule \n'
color: Colors.black, '$_energyWater Liter Wasser können damit erhitzt werden \n'
'$_energyIron kg Eisen können damit zu glühen gebracht werden',
style: const TextStyle(
fontSize: 20.0,
),
textAlign: TextAlign.center,
))), ))),
Padding( Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0), padding: const EdgeInsets.symmetric(horizontal: 425.0),
child: ElevatedButton( child: ElevatedButton(
onPressed: () => { onPressed: () => {
if (formGlobalKey.currentState!.validate()) if (formGlobalKey.currentState!.validate())
{formGlobalKey.currentState!.save()}, {formGlobalKey.currentState!.save()},
_changeJoule(context), _changeJoule(context),
}, },
child: Text('Submit', child: const Text('Submit',
style: new TextStyle( style: TextStyle(
fontSize: 20.0, fontSize: 20.0,
)), )),
), ),
),
],
), ),
], )));
),
));
} }
} }