merge main
commit
2580b8f1f7
|
@ -211,18 +211,36 @@
|
|||
"packageUri": "lib/",
|
||||
"languageVersion": "2.12"
|
||||
},
|
||||
{
|
||||
"name": "flutter_form_builder",
|
||||
"rootUri": "file:///C:/Users/FUCHSLAU/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_form_builder-9.0.0",
|
||||
"packageUri": "lib/",
|
||||
"languageVersion": "3.0"
|
||||
},
|
||||
{
|
||||
"name": "flutter_lints",
|
||||
"rootUri": "file:///C:/Users/FUCHSLAU/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_lints-2.0.1",
|
||||
"packageUri": "lib/",
|
||||
"languageVersion": "2.17"
|
||||
},
|
||||
{
|
||||
"name": "flutter_localizations",
|
||||
"rootUri": "file:///C:/Users/FUCHSLAU/flutter/packages/flutter_localizations",
|
||||
"packageUri": "lib/",
|
||||
"languageVersion": "3.0"
|
||||
},
|
||||
{
|
||||
"name": "flutter_test",
|
||||
"rootUri": "file:///C:/Users/FUCHSLAU/flutter/packages/flutter_test",
|
||||
"packageUri": "lib/",
|
||||
"languageVersion": "3.0"
|
||||
},
|
||||
{
|
||||
"name": "form_builder_validators",
|
||||
"rootUri": "file:///C:/Users/FUCHSLAU/AppData/Local/Pub/Cache/hosted/pub.dev/form_builder_validators-9.0.0",
|
||||
"packageUri": "lib/",
|
||||
"languageVersion": "3.0"
|
||||
},
|
||||
{
|
||||
"name": "frontend_server_client",
|
||||
"rootUri": "file:///C:/Users/FUCHSLAU/AppData/Local/Pub/Cache/hosted/pub.dev/frontend_server_client-3.2.0",
|
||||
|
@ -277,6 +295,12 @@
|
|||
"packageUri": "lib/",
|
||||
"languageVersion": "2.12"
|
||||
},
|
||||
{
|
||||
"name": "intl",
|
||||
"rootUri": "file:///C:/Users/FUCHSLAU/AppData/Local/Pub/Cache/hosted/pub.dev/intl-0.18.0",
|
||||
"packageUri": "lib/",
|
||||
"languageVersion": "2.12"
|
||||
},
|
||||
{
|
||||
"name": "io",
|
||||
"rootUri": "file:///C:/Users/FUCHSLAU/AppData/Local/Pub/Cache/hosted/pub.dev/io-1.0.4",
|
||||
|
@ -584,7 +608,7 @@
|
|||
"languageVersion": "2.19"
|
||||
}
|
||||
],
|
||||
"generated": "2023-06-01T10:00:31.814419Z",
|
||||
"generated": "2023-06-01T10:16:20.370625Z",
|
||||
"generator": "pub",
|
||||
"generatorVersion": "3.0.2"
|
||||
}
|
||||
|
|
|
@ -134,10 +134,18 @@ flutter_dotenv
|
|||
2.12
|
||||
file:///C:/Users/FUCHSLAU/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_dotenv-5.0.2/
|
||||
file:///C:/Users/FUCHSLAU/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_dotenv-5.0.2/lib/
|
||||
flutter_form_builder
|
||||
3.0
|
||||
file:///C:/Users/FUCHSLAU/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_form_builder-9.0.0/
|
||||
file:///C:/Users/FUCHSLAU/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_form_builder-9.0.0/lib/
|
||||
flutter_lints
|
||||
2.17
|
||||
file:///C:/Users/FUCHSLAU/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_lints-2.0.1/
|
||||
file:///C:/Users/FUCHSLAU/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_lints-2.0.1/lib/
|
||||
form_builder_validators
|
||||
3.0
|
||||
file:///C:/Users/FUCHSLAU/AppData/Local/Pub/Cache/hosted/pub.dev/form_builder_validators-9.0.0/
|
||||
file:///C:/Users/FUCHSLAU/AppData/Local/Pub/Cache/hosted/pub.dev/form_builder_validators-9.0.0/lib/
|
||||
frontend_server_client
|
||||
2.12
|
||||
file:///C:/Users/FUCHSLAU/AppData/Local/Pub/Cache/hosted/pub.dev/frontend_server_client-3.2.0/
|
||||
|
@ -174,6 +182,10 @@ http_parser
|
|||
2.12
|
||||
file:///C:/Users/FUCHSLAU/AppData/Local/Pub/Cache/hosted/pub.dev/http_parser-4.0.2/
|
||||
file:///C:/Users/FUCHSLAU/AppData/Local/Pub/Cache/hosted/pub.dev/http_parser-4.0.2/lib/
|
||||
intl
|
||||
2.12
|
||||
file:///C:/Users/FUCHSLAU/AppData/Local/Pub/Cache/hosted/pub.dev/intl-0.18.0/
|
||||
file:///C:/Users/FUCHSLAU/AppData/Local/Pub/Cache/hosted/pub.dev/intl-0.18.0/lib/
|
||||
io
|
||||
2.12
|
||||
file:///C:/Users/FUCHSLAU/AppData/Local/Pub/Cache/hosted/pub.dev/io-1.0.4/
|
||||
|
@ -378,6 +390,10 @@ flutter
|
|||
3.0
|
||||
file:///C:/Users/FUCHSLAU/flutter/packages/flutter/
|
||||
file:///C:/Users/FUCHSLAU/flutter/packages/flutter/lib/
|
||||
flutter_localizations
|
||||
3.0
|
||||
file:///C:/Users/FUCHSLAU/flutter/packages/flutter_localizations/
|
||||
file:///C:/Users/FUCHSLAU/flutter/packages/flutter_localizations/lib/
|
||||
flutter_test
|
||||
3.0
|
||||
file:///C:/Users/FUCHSLAU/flutter/packages/flutter_test/
|
||||
|
|
1
.env
1
.env
|
@ -1,6 +1,7 @@
|
|||
USER_BOX=USER
|
||||
FIRST_NAME_FIELD=FIRST_NAME
|
||||
SECOND_NAME_FIELD=SECOND_NAME
|
||||
AGE_FIELD=AGE
|
||||
WEIGHT_FIELD=WEIGHT
|
||||
HEIGHT_FIELD=HEIGHT
|
||||
CALORIES_FIELD=CALORIES
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.2.2\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"path_provider_android","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_android-2.0.27\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.2.2\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.1.10\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\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-06-01 12:00:31.954526","version":"3.10.2"}
|
||||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.2.2\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"path_provider_android","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_android-2.0.27\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.2.2\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.1.10\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\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-06-01 12:16:20.517755","version":"3.10.2"}
|
|
@ -1,20 +1,25 @@
|
|||
import 'package:ernaehrung/android/pages/nav_pages/main_page.dart';
|
||||
import 'package:ernaehrung/android/views/navigation/navigation_screen.dart';
|
||||
import 'package:ernaehrung/android/pages/welcome.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
|
||||
import 'models/user.dart';
|
||||
|
||||
class AndroidApp extends StatelessWidget {
|
||||
const AndroidApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final box = Hive.box<User>('USER_BOX');
|
||||
print("got it ${box.get("USER")}");
|
||||
return MaterialApp(
|
||||
title: 'Flutter Demo',
|
||||
theme: ThemeData(
|
||||
scaffoldBackgroundColor: Colors.grey.shade100, //<-- SEE
|
||||
),
|
||||
home: const MainPage(),
|
||||
home: box.get("USER") == null ? const OnboardingPage() : const MainPage(),
|
||||
routes: {
|
||||
'/navigation': (context) => const NavigationScreen(),
|
||||
'/navigation': (context) => const MainPage(),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import 'package:ernaehrung/android/pages/nav_pages/main_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../views/navigation/navigation_screen.dart';
|
||||
|
||||
class WelcomePageStateTextFieldState extends StatefulWidget {
|
||||
const WelcomePageStateTextFieldState({super.key});
|
||||
|
||||
|
@ -183,7 +182,7 @@ class _WelcomePageStateTextFieldState
|
|||
Navigator.pushAndRemoveUntil(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const NavigationScreen()),
|
||||
builder: (context) => const MainPage()),
|
||||
(r) => false);
|
||||
},
|
||||
child: const Text('Bestätigen'))
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
import 'package:hive/hive.dart';
|
||||
part 'user.g.dart';
|
||||
|
||||
@HiveType(typeId: 1)
|
||||
class User {
|
||||
@HiveField(0)
|
||||
final String vorname;
|
||||
@HiveField(1)
|
||||
final String nachname;
|
||||
@HiveField(2)
|
||||
final int gewicht;
|
||||
@HiveField(3)
|
||||
final int groesse;
|
||||
@HiveField(4)
|
||||
final int alter;
|
||||
@HiveField(5)
|
||||
final int kalorien;
|
||||
|
||||
User(this.vorname, this.nachname, this.gewicht, this.groesse, this.alter,
|
||||
this.kalorien);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'User{vorname: $vorname, nachname: $nachname, gewicht: $gewicht, groesse: $groesse, alter: $alter, kalorien: $kalorien}';
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'user.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// TypeAdapterGenerator
|
||||
// **************************************************************************
|
||||
|
||||
class UserAdapter extends TypeAdapter<User> {
|
||||
@override
|
||||
final int typeId = 1;
|
||||
|
||||
@override
|
||||
User read(BinaryReader reader) {
|
||||
final numOfFields = reader.readByte();
|
||||
final fields = <int, dynamic>{
|
||||
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||
};
|
||||
return User(
|
||||
fields[0] as String,
|
||||
fields[1] as String,
|
||||
fields[2] as int,
|
||||
fields[3] as int,
|
||||
fields[4] as int,
|
||||
fields[5] as int,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, User obj) {
|
||||
writer
|
||||
..writeByte(6)
|
||||
..writeByte(0)
|
||||
..write(obj.vorname)
|
||||
..writeByte(1)
|
||||
..write(obj.nachname)
|
||||
..writeByte(2)
|
||||
..write(obj.gewicht)
|
||||
..writeByte(3)
|
||||
..write(obj.groesse)
|
||||
..writeByte(4)
|
||||
..write(obj.alter)
|
||||
..writeByte(5)
|
||||
..write(obj.kalorien);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => typeId.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is UserAdapter &&
|
||||
runtimeType == other.runtimeType &&
|
||||
typeId == other.typeId;
|
||||
}
|
|
@ -28,9 +28,9 @@ class _MealPlanState extends State<MealPlanPage> {
|
|||
margin: const EdgeInsets.all(8),
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
child: const SingleChildScrollView(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
children: const [
|
||||
DaysMealPageComponent(),
|
||||
StatisticsPercentage(),
|
||||
MealPageStatisticsFoodComponent(),
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:ernaehrung/android/pages/nav_pages/main_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
import 'package:form_builder_validators/form_builder_validators.dart';
|
||||
import 'package:hive_flutter/hive_flutter.dart';
|
||||
|
||||
import '../models/user.dart';
|
||||
|
||||
class OnboardingPage extends StatefulWidget {
|
||||
const OnboardingPage({Key? key}) : super(key: key);
|
||||
|
@ -8,9 +14,195 @@ class OnboardingPage extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _OnboardingPageState extends State<OnboardingPage> {
|
||||
InputDecoration decoration(String hintText) {
|
||||
return InputDecoration(
|
||||
border: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(10.0))),
|
||||
filled: true,
|
||||
hintStyle: TextStyle(color: Colors.grey.shade400),
|
||||
hintText: hintText,
|
||||
labelText: hintText,
|
||||
fillColor: Colors.white70);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Placeholder();
|
||||
final _formKey = GlobalKey<FormBuilderState>();
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text("Welcome"),
|
||||
backgroundColor: Colors.grey.shade100,
|
||||
),
|
||||
body: FormBuilder(
|
||||
key: _formKey,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
margin:
|
||||
const EdgeInsets.symmetric(vertical: 8, horizontal: 0),
|
||||
child: FormBuilderTextField(
|
||||
name: 'vorname',
|
||||
decoration: decoration("Vorname"),
|
||||
keyboardType: TextInputType.text,
|
||||
maxLength: 30,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
validator: FormBuilderValidators.compose([
|
||||
FormBuilderValidators.required(),
|
||||
FormBuilderValidators.minLength(2,
|
||||
errorText:
|
||||
"Die Name sollte mindestens 2 Zeichen lang sein"),
|
||||
FormBuilderValidators.maxLength(30,
|
||||
errorText:
|
||||
"Die Name sollte maximal 30 Zeichen lang sein")
|
||||
]),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin:
|
||||
const EdgeInsets.symmetric(vertical: 8, horizontal: 0),
|
||||
child: FormBuilderTextField(
|
||||
name: 'nachname',
|
||||
decoration: decoration("Nachname"),
|
||||
keyboardType: TextInputType.text,
|
||||
maxLength: 30,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
validator: FormBuilderValidators.compose([
|
||||
FormBuilderValidators.required(),
|
||||
FormBuilderValidators.minLength(2,
|
||||
errorText:
|
||||
"Die Nachname sollte mindestens 2 Zeichen lang sein"),
|
||||
FormBuilderValidators.maxLength(30,
|
||||
errorText:
|
||||
"Die Nachname sollte maximal 30 Zeichen lang sein")
|
||||
]),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin:
|
||||
const EdgeInsets.symmetric(vertical: 8, horizontal: 0),
|
||||
child: FormBuilderTextField(
|
||||
name: 'gewicht',
|
||||
decoration: decoration("Gewicht"),
|
||||
keyboardType: TextInputType.number,
|
||||
maxLength: 7,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
validator: FormBuilderValidators.compose([
|
||||
FormBuilderValidators.required(),
|
||||
FormBuilderValidators.numeric(
|
||||
errorText:
|
||||
"Der Gewicht sollte mindestens 10 kg sein"),
|
||||
FormBuilderValidators.max(200,
|
||||
errorText:
|
||||
"Der Gewicht sollte maximal 200 kg sein"),
|
||||
FormBuilderValidators.min(10,
|
||||
errorText:
|
||||
"Der Gewicht sollte mindestens 10 kg sein")
|
||||
]),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin:
|
||||
const EdgeInsets.symmetric(vertical: 8, horizontal: 0),
|
||||
child: FormBuilderTextField(
|
||||
name: 'groesse',
|
||||
decoration: decoration("Größe"),
|
||||
keyboardType: TextInputType.number,
|
||||
maxLength: 7,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
validator: FormBuilderValidators.compose([
|
||||
FormBuilderValidators.required(),
|
||||
FormBuilderValidators.numeric(
|
||||
errorText: "Die Größe sollte mindestens 60cm sein"),
|
||||
FormBuilderValidators.max(230,
|
||||
errorText: "Die Größe sollte maximal 230cm sein"),
|
||||
FormBuilderValidators.min(60,
|
||||
errorText: "Die Größe sollte mindestens 60cm sein")
|
||||
]),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin:
|
||||
const EdgeInsets.symmetric(vertical: 8, horizontal: 0),
|
||||
child: FormBuilderTextField(
|
||||
name: 'alter',
|
||||
decoration: decoration("Alter"),
|
||||
keyboardType: TextInputType.number,
|
||||
maxLength: 7,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
validator: FormBuilderValidators.compose([
|
||||
FormBuilderValidators.required(),
|
||||
FormBuilderValidators.numeric(
|
||||
errorText:
|
||||
"Das Alter sollte mindestens 6 Jahre alt sein"),
|
||||
FormBuilderValidators.max(99,
|
||||
errorText:
|
||||
"Das Alter sollte maximal 99 Jahre alt sein"),
|
||||
FormBuilderValidators.min(6,
|
||||
errorText:
|
||||
"Das Alter sollte mindestens 6 Jahre alt sein")
|
||||
]),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin:
|
||||
const EdgeInsets.symmetric(vertical: 8, horizontal: 0),
|
||||
child: FormBuilderTextField(
|
||||
name: 'kalorien',
|
||||
decoration:
|
||||
decoration("gewünschte Kalorienzufuhr: min. 1000"),
|
||||
keyboardType: TextInputType.number,
|
||||
maxLength: 7,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
validator: FormBuilderValidators.compose([
|
||||
FormBuilderValidators.required(),
|
||||
FormBuilderValidators.numeric(
|
||||
errorText:
|
||||
"Die Kalorienanzahl sollte mindestens 1000 Kcal sein"),
|
||||
FormBuilderValidators.max(30000),
|
||||
FormBuilderValidators.min(1000,
|
||||
errorText:
|
||||
"Die Kalorienanzahl sollte mindestens 1000 Kcal sein")
|
||||
]),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: const EdgeInsets.symmetric(
|
||||
vertical: 8, horizontal: 0),
|
||||
width: double.infinity,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
minimumSize: const Size.fromHeight(40), //
|
||||
backgroundColor: const Color(0xFF6E7BFB),
|
||||
foregroundColor: const Color(0xFFffffff),
|
||||
shape: const StadiumBorder(),
|
||||
),
|
||||
onPressed: () {
|
||||
final Box box = Hive.box<User>("USER_BOX");
|
||||
box.put("USER", User(
|
||||
_formKey.currentState?.fields['vorname']?.value,
|
||||
_formKey.currentState?.fields['nachname']?.value,
|
||||
int.parse(_formKey.currentState?.fields['gewicht']?.value),
|
||||
int.parse(_formKey.currentState?.fields['groesse']?.value),
|
||||
int.parse(_formKey.currentState?.fields['alter']?.value),
|
||||
int.parse(_formKey.currentState?.fields['kalorien']?.value)
|
||||
));
|
||||
|
||||
print(box.get("USER"));
|
||||
|
||||
Navigator
|
||||
.of(context)
|
||||
.pushReplacement(MaterialPageRoute(builder: (BuildContext context) => const MainPage()));
|
||||
},
|
||||
child: const Text("Eingaben bestätigen"),
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class NavigationScreen extends StatefulWidget {
|
||||
const NavigationScreen({super.key});
|
||||
|
||||
@override
|
||||
NavigationScreenState createState() => NavigationScreenState();
|
||||
}
|
||||
|
||||
class NavigationScreenState extends State<NavigationScreen> {
|
||||
int _selectedIndex = 0;
|
||||
final _pages = ["Page 1", "Page 2", "Page 3"];
|
||||
String _selectedPage = "Page 1";
|
||||
|
||||
final PageController _pageController = PageController(initialPage: 0);
|
||||
|
||||
void _onItemTapped(int index) {
|
||||
setState(() {
|
||||
_selectedIndex = index;
|
||||
_selectedPage = _pages[index];
|
||||
_pageController.animateToPage(index,
|
||||
duration: const Duration(milliseconds: 300), curve: Curves.easeInOut);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(_selectedPage),
|
||||
),
|
||||
body: PageView(
|
||||
controller: _pageController,
|
||||
onPageChanged: (int index) {
|
||||
setState(() {
|
||||
_selectedPage = _pages[index];
|
||||
_selectedIndex = index;
|
||||
});
|
||||
},
|
||||
),
|
||||
bottomNavigationBar: BottomNavigationBar(
|
||||
items: const <BottomNavigationBarItem>[
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.home),
|
||||
label: 'Page 1',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.work),
|
||||
label: 'Page 2',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.school),
|
||||
label: 'Page 3',
|
||||
),
|
||||
],
|
||||
currentIndex: _selectedIndex,
|
||||
onTap: _onItemTapped,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../components/welcome_text_field.dart';
|
||||
|
||||
class WelcomeScreen extends StatelessWidget {
|
||||
const WelcomeScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const MaterialApp(
|
||||
title: 'Welcome Screen',
|
||||
home: WelcomeScreenPage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class WelcomeScreenPage extends StatefulWidget {
|
||||
const WelcomeScreenPage({super.key});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => WelcomeScreenPageState();
|
||||
}
|
||||
|
||||
class WelcomeScreenPageState extends State<WelcomeScreenPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Welcome Screen'),
|
||||
),
|
||||
body: const SizedBox(
|
||||
height: double.infinity,
|
||||
width: double.infinity,
|
||||
child: SingleChildScrollView(
|
||||
child: Form(
|
||||
child: WelcomePageStateTextFieldState(),
|
||||
)
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:ernaehrung/android/models/food.dart';
|
||||
import 'package:ernaehrung/android/models/user.dart';
|
||||
import 'package:ernaehrung/web/web_app.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hive_flutter/hive_flutter.dart';
|
||||
|
@ -12,22 +13,26 @@ void main() async {
|
|||
await dotenv.load(fileName: ".env");
|
||||
await Hive.initFlutter();
|
||||
|
||||
if(!Hive.isAdapterRegistered(0)){
|
||||
if (!Hive.isAdapterRegistered(0)) {
|
||||
Hive.registerAdapter(FoodAdapter());
|
||||
}
|
||||
//await Hive.deleteFromDisk();
|
||||
|
||||
if (!Hive.isAdapterRegistered(1)) {
|
||||
Hive.registerAdapter(UserAdapter());
|
||||
}
|
||||
|
||||
|
||||
await Hive.openBox(dotenv.env['STATISTICS_TODAY_BOX'] ?? 'STATISTICS_TODAY_BOX');
|
||||
await Hive.openBox( dotenv.env['STATISTICS_PROGRESS_BOX'] ?? 'STATISTICS_PROGRESS_BOX');
|
||||
await Hive.openBox(dotenv.env['STATISTICS_MAIN_BOX'] ?? 'STATISTICS_MAIN_BOX');
|
||||
await Hive.openBox(dotenv.env['MEALPLAN_BOX'] ?? 'MEALPLAN');
|
||||
await Hive.openBox<User>('USER_BOX');
|
||||
|
||||
setupTodayBox();
|
||||
//Hive.deleteFromDisk();
|
||||
|
||||
if(defaultTargetPlatform == TargetPlatform.android){
|
||||
if (defaultTargetPlatform == TargetPlatform.android) {
|
||||
runApp(const AndroidApp());
|
||||
}else if(kIsWeb){
|
||||
} else if (kIsWeb) {
|
||||
runApp(const WebApp());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
33
pubspec.lock
33
pubspec.lock
|
@ -278,6 +278,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.0.2"
|
||||
flutter_form_builder:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_form_builder
|
||||
sha256: "9b098f6a5f8a6381016a5fe9cdccc900683917d1fb930e1c6c6c051ca0f01f08"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "9.0.0"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
|
@ -286,11 +294,24 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
flutter_localizations:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
form_builder_validators:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: form_builder_validators
|
||||
sha256: e04998b1597d76a51da7f009ed3b2f12d4173f13e146e8744fd2453e8595a2c9
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "9.0.0"
|
||||
frontend_server_client:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -363,6 +384,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.0.2"
|
||||
intl:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: intl
|
||||
sha256: a3715e3bc90294e971cb7dc063fbf3cd9ee0ebf8604ffeafabd9e6f16abbdbe6
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.18.0"
|
||||
io:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -761,5 +790,5 @@ packages:
|
|||
source: hosted
|
||||
version: "3.1.2"
|
||||
sdks:
|
||||
dart: ">=3.0.0-0 <4.0.0"
|
||||
flutter: ">=3.3.0"
|
||||
dart: ">=3.0.0 <4.0.0"
|
||||
flutter: ">=3.10.0"
|
||||
|
|
|
@ -47,6 +47,8 @@ dependencies:
|
|||
sizer: ^2.0.15
|
||||
fl_chart: ^0.62.0
|
||||
basic_utils: ^5.5.4
|
||||
flutter_form_builder: ^9.0.0
|
||||
form_builder_validators: ^9.0.0
|
||||
|
||||
|
||||
dev_dependencies:
|
||||
|
|
Loading…
Reference in New Issue