Skip to content

Commit

Permalink
fixed some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
judemont committed Apr 3, 2024
1 parent 3209961 commit 244ac4b
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 56 deletions.
2 changes: 1 addition & 1 deletion lib/widgets/extractRecipeButton.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:marmiteur/marmiteur.dart';

import 'RecipeEditorPage.dart';
import 'recipeEditorPage.dart';

class ExtractRecipeButton extends StatefulWidget {
final Function reloadRecipes;
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/newRecipeButton.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'RecipeEditorPage.dart';
import 'recipeEditorPage.dart';

class NewRecipeButton extends StatefulWidget {
final Function reloadRecipes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class _RecipeEditorPageState extends State<RecipeEditorPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
title: const Text("New Recipe"),
centerTitle: true,
Expand Down Expand Up @@ -56,7 +57,8 @@ class _RecipeEditorPageState extends State<RecipeEditorPage> {
icon: const Icon(Icons.check))
],
),
body: Form(
body: SingleChildScrollView(
child: Form(
key: formKey,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 56),
Expand Down Expand Up @@ -119,6 +121,6 @@ class _RecipeEditorPageState extends State<RecipeEditorPage> {
],
),
),
));
)));
}
}
108 changes: 56 additions & 52 deletions lib/widgets/recipeViewPage.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:reciper/widgets/RecipeEditorPage.dart';
import 'package:reciper/widgets/recipeEditorPage.dart';
import '../models/recipe.dart';

class RecipeViewPage extends StatefulWidget {
Expand Down Expand Up @@ -30,6 +30,7 @@ class _RecipeViewPageState extends State<RecipeViewPage> {
}

return Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
title: const Text("Reciper"),
centerTitle: true,
Expand All @@ -51,56 +52,59 @@ class _RecipeViewPageState extends State<RecipeViewPage> {
icon: const Icon(Icons.edit))
],
),
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 5),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
widget.recipe.title,
style: const TextStyle(
fontSize: 30, fontWeight: FontWeight.bold),
),
const SizedBox(
height: 15,
),
const Text(
"Ingredients :",
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
),
ListView.builder(
shrinkWrap: true,
itemCount: ingredientsList.length,
itemBuilder: (BuildContext context, int index) {
return CheckboxListTile(
controlAffinity: ListTileControlAffinity.leading,
value: checkboxValuesIngredients[index] ?? false,
title: Text(ingredientsList[index]),
onChanged: (value) {
setState(() {
checkboxValuesIngredients[index] = value!;
});
});
}),
const Text(
"Steps :",
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
),
ListView.builder(
shrinkWrap: true,
itemCount: stepsList.length,
itemBuilder: (BuildContext context, int index) {
return CheckboxListTile(
controlAffinity: ListTileControlAffinity.leading,
value: checkboxValuesSteps[index] ?? false,
title: Text(stepsList[index]),
onChanged: (value) {
setState(() {
checkboxValuesSteps[index] = value!;
});
});
}),
],
)));
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 5),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
widget.recipe.title,
style: const TextStyle(
fontSize: 30, fontWeight: FontWeight.bold),
),
const SizedBox(
height: 15,
),
const Text(
"Ingredients :",
style:
TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
),
ListView.builder(
shrinkWrap: true,
itemCount: ingredientsList.length,
itemBuilder: (BuildContext context, int index) {
return CheckboxListTile(
controlAffinity: ListTileControlAffinity.leading,
value: checkboxValuesIngredients[index] ?? false,
title: Text(ingredientsList[index]),
onChanged: (value) {
setState(() {
checkboxValuesIngredients[index] = value!;
});
});
}),
const Text(
"Steps :",
style:
TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
),
ListView.builder(
shrinkWrap: true,
itemCount: stepsList.length,
itemBuilder: (BuildContext context, int index) {
return CheckboxListTile(
controlAffinity: ListTileControlAffinity.leading,
value: checkboxValuesSteps[index] ?? false,
title: Text(stepsList[index]),
onChanged: (value) {
setState(() {
checkboxValuesSteps[index] = value!;
});
});
}),
],
))));
}
}

0 comments on commit 244ac4b

Please sign in to comment.