plan creation screen added

This commit is contained in:
Username1548
2024-12-02 15:55:57 +07:00
parent a1d9e13514
commit 1688ac1dc8
55 changed files with 3506 additions and 350 deletions

View File

@@ -1,6 +1,7 @@
import 'package:eatvio_app/features/diary/presentation/bloc/diary_cubit.dart';
import 'package:eatvio_app/core/theme/theme_helper.dart';
import 'package:eatvio_app/core/widgets/custom_text_form_field.dart';
import 'package:eatvio_app/features/glossary/models/glossary_model.dart';
import 'package:flutter/material.dart';
import 'package:lottie/lottie.dart';
@@ -10,7 +11,8 @@ class GlossaryModerationRequestModalWidget extends StatefulWidget {
const GlossaryModerationRequestModalWidget({
super.key,
required this.productName, required this.diaryCubit,
required this.productName,
required this.diaryCubit,
});
@override
@@ -26,7 +28,7 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
final proteinsController = TextEditingController();
final fatsController = TextEditingController();
final carbohydratesController = TextEditingController();
GlossaryModel? glossary;
@override
Widget build(BuildContext context) {
if (glossaryState == GlossaryState.alert) {
@@ -159,7 +161,7 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
const SizedBox(height: 16),
InkWell(
onTap: () {
Navigator.of(context).pop();
Navigator.of(context).pop(glossary);
},
borderRadius: BorderRadius.circular(20),
child: Ink(
@@ -261,14 +263,15 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
),
const SizedBox(height: 12),
InkWell(
onTap: () {
widget.diaryCubit.sendProductToModeration(
name: productNameController.text,
energy: double.parse(energyController.text),
proteins: double.parse(proteinsController.text),
fats: double.parse(fatsController.text),
carbohydrates: double.parse(carbohydratesController.text),
);
onTap: () async {
glossary = (await widget.diaryCubit.sendProductToModeration(
name: productNameController.text,
energy: double.parse(energyController.text),
proteins: double.parse(proteinsController.text),
fats: double.parse(fatsController.text),
carbohydrates: double.parse(carbohydratesController.text),
))
.glossary;
setState(() {
glossaryState = GlossaryState.success;
});