farbe und felder mit daten befüllen

main
Bogdan Kotikov 2023-06-19 20:23:27 +02:00
parent 7b92d3dada
commit e4ebac676f
4 changed files with 26 additions and 3 deletions

View File

@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"bs_flutter_modal","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/bs_flutter_modal-1.0.6/","native_build":true,"dependencies":["bs_flutter_utils"]},{"name":"bs_flutter_utils","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/bs_flutter_utils-1.0.2/","native_build":true,"dependencies":[]},{"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.3/","native_build":true,"dependencies":[]}],"android":[{"name":"bs_flutter_modal","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/bs_flutter_modal-1.0.6/","native_build":true,"dependencies":["bs_flutter_utils"]},{"name":"bs_flutter_utils","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/bs_flutter_utils-1.0.2/","native_build":true,"dependencies":[]},{"name":"dynamic_color","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/dynamic_color-1.6.5/","native_build":true,"dependencies":[]},{"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":"dynamic_color","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/dynamic_color-1.6.5/","native_build":true,"dependencies":[]},{"name":"macos_ui","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/macos_ui-1.12.2/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_foundation-2.2.3/","native_build":true,"dependencies":[]}],"linux":[{"name":"dynamic_color","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/dynamic_color-1.6.5/","native_build":true,"dependencies":[]},{"name":"path_provider_linux","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_linux-2.1.11/","native_build":false,"dependencies":[]}],"windows":[{"name":"dynamic_color","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/dynamic_color-1.6.5/","native_build":true,"dependencies":[]},{"name":"path_provider_windows","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_windows-2.1.7/","native_build":false,"dependencies":[]}],"web":[{"name":"bs_flutter_modal","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/bs_flutter_modal-1.0.6/","dependencies":["bs_flutter_utils"]},{"name":"bs_flutter_utils","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/bs_flutter_utils-1.0.2/","dependencies":[]},{"name":"fluttertoast","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/fluttertoast-8.2.2/","dependencies":[]}]},"dependencyGraph":[{"name":"bs_flutter_modal","dependencies":["bs_flutter_utils"]},{"name":"bs_flutter_utils","dependencies":[]},{"name":"dynamic_color","dependencies":[]},{"name":"fluttertoast","dependencies":[]},{"name":"macos_ui","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-16 15:10:40.940451","version":"3.7.9"} {"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"bs_flutter_modal","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/bs_flutter_modal-1.0.6/","native_build":true,"dependencies":["bs_flutter_utils"]},{"name":"bs_flutter_utils","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/bs_flutter_utils-1.0.2/","native_build":true,"dependencies":[]},{"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.3/","native_build":true,"dependencies":[]}],"android":[{"name":"bs_flutter_modal","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/bs_flutter_modal-1.0.6/","native_build":true,"dependencies":["bs_flutter_utils"]},{"name":"bs_flutter_utils","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/bs_flutter_utils-1.0.2/","native_build":true,"dependencies":[]},{"name":"dynamic_color","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/dynamic_color-1.6.5/","native_build":true,"dependencies":[]},{"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":"dynamic_color","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/dynamic_color-1.6.5/","native_build":true,"dependencies":[]},{"name":"macos_ui","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/macos_ui-1.12.2/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_foundation-2.2.3/","native_build":true,"dependencies":[]}],"linux":[{"name":"dynamic_color","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/dynamic_color-1.6.5/","native_build":true,"dependencies":[]},{"name":"path_provider_linux","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_linux-2.1.11/","native_build":false,"dependencies":[]}],"windows":[{"name":"dynamic_color","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/dynamic_color-1.6.5/","native_build":true,"dependencies":[]},{"name":"path_provider_windows","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_windows-2.1.7/","native_build":false,"dependencies":[]}],"web":[{"name":"bs_flutter_modal","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/bs_flutter_modal-1.0.6/","dependencies":["bs_flutter_utils"]},{"name":"bs_flutter_utils","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/bs_flutter_utils-1.0.2/","dependencies":[]},{"name":"fluttertoast","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/fluttertoast-8.2.2/","dependencies":[]}]},"dependencyGraph":[{"name":"bs_flutter_modal","dependencies":["bs_flutter_utils"]},{"name":"bs_flutter_utils","dependencies":[]},{"name":"dynamic_color","dependencies":[]},{"name":"fluttertoast","dependencies":[]},{"name":"macos_ui","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-19 20:15:34.085195","version":"3.7.9"}

View File

@ -1,4 +1,5 @@
import 'package:ernaehrung/android/components/form/form_builder_text_field_component.dart'; import 'package:ernaehrung/android/components/form/form_builder_text_field_component.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
@ -111,7 +112,7 @@ class _FormBuilderComponentState extends State<FormBuilderComponent> {
child: ElevatedButton( child: ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
minimumSize: const Size.fromHeight(40), // minimumSize: const Size.fromHeight(40), //
backgroundColor: const Color(0xFF6E7BFB), backgroundColor: CupertinoColors.systemGreen,
foregroundColor: const Color(0xFFffffff), foregroundColor: const Color(0xFFffffff),
shape: const StadiumBorder(), shape: const StadiumBorder(),
), ),

View File

@ -1,8 +1,10 @@
import 'package:basic_utils/basic_utils.dart'; import 'package:basic_utils/basic_utils.dart';
import 'package:ernaehrung/android/models/form_builder.dart'; import 'package:ernaehrung/android/models/form_builder.dart';
import 'package:ernaehrung/android/models/user.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:form_builder_validators/form_builder_validators.dart'; import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:hive/hive.dart';
class FormBuilderTextFieldComponent extends StatefulWidget { class FormBuilderTextFieldComponent extends StatefulWidget {
final bool isSettingsPage; final bool isSettingsPage;
@ -29,7 +31,7 @@ class _FormBuilderTextFieldComponentState extends State<FormBuilderTextFieldComp
children: [ children: [
Expanded( Expanded(
child: child:
TextFieldChild(widget.isSettingsPage, widget.formTextField, enable: enable)), TextFieldChild(widget.isSettingsPage, widget.formTextField, enable: enable,)),
enable enable
? IconButton( ? IconButton(
onPressed: () async { onPressed: () async {
@ -62,11 +64,29 @@ class TextFieldChild extends StatelessWidget {
{super.key, this.enable = true}); {super.key, this.enable = true});
dynamic getInitialValue(FormTextField textField){
final User user = Hive.box<User>("USER_BOX").values.last;
if (textField.title == "vorname"){
return user.vorname;
}else if (textField.title == "nachname"){
return user.nachname;
}else if (textField.title == "gewicht"){
return user.gewicht;
}else if (textField.title == "groesse"){
return user.groesse;
}else if (textField.title == "alter"){
return user.alter;
}else if (textField.title == "kalorien"){
return user.kalorien;
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return FormBuilderTextField( return FormBuilderTextField(
name: formTextField.title, name: formTextField.title,
enabled: enable!, enabled: enable!,
initialValue: isSettingsPage ? getInitialValue(formTextField).toString() : "",
decoration: InputDecoration( decoration: InputDecoration(
border: const OutlineInputBorder( border: const OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10.0))), borderRadius: BorderRadius.all(Radius.circular(10.0))),

View File

@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../components/form/form_builder.dart'; import '../components/form/form_builder.dart';
@ -14,6 +15,7 @@ class _SettingsPageState extends State<SettingsPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
backgroundColor: CupertinoColors.systemGreen,
leading: BackButton( leading: BackButton(
onPressed: () async => Navigator.of(context).pop(), onPressed: () async => Navigator.of(context).pop(),
), ),