moved to a wrapped scaffold, to get some consistency and one place to add the nav drawer
This commit is contained in:
parent
44cedd1a29
commit
af0be6fe8b
10 changed files with 577 additions and 580 deletions
|
@ -7,6 +7,7 @@ import 'package:fluttericon/font_awesome5_icons.dart';
|
||||||
import 'package:pizzaplanner/entities/pizza_event.dart';
|
import 'package:pizzaplanner/entities/pizza_event.dart';
|
||||||
import 'package:pizzaplanner/entities/PizzaRecipe/pizza_recipe.dart';
|
import 'package:pizzaplanner/entities/PizzaRecipe/pizza_recipe.dart';
|
||||||
import 'package:pizzaplanner/main.dart';
|
import 'package:pizzaplanner/main.dart';
|
||||||
|
import 'package:pizzaplanner/pages/scaffold.dart';
|
||||||
import 'package:pizzaplanner/util.dart';
|
import 'package:pizzaplanner/util.dart';
|
||||||
|
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
|
@ -31,14 +32,9 @@ class AddPizzaEventPageState extends State<AddPizzaEventPage> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return PizzaPlannerScaffold(
|
||||||
appBar: AppBar(
|
|
||||||
title: const Text("Add Pizza Event"),
|
title: const Text("Add Pizza Event"),
|
||||||
),
|
body: Column(
|
||||||
resizeToAvoidBottomInset: false,
|
|
||||||
body: Container(
|
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
child: Column(
|
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 40,
|
flex: 40,
|
||||||
|
@ -201,8 +197,7 @@ class AddPizzaEventPageState extends State<AddPizzaEventPage> {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
)
|
),
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ import 'package:flutter_markdown/flutter_markdown.dart';
|
||||||
import 'package:pizzaplanner/entities/PizzaRecipe/ingredient.dart';
|
import 'package:pizzaplanner/entities/PizzaRecipe/ingredient.dart';
|
||||||
import 'package:pizzaplanner/entities/PizzaRecipe/pizza_recipe.dart';
|
import 'package:pizzaplanner/entities/PizzaRecipe/pizza_recipe.dart';
|
||||||
import 'package:pizzaplanner/entities/PizzaRecipe/recipe_step.dart';
|
import 'package:pizzaplanner/entities/PizzaRecipe/recipe_step.dart';
|
||||||
|
import 'package:pizzaplanner/pages/scaffold.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
class AddRecipePage extends StatefulWidget {
|
class AddRecipePage extends StatefulWidget {
|
||||||
|
@ -34,14 +35,9 @@ class AddRecipePageState extends State<AddRecipePage> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context){
|
Widget build(BuildContext context){
|
||||||
return Scaffold(
|
return PizzaPlannerScaffold(
|
||||||
appBar: AppBar(
|
title: const Text("Add Recipe"),
|
||||||
title: const Text("Add Pizza Recipe"),
|
body: ListView(
|
||||||
),
|
|
||||||
resizeToAvoidBottomInset: false,
|
|
||||||
body: Container(
|
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
child: ListView(
|
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
TextField(
|
TextField(
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
|
@ -133,8 +129,7 @@ class AddRecipePageState extends State<AddRecipePage> {
|
||||||
] + pizzaRecipe.ingredients.map((ingredient) => buildIngredientRow(ingredient)).toList() + [
|
] + pizzaRecipe.ingredients.map((ingredient) => buildIngredientRow(ingredient)).toList() + [
|
||||||
|
|
||||||
],
|
],
|
||||||
)
|
),
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,20 +2,15 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:hive_flutter/adapters.dart';
|
import 'package:hive_flutter/adapters.dart';
|
||||||
import 'package:pizzaplanner/entities/PizzaRecipe/pizza_recipe.dart';
|
import 'package:pizzaplanner/entities/PizzaRecipe/pizza_recipe.dart';
|
||||||
import 'package:pizzaplanner/pages/nav_drawer.dart';
|
import 'package:pizzaplanner/pages/nav_drawer.dart';
|
||||||
|
import 'package:pizzaplanner/pages/scaffold.dart';
|
||||||
import 'package:pizzaplanner/widgets/pizza_recipe_widget.dart';
|
import 'package:pizzaplanner/widgets/pizza_recipe_widget.dart';
|
||||||
|
|
||||||
class PickPizzaRecipePage extends StatelessWidget {
|
class PickPizzaRecipePage extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context){
|
Widget build(BuildContext context){
|
||||||
return Scaffold(
|
return PizzaPlannerScaffold(
|
||||||
drawer: NavDrawer(),
|
title: const Text("Pick Recipe"),
|
||||||
appBar: AppBar(
|
body: ValueListenableBuilder(
|
||||||
title: const Text("Pick Pizza Recipe"),
|
|
||||||
),
|
|
||||||
resizeToAvoidBottomInset: false,
|
|
||||||
body: Container(
|
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
child: ValueListenableBuilder(
|
|
||||||
valueListenable: Hive.box<PizzaRecipe>("PizzaRecipes").listenable(),
|
valueListenable: Hive.box<PizzaRecipe>("PizzaRecipes").listenable(),
|
||||||
builder: (context, Box<PizzaRecipe> pizzaRecipesBox, widget) {
|
builder: (context, Box<PizzaRecipe> pizzaRecipesBox, widget) {
|
||||||
return ListView.separated(
|
return ListView.separated(
|
||||||
|
@ -36,8 +31,7 @@ class PickPizzaRecipePage extends StatelessWidget {
|
||||||
separatorBuilder: (BuildContext context, int i) => const Divider(),
|
separatorBuilder: (BuildContext context, int i) => const Divider(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
)
|
),
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,6 +9,7 @@ import 'package:pizzaplanner/entities/pizza_event.dart';
|
||||||
import 'package:pizzaplanner/entities/PizzaRecipe/recipe_step.dart';
|
import 'package:pizzaplanner/entities/PizzaRecipe/recipe_step.dart';
|
||||||
import 'package:pizzaplanner/main.dart';
|
import 'package:pizzaplanner/main.dart';
|
||||||
import 'package:pizzaplanner/pages/recipe_step_instruction_page.dart';
|
import 'package:pizzaplanner/pages/recipe_step_instruction_page.dart';
|
||||||
|
import 'package:pizzaplanner/pages/scaffold.dart';
|
||||||
|
|
||||||
import 'package:timezone/timezone.dart' as tz;
|
import 'package:timezone/timezone.dart' as tz;
|
||||||
import 'package:vibration/vibration.dart';
|
import 'package:vibration/vibration.dart';
|
||||||
|
@ -56,14 +57,9 @@ class PizzaEventNotificationState extends State<PizzaEventNotificationPage> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return PizzaPlannerScaffold(
|
||||||
appBar: AppBar(
|
title: Text(recipeStep.name),
|
||||||
title: const Text("From notification"),
|
body: Column(
|
||||||
),
|
|
||||||
resizeToAvoidBottomInset: false,
|
|
||||||
body: Container(
|
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
child: Column(
|
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 10,
|
flex: 10,
|
||||||
|
@ -146,8 +142,7 @@ class PizzaEventNotificationState extends State<PizzaEventNotificationPage> {
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
)
|
),
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import 'package:pizzaplanner/entities/PizzaRecipe/ingredient.dart';
|
||||||
import 'package:pizzaplanner/entities/PizzaRecipe/recipe_step.dart';
|
import 'package:pizzaplanner/entities/PizzaRecipe/recipe_step.dart';
|
||||||
import 'package:pizzaplanner/entities/PizzaRecipe/recipe_substep.dart';
|
import 'package:pizzaplanner/entities/PizzaRecipe/recipe_substep.dart';
|
||||||
import 'package:pizzaplanner/main.dart';
|
import 'package:pizzaplanner/main.dart';
|
||||||
|
import 'package:pizzaplanner/pages/scaffold.dart';
|
||||||
import 'package:pizzaplanner/util.dart';
|
import 'package:pizzaplanner/util.dart';
|
||||||
import 'package:pizzaplanner/widgets/pizza_recipe_widget.dart';
|
import 'package:pizzaplanner/widgets/pizza_recipe_widget.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
@ -26,14 +27,9 @@ class PizzaEventPageState extends State<PizzaEventPage> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final recipeStepCount = widget.pizzaEvent.recipe.recipeSteps.length;
|
final recipeStepCount = widget.pizzaEvent.recipe.recipeSteps.length;
|
||||||
final completedRecipeStepCount = widget.pizzaEvent.recipe.recipeSteps.where((recipeStep) => recipeStep.completed).length;
|
final completedRecipeStepCount = widget.pizzaEvent.recipe.recipeSteps.where((recipeStep) => recipeStep.completed).length;
|
||||||
return Scaffold(
|
return PizzaPlannerScaffold(
|
||||||
appBar: AppBar(
|
|
||||||
title: Text(widget.pizzaEvent.name),
|
title: Text(widget.pizzaEvent.name),
|
||||||
),
|
body: Column(
|
||||||
resizeToAvoidBottomInset: false,
|
|
||||||
body: Container(
|
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
child: Column(
|
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 15,
|
flex: 15,
|
||||||
|
@ -98,8 +94,7 @@ class PizzaEventPageState extends State<PizzaEventPage> {
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
),
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:pizzaplanner/entities/pizza_event.dart';
|
import 'package:pizzaplanner/entities/pizza_event.dart';
|
||||||
|
import 'package:pizzaplanner/pages/scaffold.dart';
|
||||||
import 'package:pizzaplanner/widgets/pizza_event_widget.dart';
|
import 'package:pizzaplanner/widgets/pizza_event_widget.dart';
|
||||||
|
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
|
@ -17,13 +18,9 @@ class PizzaEventsState extends State<PizzaEventsPage> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return PizzaPlannerScaffold(
|
||||||
appBar: AppBar(
|
|
||||||
title: const Text("Pizza Events"),
|
title: const Text("Pizza Events"),
|
||||||
),
|
body: ValueListenableBuilder(
|
||||||
body: Container(
|
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
child: ValueListenableBuilder(
|
|
||||||
valueListenable: Hive.box<PizzaEvent>("PizzaEvents").listenable(),
|
valueListenable: Hive.box<PizzaEvent>("PizzaEvents").listenable(),
|
||||||
builder: (context, Box<PizzaEvent> box, widget) {
|
builder: (context, Box<PizzaEvent> box, widget) {
|
||||||
if (box.isEmpty){
|
if (box.isEmpty){
|
||||||
|
@ -37,7 +34,6 @@ class PizzaEventsState extends State<PizzaEventsPage> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
),
|
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final dynamic newPizzaEvent = await Navigator.pushNamed(
|
final dynamic newPizzaEvent = await Navigator.pushNamed(
|
||||||
|
|
|
@ -3,6 +3,7 @@ import 'package:flutter_markdown/flutter_markdown.dart';
|
||||||
import 'package:pizzaplanner/entities/PizzaRecipe/pizza_recipe.dart';
|
import 'package:pizzaplanner/entities/PizzaRecipe/pizza_recipe.dart';
|
||||||
import 'package:pizzaplanner/entities/pizza_event.dart';
|
import 'package:pizzaplanner/entities/pizza_event.dart';
|
||||||
import 'package:pizzaplanner/entities/PizzaRecipe/recipe_step.dart';
|
import 'package:pizzaplanner/entities/PizzaRecipe/recipe_step.dart';
|
||||||
|
import 'package:pizzaplanner/pages/scaffold.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
class RecipePage extends StatefulWidget {
|
class RecipePage extends StatefulWidget {
|
||||||
|
@ -42,11 +43,8 @@ class RecipePageState extends State<RecipePage> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return PizzaPlannerScaffold(
|
||||||
appBar: AppBar(
|
|
||||||
title: Text(widget.pizzaRecipe.name),
|
title: Text(widget.pizzaRecipe.name),
|
||||||
),
|
|
||||||
resizeToAvoidBottomInset: false,
|
|
||||||
body: Column(
|
body: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
|
@ -72,7 +70,7 @@ class RecipePageState extends State<RecipePage> {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import 'package:pizzaplanner/entities/PizzaRecipe/recipe_step.dart';
|
||||||
|
|
||||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||||
import 'package:pizzaplanner/entities/PizzaRecipe/recipe_substep.dart';
|
import 'package:pizzaplanner/entities/PizzaRecipe/recipe_substep.dart';
|
||||||
|
import 'package:pizzaplanner/pages/scaffold.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
class RecipeStepInstructionPageArguments {
|
class RecipeStepInstructionPageArguments {
|
||||||
|
@ -49,14 +50,10 @@ class RecipeStepInstructionState extends State<RecipeStepInstructionPage> {
|
||||||
} else if (page > 0){
|
} else if (page > 0){
|
||||||
nextButtonText = "Next step";
|
nextButtonText = "Next step";
|
||||||
}
|
}
|
||||||
return Scaffold(
|
|
||||||
appBar: AppBar(
|
return PizzaPlannerScaffold(
|
||||||
title: Text(widget.recipeStep.name),
|
title: Text(widget.recipeStep.name),
|
||||||
),
|
body: Column(
|
||||||
resizeToAvoidBottomInset: false,
|
|
||||||
body: Container(
|
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
child: Column(
|
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 90,
|
flex: 90,
|
||||||
|
@ -139,8 +136,7 @@ class RecipeStepInstructionState extends State<RecipeStepInstructionPage> {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
)
|
),
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,20 +2,15 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:hive_flutter/hive_flutter.dart';
|
import 'package:hive_flutter/hive_flutter.dart';
|
||||||
import 'package:pizzaplanner/entities/PizzaRecipe/pizza_recipe.dart';
|
import 'package:pizzaplanner/entities/PizzaRecipe/pizza_recipe.dart';
|
||||||
import 'package:pizzaplanner/pages/nav_drawer.dart';
|
import 'package:pizzaplanner/pages/nav_drawer.dart';
|
||||||
|
import 'package:pizzaplanner/pages/scaffold.dart';
|
||||||
import 'package:pizzaplanner/widgets/pizza_recipe_widget.dart';
|
import 'package:pizzaplanner/widgets/pizza_recipe_widget.dart';
|
||||||
|
|
||||||
class RecipesPage extends StatelessWidget {
|
class RecipesPage extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context){
|
Widget build(BuildContext context){
|
||||||
return Scaffold(
|
return PizzaPlannerScaffold(
|
||||||
drawer: NavDrawer(),
|
title: const Text("Pizza Recipes"),
|
||||||
appBar: AppBar(
|
body: Column(
|
||||||
title: const Text("Recipes"),
|
|
||||||
),
|
|
||||||
resizeToAvoidBottomInset: false,
|
|
||||||
body: Container(
|
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
child: Column(
|
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
const Expanded(
|
const Expanded(
|
||||||
flex: 5,
|
flex: 5,
|
||||||
|
@ -57,8 +52,7 @@ class RecipesPage extends StatelessWidget {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
)
|
),
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
39
lib/pages/scaffold.dart
Normal file
39
lib/pages/scaffold.dart
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:pizzaplanner/pages/nav_drawer.dart';
|
||||||
|
|
||||||
|
class PizzaPlannerScaffold extends StatelessWidget {
|
||||||
|
late final Widget _body;
|
||||||
|
late final Widget _appBarTitle;
|
||||||
|
late final bool _resizeToAvoidBottomInset;
|
||||||
|
late final EdgeInsets _edgeInsets;
|
||||||
|
late final FloatingActionButton? _floatingActionButton;
|
||||||
|
PizzaPlannerScaffold({
|
||||||
|
required Widget body,
|
||||||
|
required Widget title,
|
||||||
|
bool resizeToAvoidBottomInset = false,
|
||||||
|
EdgeInsets edgeInsets = const EdgeInsets.all(16),
|
||||||
|
FloatingActionButton? floatingActionButton
|
||||||
|
}){
|
||||||
|
_body = body;
|
||||||
|
_appBarTitle = title;
|
||||||
|
_resizeToAvoidBottomInset = resizeToAvoidBottomInset;
|
||||||
|
_edgeInsets = edgeInsets;
|
||||||
|
_floatingActionButton = floatingActionButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context){
|
||||||
|
return Scaffold(
|
||||||
|
body: Container(
|
||||||
|
padding: _edgeInsets,
|
||||||
|
child: _body
|
||||||
|
),
|
||||||
|
appBar: AppBar(
|
||||||
|
title: _appBarTitle,
|
||||||
|
),
|
||||||
|
resizeToAvoidBottomInset: _resizeToAvoidBottomInset,
|
||||||
|
drawer: NavDrawer(),
|
||||||
|
floatingActionButton: _floatingActionButton,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue