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
|
||||
DATE_FIELD=DATE # datum
|
||||
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
|
||||
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'))
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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