import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:kalodings/food_entry_bloc.dart'; class EnterFoodWidget extends StatefulWidget { const EnterFoodWidget({ super.key, }); @override State createState() => _EnterFoodWidgetState(); } class _EnterFoodWidgetState extends State { String perFoodresult = "dings"; @override Widget build(BuildContext context) { return Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ const Spacer(flex: 1), const Expanded( flex: 4, child: TextField(decoration: InputDecoration(hintText: "Name"))), const Expanded( flex: 4, child: TextField(decoration: InputDecoration(hintText: "Menge"))), const Expanded( flex: 4, child: TextField( decoration: InputDecoration(hintText: "kcal pro 100g")), ), Text(perFoodresult), const Spacer(flex: 1), ], ), ElevatedButton( child: const Text("Hinzufügen"), onPressed: () { var entry = FoodEntry(name: '', mass: 2.0, kcal: 100, kcalPerMass: 200); context.read().add(FoodEntryEvent(entry: entry)); }), ], ); } }