added simple pizza event page, showing steps + substeps in an expanded list tile
This commit is contained in:
parent
50371642cb
commit
797b8580bb
3 changed files with 96 additions and 42 deletions
|
@ -6,6 +6,7 @@ import 'package:pizzaplanner/entities/PizzaRecipe/RecipeStep.dart';
|
|||
import 'package:pizzaplanner/entities/PizzaRecipe/RecipeSubStep.dart';
|
||||
import 'package:pizzaplanner/pages/AddPizzaEventPage.dart';
|
||||
import 'package:pizzaplanner/pages/PickPizzaRecipePage.dart';
|
||||
import 'package:pizzaplanner/pages/PizzaEventPage.dart';
|
||||
import 'package:pizzaplanner/pages/PizzaEventsPage.dart';
|
||||
|
||||
import 'package:hive/hive.dart';
|
||||
|
@ -57,6 +58,9 @@ class RouteGenerator {
|
|||
case "/event/add": {
|
||||
return MaterialPageRoute(builder: (context) => AddPizzaEventPage(settings.arguments as PizzaRecipe));
|
||||
}
|
||||
case "/event/view": {
|
||||
return MaterialPageRoute(builder: (context) => PizzaEventPage(settings.arguments as PizzaEvent));
|
||||
}
|
||||
|
||||
default: {
|
||||
return MaterialPageRoute(builder: (context) => PizzaEventsPage());
|
||||
|
|
39
lib/pages/PizzaEventPage.dart
Normal file
39
lib/pages/PizzaEventPage.dart
Normal file
|
@ -0,0 +1,39 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:pizzaplanner/entities/PizzaEvent.dart';
|
||||
|
||||
class PizzaEventPage extends StatefulWidget {
|
||||
PizzaEvent pizzaEvent;
|
||||
|
||||
PizzaEventPage(this.pizzaEvent);
|
||||
|
||||
@override
|
||||
PizzaEventPageState createState() => PizzaEventPageState();
|
||||
}
|
||||
|
||||
class PizzaEventPageState extends State<PizzaEventPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(this.widget.pizzaEvent.name),
|
||||
),
|
||||
resizeToAvoidBottomInset: false,
|
||||
body: Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: ListView(
|
||||
children: this.widget.pizzaEvent.recipe.recipeSteps.map((recipeStep) {
|
||||
return ExpansionTile(
|
||||
title: Row(
|
||||
children: [],
|
||||
),
|
||||
children: recipeStep.subSteps.map((recipeSubStep) {
|
||||
return Text(recipeSubStep.name);
|
||||
}
|
||||
).toList(),
|
||||
);
|
||||
}).toList(),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -9,52 +9,63 @@ class PizzaEventWidget extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context){
|
||||
return Container(
|
||||
height: 120,
|
||||
color: Colors.blueAccent,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Text(pizzaEvent.name),
|
||||
Text(this.getTimeRemainingString())
|
||||
],
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
height: 72,
|
||||
child: Row(
|
||||
return InkWell(
|
||||
child: Container(
|
||||
height: 120,
|
||||
color: Colors.blueAccent,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Slider(
|
||||
min: 0.0,
|
||||
max: pizzaEvent.recipe.recipeSteps.length.toDouble(),
|
||||
divisions: pizzaEvent.recipe.recipeSteps.length,
|
||||
value: pizzaEvent.recipe.getStepsCompleted().toDouble(),
|
||||
onChanged: (d) {},
|
||||
activeColor: Colors.green,
|
||||
inactiveColor: Colors.white,
|
||||
)
|
||||
),
|
||||
]
|
||||
Text(pizzaEvent.name),
|
||||
Text(this.getTimeRemainingString())
|
||||
],
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
height: 72,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: IgnorePointer(
|
||||
child: Slider(
|
||||
min: 0.0,
|
||||
max: pizzaEvent.recipe.recipeSteps.length.toDouble(),
|
||||
divisions: pizzaEvent.recipe.recipeSteps.length,
|
||||
value: pizzaEvent.recipe.getStepsCompleted().toDouble(),
|
||||
onChanged: (d) {},
|
||||
activeColor: Colors.green,
|
||||
inactiveColor: Colors.white,
|
||||
)
|
||||
)
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Text(getDateFormat().format(pizzaEvent.dateTime)),
|
||||
Text(pizzaEvent.recipe.name)
|
||||
],
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Text(getDateFormat().format(pizzaEvent.dateTime)),
|
||||
Text(pizzaEvent.recipe.name)
|
||||
],
|
||||
),
|
||||
|
||||
]
|
||||
)
|
||||
)
|
||||
]
|
||||
)
|
||||
)
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
"/event/view",
|
||||
arguments: this.pizzaEvent
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue