added provider to createRecipePage
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../services/providers/recipe_provider.dart';
|
||||
import 'create_recipe_pages/ingredients_page.dart';
|
||||
import 'create_recipe_pages/metadata_page.dart';
|
||||
import 'create_recipe_pages/steps_page.dart';
|
||||
@@ -21,6 +23,8 @@ class _CreateRecipePageState extends State<CreateRecipePage> {
|
||||
const StepsPage(),
|
||||
];
|
||||
|
||||
late RecipeProvider _recipeProvider;
|
||||
|
||||
final List<NavigationDestination> _destinations = [
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.list),
|
||||
@@ -38,6 +42,7 @@ class _CreateRecipePageState extends State<CreateRecipePage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
_recipeProvider = context.watch<RecipeProvider>();
|
||||
return Scaffold(
|
||||
appBar: AppBar(),
|
||||
bottomNavigationBar: NavigationBar(
|
||||
@@ -47,7 +52,16 @@ class _CreateRecipePageState extends State<CreateRecipePage> {
|
||||
_currentPageIndex = value;
|
||||
}),
|
||||
),
|
||||
body: _pages.elementAt(_currentPageIndex),
|
||||
body: IndexedStack(
|
||||
index: _currentPageIndex,
|
||||
children: _pages,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
_recipeProvider.disposeRecipe();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user