updated widget for recipe steps without substeps
This commit is contained in:
parent
da32131f0d
commit
1ce594c5df
1 changed files with 29 additions and 32 deletions
|
@ -49,21 +49,21 @@ class PizzaEventPageState extends State<PizzaEventPage> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(recipeStep.description),
|
InkWell(
|
||||||
Row(
|
onLongPress: () {
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
setState(() {
|
||||||
children: [
|
recipeStep.completedOn = recipeStep.completed ? null : DateTime.now();
|
||||||
Text(recipeStep.name),
|
});
|
||||||
Checkbox(
|
},
|
||||||
value: recipeStep.completedOn != null,
|
child: Container(
|
||||||
onChanged: (bool? newValue) async {
|
width: double.infinity,
|
||||||
if (newValue == null){
|
color: recipeStep.completed ? Colors.green : Colors.grey,
|
||||||
return;
|
child: Column(
|
||||||
}
|
children: <Widget>[
|
||||||
setState(() {recipeStep.completedOn = newValue ? DateTime.now() : null;});
|
Text(recipeStep.description)
|
||||||
},
|
],
|
||||||
)
|
),
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
Divider(),
|
Divider(),
|
||||||
]
|
]
|
||||||
|
@ -85,14 +85,17 @@ class PizzaEventPageState extends State<PizzaEventPage> {
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(recipeStep.description),
|
Text(recipeStep.description),
|
||||||
Column(
|
Column(
|
||||||
children: recipeStep.subSteps.map((subStep) => getSubStepWidget(subStep)).toList()
|
children: recipeStep.subSteps.map(
|
||||||
|
(subStep) => getSubStepWidget(subStep)
|
||||||
|
).expand((subStep) => [Divider(), subStep]).toList()
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget getSubStepWidget(RecipeSubStep recipeSubStep){
|
Widget getSubStepWidget(RecipeSubStep recipeSubStep){
|
||||||
return InkWell(
|
return InkWell(
|
||||||
|
onLongPress: () async {},
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await showDialog(
|
await showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
@ -102,22 +105,16 @@ class PizzaEventPageState extends State<PizzaEventPage> {
|
||||||
);
|
);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
child: Row(
|
child: Container(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
color: recipeSubStep.completed ? Colors.green : Colors.grey,
|
||||||
children: [
|
child: Column(
|
||||||
Expanded(
|
children: <Widget>[
|
||||||
flex: 1,
|
Center(
|
||||||
child: SizedBox(
|
child: Text(recipeSubStep.name),
|
||||||
height: 50,
|
|
||||||
child: Container(
|
|
||||||
color: recipeSubStep.completed ? Colors.green : Colors.grey,
|
|
||||||
child: Center(
|
|
||||||
child: Text(recipeSubStep.name)
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
)
|
Text(recipeSubStep.description)
|
||||||
],
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue