diff --git a/.env b/.env index e19a9d0..feb7bfb 100644 --- a/.env +++ b/.env @@ -1,3 +1,11 @@ +USER_BOX=USER +FIRST_NAME_FIELD=FIRST_NAME +SECOND_NAME_FIELD=SECOND_NAME +WEIGHT_FIELD=WEIGHT +HEIGHT_FIELD=HEIGHT +CALORIES_FIELD=CALORIES +FIRST_NAME_FIELD=FIRST_NAME +FIRST_NAME_FIELD=FIRST_NAME TODAY_BOX=TODAY DATE_FIELD=DATE # datum BREAKFAST_FIELD=FRÜHSTÜCK # frühstück diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index 717bf0c..8bd857c 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_foundation-2.2.2/","native_build":true,"dependencies":[]}],"android":[{"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":[]},"dependencyGraph":[{"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-05-12 18:02:09.137836","version":"3.7.9"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_foundation-2.2.2/","native_build":true,"dependencies":[]}],"android":[{"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":[]},"dependencyGraph":[{"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-05-12 23:04:16.870373","version":"3.7.9"} \ No newline at end of file diff --git a/lib/android/components/card_item_component.dart b/lib/android/components/card_item_component.dart deleted file mode 100644 index 573ff28..0000000 --- a/lib/android/components/card_item_component.dart +++ /dev/null @@ -1,13 +0,0 @@ -import 'package:flutter/material.dart'; - - -class CardItemComponent extends StatelessWidget { - final String title; - final int calories; - const CardItemComponent(Image? image, this.title, this.calories, {super.key}); - - @override - Widget build(BuildContext context) { - return Column(); - } -} diff --git a/lib/android/components/welcome_text_field.dart b/lib/android/components/welcome_text_field.dart index 310ae2b..bda06c1 100644 --- a/lib/android/components/welcome_text_field.dart +++ b/lib/android/components/welcome_text_field.dart @@ -46,143 +46,148 @@ class _WelcomePageStateTextFieldState @override Widget build(BuildContext context) { - return Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const SizedBox( - height: 24, + return Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const SizedBox( + height: 24, + ), + TextFormField( + onChanged: (newText) { + if (newText.isNotEmpty) { + setNameVisible(true); + } else { + setNameVisible(false); + } + }, + controller: firstnameTextEditingController, + decoration: InputDecoration( + hintText: 'Name', + border: const OutlineInputBorder(gapPadding: 8), + suffixIcon: isNameVisible + ? IconButton( + onPressed: () { + firstnameTextEditingController.clear(); + setState(() => isNameVisible = false); + }, + icon: const Icon(Icons.clear)) + : null, ), - TextFormField( + keyboardType: TextInputType.text, + ), + const SizedBox( + height: 24, + ), + TextFormField( onChanged: (newText) { if (newText.isNotEmpty) { - setNameVisible(true); + setSNameVisible(true); } else { - setNameVisible(false); + setSNameVisible(false); } }, - controller: firstnameTextEditingController, + controller: secondnameTextEditingController, decoration: InputDecoration( - hintText: 'Name', + hintText: 'Vorname', border: const OutlineInputBorder(gapPadding: 8), - suffixIcon: isNameVisible + suffixIcon: isSNameVisible ? IconButton( - onPressed: () { - firstnameTextEditingController.clear(); - setState(() => isNameVisible = false); - }, - icon: const Icon(Icons.clear)) + onPressed: () { + secondnameTextEditingController.clear(); + setState(() => isSNameVisible = false); + }, + icon: const Icon(Icons.clear)) : null, ), - keyboardType: TextInputType.text, - ), - const SizedBox( - height: 24, - ), - TextFormField( - onChanged: (newText) { - if (newText.isNotEmpty) { - setSNameVisible(true); - } else { - setSNameVisible(false); - } - }, - controller: secondnameTextEditingController, - decoration: InputDecoration( - hintText: 'Vorname', - border: const OutlineInputBorder(gapPadding: 8), - suffixIcon: isSNameVisible - ? IconButton( - onPressed: () { - secondnameTextEditingController.clear(); - setState(() => isSNameVisible = false); - }, - icon: const Icon(Icons.clear)) - : null, - ), - keyboardType: TextInputType.text), - const SizedBox( - height: 24, - ), - TextFormField( - onChanged: (newText) { - if (newText.isNotEmpty) { - setWeightVisible(true); - } else { - setWeightVisible(false); - } - }, - controller: weightTextEditingController, - decoration: InputDecoration( - hintText: 'Gewicht', - border: const OutlineInputBorder(gapPadding: 8), - suffixIcon: isWeightVisible - ? IconButton( - onPressed: () { - weightTextEditingController.clear(); - setState(() => isWeightVisible = false); - }, - icon: const Icon(Icons.clear)) - : null, - ), - keyboardType: TextInputType.number), - const SizedBox( - height: 24, - ), - TextFormField( - onChanged: (newText) { - if (newText.isNotEmpty) { - setHeightVisible(true); - } else { - setHeightVisible(false); - } - }, - controller: heightTextEditingController, - decoration: InputDecoration( - hintText: 'Größe', - border: const OutlineInputBorder(gapPadding: 8), - suffixIcon: isHeightVisible - ? IconButton( - onPressed: () { - heightTextEditingController.clear(); - setState(() => isHeightVisible = false); - }, - icon: const Icon(Icons.clear)) - : null, - ), - keyboardType: TextInputType.number), - const SizedBox( - height: 24, - ), - TextFormField( - onChanged: (newText) { - if (newText.isNotEmpty) { - setCaloriesVisible(true); - } else { - setCaloriesVisible(false); - } - }, - controller: caloriesTextEditingController, - decoration: InputDecoration( - hintText: 'gewünschte Kalorienzufuhr', - border: const OutlineInputBorder(gapPadding: 8), - suffixIcon: isCaloriesVisible - ? IconButton( - onPressed: () { - caloriesTextEditingController.clear(); - setState(() => isCaloriesVisible = false); - }, - icon: const Icon(Icons.clear)) - : null, - ), - keyboardType: TextInputType.number), - const SizedBox( - height: 24, - ), - ElevatedButton(onPressed: (){ - Navigator.pushAndRemoveUntil(context, - MaterialPageRoute(builder: (context) => const NavigationScreen()), (r) => false); - }, child: const Text('Bestätigen')) - ], - ); + keyboardType: TextInputType.text), + const SizedBox( + height: 24, + ), + TextFormField( + onChanged: (newText) { + if (newText.isNotEmpty) { + setWeightVisible(true); + } else { + setWeightVisible(false); + } + }, + controller: weightTextEditingController, + decoration: InputDecoration( + hintText: 'Gewicht', + border: const OutlineInputBorder(gapPadding: 8), + suffixIcon: isWeightVisible + ? IconButton( + onPressed: () { + weightTextEditingController.clear(); + setState(() => isWeightVisible = false); + }, + icon: const Icon(Icons.clear)) + : null, + ), + keyboardType: TextInputType.number), + const SizedBox( + height: 24, + ), + TextFormField( + onChanged: (newText) { + if (newText.isNotEmpty) { + setHeightVisible(true); + } else { + setHeightVisible(false); + } + }, + controller: heightTextEditingController, + decoration: InputDecoration( + hintText: 'Größe', + border: const OutlineInputBorder(gapPadding: 8), + suffixIcon: isHeightVisible + ? IconButton( + onPressed: () { + heightTextEditingController.clear(); + setState(() => isHeightVisible = false); + }, + icon: const Icon(Icons.clear)) + : null, + ), + keyboardType: TextInputType.number), + const SizedBox( + height: 24, + ), + TextFormField( + onChanged: (newText) { + if (newText.isNotEmpty) { + setCaloriesVisible(true); + } else { + setCaloriesVisible(false); + } + }, + controller: caloriesTextEditingController, + decoration: InputDecoration( + hintText: 'gewünschte Kalorienzufuhr', + border: const OutlineInputBorder(gapPadding: 8), + suffixIcon: isCaloriesVisible + ? IconButton( + onPressed: () { + caloriesTextEditingController.clear(); + setState(() => isCaloriesVisible = false); + }, + icon: const Icon(Icons.clear)) + : null, + ), + keyboardType: TextInputType.number), + const SizedBox( + height: 24, + ), + ElevatedButton( + onPressed: () { + Navigator.pushAndRemoveUntil( + context, + MaterialPageRoute( + builder: (context) => const NavigationScreen()), + (r) => false); + }, + child: const Text('Bestätigen')) + ], + ); } } diff --git a/lib/android/pages/welcome.dart b/lib/android/pages/welcome.dart new file mode 100644 index 0000000..0c8472e --- /dev/null +++ b/lib/android/pages/welcome.dart @@ -0,0 +1,16 @@ +import 'package:flutter/cupertino.dart'; + +class OnboardingPage extends StatefulWidget { + const OnboardingPage({Key? key}) : super(key: key); + + @override + State createState() => _OnboardingPageState(); +} + +class _OnboardingPageState extends State { + + @override + Widget build(BuildContext context) { + return const Placeholder(); + } +} diff --git a/lib/functions/db_crud.dart b/lib/functions/db_crud.dart new file mode 100644 index 0000000..e69de29 diff --git a/lib/functions/welcome_crud.dart b/lib/functions/welcome_crud.dart new file mode 100644 index 0000000..99f147c --- /dev/null +++ b/lib/functions/welcome_crud.dart @@ -0,0 +1,11 @@ +import 'package:flutter_dotenv/flutter_dotenv.dart'; +import 'package:hive/hive.dart'; + +void storeUserData(String sname, String fname, int weight, int height, int calories) async { + final userBox = Hive.box(dotenv.env['USER_BOX']!); + userBox.put(dotenv.env['FIRST_NAME_FIELD']!, sname); + userBox.put(dotenv.env['SECOND_NAME_FIELD']!, fname); + userBox.put(dotenv.env['WEIGHT_FIELD']!, weight); + userBox.put(dotenv.env['HEIGHT_FIELD']!, height); + userBox.put(dotenv.env['CALORIES_FIELD']!, calories); +} \ No newline at end of file