From 41de20703aa46802a31dd6701f6a47ab3303638d Mon Sep 17 00:00:00 2001 From: ibal Date: Wed, 9 Nov 2022 08:55:45 +0100 Subject: [PATCH] more design changes --- lib/main.dart | 173 ++++++++++++++++++++++++++------------------------ 1 file changed, 89 insertions(+), 84 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 71dae01..87103a5 100644 --- a/lib/main.dart +++ b/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, + )), + ), + ), + ], ), - ], - ), - )); + ))); } }