main
Bogdan Kotikov 2023-06-06 23:45:02 +02:00
parent 30cf45bd35
commit 1b9d8b693f
2 changed files with 45 additions and 25 deletions

View File

@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"fluttertoast","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/fluttertoast-8.2.2/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_foundation-2.2.2/","native_build":true,"dependencies":[]}],"android":[{"name":"fluttertoast","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/fluttertoast-8.2.2/","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_android-2.0.27/","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_foundation-2.2.2/","native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_linux-2.1.10/","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_windows-2.1.6/","native_build":false,"dependencies":[]}],"web":[{"name":"fluttertoast","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/fluttertoast-8.2.2/","dependencies":[]}]},"dependencyGraph":[{"name":"fluttertoast","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2023-06-03 00:48:24.365407","version":"3.7.9"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"fluttertoast","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/fluttertoast-8.2.2/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_foundation-2.2.2/","native_build":true,"dependencies":[]}],"android":[{"name":"fluttertoast","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/fluttertoast-8.2.2/","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_android-2.0.27/","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_foundation-2.2.2/","native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_linux-2.1.10/","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_windows-2.1.6/","native_build":false,"dependencies":[]}],"web":[{"name":"fluttertoast","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/fluttertoast-8.2.2/","dependencies":[]}]},"dependencyGraph":[{"name":"fluttertoast","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2023-06-06 22:44:47.468267","version":"3.7.9"}

View File

@ -119,32 +119,52 @@ class _FormBuilderComponentState extends State<FormBuilderComponent> {
onPressed: () {
final Box box = Hive.box<User>("USER_BOX");
print(formKey
.currentState?.fields['gewicht']?.value ??
box.get("USER").gewicht);
if (widget.lockTextFields) {
box.put(
"USER",
User(
formKey.currentState?.fields['vorname']
?.value ??
box.get("USER").vorname.toString(),
formKey.currentState?.fields['nachname']
?.value ??
box.get("USER").nachname.toString(),
formKey.currentState?.fields['gewicht']
?.value ??
box.get("USER").gewicht,
formKey.currentState?.fields['groesse']
?.value ??
box.get("USER").groesse,
formKey.currentState?.fields['alter']?.value ??
box.get("USER").alter,
formKey.currentState?.fields['kalorien']
?.value ??
box.get("USER").kalorien));
box.put(
"USER",
User(
formKey.currentState?.fields['vorname']?.value.toString() ??
box.get("USER").vorname.toString(),
formKey.currentState?.fields['nachname']?.value.toString() ??
box.get("USER").nachname.toString(),
int.parse(formKey
.currentState?.fields['gewicht']?.value ??
box.get("USER").gewicht),
int.parse(formKey
.currentState?.fields['groesse']?.value ??
int.parse(box.get("USER").groesse)),
int.parse(formKey
.currentState?.fields['alter']?.value ??
int.parse(box.get("USER").alter)),
int.parse(formKey.currentState?.fields['kalorien']
?.value ??
int.parse(box.get("USER").kalorien))));
ScaffoldMessenger.of(context)
.showSnackBar(const SnackBar(
duration: Duration(seconds: 2),
content: Text('Eine Beispiel Snackbar'),
));
} else {
box.put(
"USER",
User(
formKey.currentState?.fields['vorname']?.value,
formKey.currentState?.fields['nachname']?.value,
formKey.currentState?.fields['gewicht']?.value,
formKey.currentState?.fields['groesse']?.value,
formKey.currentState?.fields['alter']?.value,
formKey
.currentState?.fields['kalorien']?.value));
}
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (BuildContext context) => const MainPage()));
Future.delayed(
const Duration(seconds: 2),
() => Navigator.of(context).pushReplacement(
MaterialPageRoute(
builder: (BuildContext context) =>
const MainPage())));
},
child: const Text("Eingaben bestätigen"),
)),