more design changes
parent
f325e27f8b
commit
41de20703a
173
lib/main.dart
173
lib/main.dart
|
@ -54,92 +54,97 @@ class MyCustomFormState extends StatelessWidget with InputValidationMixin {
|
|||
appBar: AppBar(
|
||||
title: Text(title),
|
||||
),
|
||||
body: Form(
|
||||
key: formGlobalKey,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextFormField(
|
||||
controller: _controllerStartHeight,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Start height',
|
||||
hintText: 'Enter the height at the start (in meters)'),
|
||||
validator: (value) {
|
||||
if (isInputValid(value.toString())) {
|
||||
return 'Please enter a floating point number';
|
||||
}
|
||||
},
|
||||
),
|
||||
TextFormField(
|
||||
controller: _controllerEndHeight,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'End height',
|
||||
hintText: 'Enter the height at the end (in meters)'),
|
||||
validator: (value) {
|
||||
if (isInputValid(value.toString())) {
|
||||
return 'Please enter a floating point number';
|
||||
}
|
||||
},
|
||||
),
|
||||
TextFormField(
|
||||
controller: _controllerStartSpeed,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Start speed',
|
||||
hintText: 'Enter the speed at the end (in m/s)'),
|
||||
validator: (value) {
|
||||
if (isInputValid(value.toString())) {
|
||||
return 'Please enter a floating point number';
|
||||
}
|
||||
},
|
||||
),
|
||||
TextFormField(
|
||||
controller: _controllerEndSpeed,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'End speed',
|
||||
hintText: 'Enter the speed at the end (in m/s)'),
|
||||
validator: (value) {
|
||||
if (isInputValid(value.toString())) {
|
||||
return 'Please enter a floating point number';
|
||||
}
|
||||
},
|
||||
),
|
||||
TextFormField(
|
||||
controller: _controllerWeight,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Weight',
|
||||
hintText: 'Enter the weight of the object (in kg)'),
|
||||
validator: (value) {
|
||||
if (isInputValid(value.toString())) {
|
||||
return 'Please enter a floating point number';
|
||||
}
|
||||
},
|
||||
),
|
||||
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,
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: Form(
|
||||
key: formGlobalKey,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextFormField(
|
||||
controller: _controllerStartHeight,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Start height',
|
||||
hintText: 'Enter the height at the start (in meters)'),
|
||||
validator: (value) {
|
||||
if (isInputValid(value.toString())) {
|
||||
return 'Please enter a floating point number';
|
||||
}
|
||||
},
|
||||
),
|
||||
TextFormField(
|
||||
controller: _controllerEndHeight,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'End height',
|
||||
hintText: 'Enter the height at the end (in meters)'),
|
||||
validator: (value) {
|
||||
if (isInputValid(value.toString())) {
|
||||
return 'Please enter a floating point number';
|
||||
}
|
||||
},
|
||||
),
|
||||
TextFormField(
|
||||
controller: _controllerStartSpeed,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Start speed',
|
||||
hintText: 'Enter the speed at the end (in m/s)'),
|
||||
validator: (value) {
|
||||
if (isInputValid(value.toString())) {
|
||||
return 'Please enter a floating point number';
|
||||
}
|
||||
},
|
||||
),
|
||||
TextFormField(
|
||||
controller: _controllerEndSpeed,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'End speed',
|
||||
hintText: 'Enter the speed at the end (in m/s)'),
|
||||
validator: (value) {
|
||||
if (isInputValid(value.toString())) {
|
||||
return 'Please enter a floating point number';
|
||||
}
|
||||
},
|
||||
),
|
||||
TextFormField(
|
||||
controller: _controllerWeight,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Weight',
|
||||
hintText: 'Enter the weight of the object (in kg)'),
|
||||
validator: (value) {
|
||||
if (isInputValid(value.toString())) {
|
||||
return 'Please enter a floating point number';
|
||||
}
|
||||
},
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 225.0),
|
||||
child: 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: const TextStyle(
|
||||
fontSize: 20.0,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
))),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||
child: ElevatedButton(
|
||||
onPressed: () => {
|
||||
if (formGlobalKey.currentState!.validate())
|
||||
{formGlobalKey.currentState!.save()},
|
||||
_changeJoule(context),
|
||||
},
|
||||
child: Text('Submit',
|
||||
style: new TextStyle(
|
||||
fontSize: 20.0,
|
||||
)),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 425.0),
|
||||
child: ElevatedButton(
|
||||
onPressed: () => {
|
||||
if (formGlobalKey.currentState!.validate())
|
||||
{formGlobalKey.currentState!.save()},
|
||||
_changeJoule(context),
|
||||
},
|
||||
child: const Text('Submit',
|
||||
style: TextStyle(
|
||||
fontSize: 20.0,
|
||||
)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
));
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue