Android App in Android Ordner bewegt, Gericht / Speisen suchen und auswählen, Kalorien zählen und summieren, Daten in der DB speichern
parent
cf568e4fdd
commit
2dd5e9a18d
8
.env
8
.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
|
TODAY_BOX=TODAY
|
||||||
DATE_FIELD=DATE # datum
|
DATE_FIELD=DATE # datum
|
||||||
BREAKFAST_FIELD=FRÜHSTÜCK # frühstück
|
BREAKFAST_FIELD=FRÜHSTÜCK # frühstück
|
||||||
|
|
|
@ -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"}
|
{"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"}
|
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -46,143 +46,148 @@ class _WelcomePageStateTextFieldState
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 24,
|
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) {
|
onChanged: (newText) {
|
||||||
if (newText.isNotEmpty) {
|
if (newText.isNotEmpty) {
|
||||||
setNameVisible(true);
|
setSNameVisible(true);
|
||||||
} else {
|
} else {
|
||||||
setNameVisible(false);
|
setSNameVisible(false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
controller: firstnameTextEditingController,
|
controller: secondnameTextEditingController,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: 'Name',
|
hintText: 'Vorname',
|
||||||
border: const OutlineInputBorder(gapPadding: 8),
|
border: const OutlineInputBorder(gapPadding: 8),
|
||||||
suffixIcon: isNameVisible
|
suffixIcon: isSNameVisible
|
||||||
? IconButton(
|
? IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
firstnameTextEditingController.clear();
|
secondnameTextEditingController.clear();
|
||||||
setState(() => isNameVisible = false);
|
setState(() => isSNameVisible = false);
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.clear))
|
icon: const Icon(Icons.clear))
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
keyboardType: TextInputType.text,
|
keyboardType: TextInputType.text),
|
||||||
),
|
const SizedBox(
|
||||||
const SizedBox(
|
height: 24,
|
||||||
height: 24,
|
),
|
||||||
),
|
TextFormField(
|
||||||
TextFormField(
|
onChanged: (newText) {
|
||||||
onChanged: (newText) {
|
if (newText.isNotEmpty) {
|
||||||
if (newText.isNotEmpty) {
|
setWeightVisible(true);
|
||||||
setSNameVisible(true);
|
} else {
|
||||||
} else {
|
setWeightVisible(false);
|
||||||
setSNameVisible(false);
|
}
|
||||||
}
|
},
|
||||||
},
|
controller: weightTextEditingController,
|
||||||
controller: secondnameTextEditingController,
|
decoration: InputDecoration(
|
||||||
decoration: InputDecoration(
|
hintText: 'Gewicht',
|
||||||
hintText: 'Vorname',
|
border: const OutlineInputBorder(gapPadding: 8),
|
||||||
border: const OutlineInputBorder(gapPadding: 8),
|
suffixIcon: isWeightVisible
|
||||||
suffixIcon: isSNameVisible
|
? IconButton(
|
||||||
? IconButton(
|
onPressed: () {
|
||||||
onPressed: () {
|
weightTextEditingController.clear();
|
||||||
secondnameTextEditingController.clear();
|
setState(() => isWeightVisible = false);
|
||||||
setState(() => isSNameVisible = false);
|
},
|
||||||
},
|
icon: const Icon(Icons.clear))
|
||||||
icon: const Icon(Icons.clear))
|
: null,
|
||||||
: null,
|
),
|
||||||
),
|
keyboardType: TextInputType.number),
|
||||||
keyboardType: TextInputType.text),
|
const SizedBox(
|
||||||
const SizedBox(
|
height: 24,
|
||||||
height: 24,
|
),
|
||||||
),
|
TextFormField(
|
||||||
TextFormField(
|
onChanged: (newText) {
|
||||||
onChanged: (newText) {
|
if (newText.isNotEmpty) {
|
||||||
if (newText.isNotEmpty) {
|
setHeightVisible(true);
|
||||||
setWeightVisible(true);
|
} else {
|
||||||
} else {
|
setHeightVisible(false);
|
||||||
setWeightVisible(false);
|
}
|
||||||
}
|
},
|
||||||
},
|
controller: heightTextEditingController,
|
||||||
controller: weightTextEditingController,
|
decoration: InputDecoration(
|
||||||
decoration: InputDecoration(
|
hintText: 'Größe',
|
||||||
hintText: 'Gewicht',
|
border: const OutlineInputBorder(gapPadding: 8),
|
||||||
border: const OutlineInputBorder(gapPadding: 8),
|
suffixIcon: isHeightVisible
|
||||||
suffixIcon: isWeightVisible
|
? IconButton(
|
||||||
? IconButton(
|
onPressed: () {
|
||||||
onPressed: () {
|
heightTextEditingController.clear();
|
||||||
weightTextEditingController.clear();
|
setState(() => isHeightVisible = false);
|
||||||
setState(() => isWeightVisible = false);
|
},
|
||||||
},
|
icon: const Icon(Icons.clear))
|
||||||
icon: const Icon(Icons.clear))
|
: null,
|
||||||
: null,
|
),
|
||||||
),
|
keyboardType: TextInputType.number),
|
||||||
keyboardType: TextInputType.number),
|
const SizedBox(
|
||||||
const SizedBox(
|
height: 24,
|
||||||
height: 24,
|
),
|
||||||
),
|
TextFormField(
|
||||||
TextFormField(
|
onChanged: (newText) {
|
||||||
onChanged: (newText) {
|
if (newText.isNotEmpty) {
|
||||||
if (newText.isNotEmpty) {
|
setCaloriesVisible(true);
|
||||||
setHeightVisible(true);
|
} else {
|
||||||
} else {
|
setCaloriesVisible(false);
|
||||||
setHeightVisible(false);
|
}
|
||||||
}
|
},
|
||||||
},
|
controller: caloriesTextEditingController,
|
||||||
controller: heightTextEditingController,
|
decoration: InputDecoration(
|
||||||
decoration: InputDecoration(
|
hintText: 'gewünschte Kalorienzufuhr',
|
||||||
hintText: 'Größe',
|
border: const OutlineInputBorder(gapPadding: 8),
|
||||||
border: const OutlineInputBorder(gapPadding: 8),
|
suffixIcon: isCaloriesVisible
|
||||||
suffixIcon: isHeightVisible
|
? IconButton(
|
||||||
? IconButton(
|
onPressed: () {
|
||||||
onPressed: () {
|
caloriesTextEditingController.clear();
|
||||||
heightTextEditingController.clear();
|
setState(() => isCaloriesVisible = false);
|
||||||
setState(() => isHeightVisible = false);
|
},
|
||||||
},
|
icon: const Icon(Icons.clear))
|
||||||
icon: const Icon(Icons.clear))
|
: null,
|
||||||
: null,
|
),
|
||||||
),
|
keyboardType: TextInputType.number),
|
||||||
keyboardType: TextInputType.number),
|
const SizedBox(
|
||||||
const SizedBox(
|
height: 24,
|
||||||
height: 24,
|
),
|
||||||
),
|
ElevatedButton(
|
||||||
TextFormField(
|
onPressed: () {
|
||||||
onChanged: (newText) {
|
Navigator.pushAndRemoveUntil(
|
||||||
if (newText.isNotEmpty) {
|
context,
|
||||||
setCaloriesVisible(true);
|
MaterialPageRoute(
|
||||||
} else {
|
builder: (context) => const NavigationScreen()),
|
||||||
setCaloriesVisible(false);
|
(r) => false);
|
||||||
}
|
},
|
||||||
},
|
child: const Text('Bestätigen'))
|
||||||
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'))
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
|
||||||
|
class OnboardingPage extends StatefulWidget {
|
||||||
|
const OnboardingPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<OnboardingPage> createState() => _OnboardingPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _OnboardingPageState extends State<OnboardingPage> {
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return const Placeholder();
|
||||||
|
}
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
Loading…
Reference in New Issue