Skip to content
This repository has been archived by the owner on Oct 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #13 from phantomate/dev
Browse files Browse the repository at this point in the history
Release merge
  • Loading branch information
phantomate authored Dec 10, 2022
2 parents e36a833 + 47133fa commit f77462f
Show file tree
Hide file tree
Showing 15 changed files with 1,007 additions and 114 deletions.
39 changes: 39 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Bug Report
description: Report for broken or incorrect behaviour
labels: unconfirmed bug
body:
- type: textarea
attributes:
label: Bug Summary
description: Summerize your bug report
validations:
required: true
- type: textarea
attributes:
label: Reproduction Steps
description: >
What you did to make it happen.
validations:
required: true
- type: textarea
attributes:
label: Expected Results
description: >
What did you expect to happen?
validations:
required: true
- type: textarea
attributes:
label: Actual Results
description: >
What actually happened?
validations:
required: true
- type: checkboxes
attributes:
label: Checklist
description: >
Please confirm that you have done the following checks!
options:
- label: I have searched the open issues for duplicates.
required: true
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Feature Request
description: Suggest a feature request for Untare
labels: feature request
body:
- type: textarea
attributes:
label: Your Request
description: >
What issue/problem is your feature request trying to solve? What becomes easier when implemented?
validations:
required: true
- type: textarea
attributes:
label: The Current State
description: >
If, how is it currently solved?
validations:
required: false
- type: textarea
attributes:
label: Additional Context
description: If there is anything else to say, please do so here.
9 changes: 8 additions & 1 deletion lib/components/dialogs/add_shopping_list_entry_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import 'package:untare/blocs/shopping_list/shopping_list_bloc.dart';
import 'package:untare/blocs/shopping_list/shopping_list_event.dart';
import 'package:untare/components/form_fields/food_type_ahead_form_field.dart';
import 'package:untare/components/form_fields/quantity_text_form_field.dart';
import 'package:untare/components/form_fields/supermarket_category_type_ahead_form_field.dart';
import 'package:untare/components/form_fields/unit_type_ahead_form_field.dart';
import 'package:untare/models/food.dart';
import 'package:untare/models/shopping_list_entry.dart';
import 'package:untare/models/unit.dart';
import 'package:flutter_gen/gen_l10n/app_locales.dart';
Expand Down Expand Up @@ -64,6 +66,8 @@ Future addShoppingListEntryDialog(BuildContext context) {
)
],
),
const SizedBox(height: 15),
supermarketCategoryTypeAheadFormField(null, formBuilderKey, context),
],
)
),
Expand All @@ -83,7 +87,10 @@ Future addShoppingListEntryDialog(BuildContext context) {
unit = formBuilderData['unit'];
}

ShoppingListEntry newShoppingListEntry = ShoppingListEntry(food: formBuilderData['food'], unit: unit, amount: amount, checked: false);
// Set supermarket category on food
Food foodWithNewCategory = formBuilderData['food'].copyWith(supermarketCategory: formBuilderData['category']);

ShoppingListEntry newShoppingListEntry = ShoppingListEntry(food: foodWithNewCategory, unit: unit, amount: amount, checked: false);

shoppingListBloc.add(CreateShoppingListEntry(shoppingListEntry: newShoppingListEntry));
Navigator.pop(dContext);
Expand Down
60 changes: 60 additions & 0 deletions lib/components/dialogs/upsert_recipe_step_time_dialog.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import 'package:flutter/material.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:flutter_gen/gen_l10n/app_locales.dart';

Future upsertRecipeStepTimeDialog(BuildContext context, int stepIndex, Function(Map<String, dynamic>) upsertStepTime, {int? stepTime}) {
final formKey = GlobalKey<FormBuilderState>();

return showDialog(context: context, builder: (BuildContext dContext) {
return Dialog(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
insetPadding: const EdgeInsets.all(20),
child: Padding(
padding: const EdgeInsets.all(15),
child: Wrap(
spacing: 10,
children: [
Padding(
padding: const EdgeInsets.only(bottom: 15),
child: Text(AppLocalizations.of(context)!.timeInMinutes, style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 17)),
),
const SizedBox(height: 10),
FormBuilder(
key: formKey,
autovalidateMode: AutovalidateMode.disabled,
child: Column(
children: [
FormBuilderTextField(
name: 'stepTime',
initialValue: (stepTime != null) ? stepTime.toString() : '0',
validator: FormBuilderValidators.compose([
FormBuilderValidators.required(),
FormBuilderValidators.integer()
]),
),
const SizedBox(height: 15),
Container(
alignment: Alignment.bottomRight,
child: MaterialButton(
color: Theme.of(context).primaryColor,
onPressed: () {
formKey.currentState!.setInternalFieldValue('stepIndex', stepIndex, isSetState: true);
formKey.currentState!.save();
if (formKey.currentState!.validate()) {
upsertStepTime(formKey.currentState!.value);
Navigator.pop(dContext);
}
},
child: Text(AppLocalizations.of(context)!.edit)
)
)
],
),
),
],
),
)
);
});
}
109 changes: 76 additions & 33 deletions lib/components/widgets/recipe_detail_tabbar_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:untare/models/ingredient.dart';
import 'package:untare/models/recipe.dart';
import 'package:untare/extensions/double_extension.dart';
import 'package:flutter_gen/gen_l10n/app_locales.dart';
import 'package:collapsible/collapsible.dart';

class RecipeDetailTabBarWidget extends StatefulWidget {
final Recipe recipe;
Expand Down Expand Up @@ -122,7 +123,7 @@ class RecipeDetailTabBarWidgetState extends State<RecipeDetailTabBarWidget> {

stepList.add(Padding(padding: const EdgeInsets.fromLTRB(20, 12, 15, 10), child: Text(widget.recipe.steps[i].instruction ?? '', style: const TextStyle(fontSize: 15))));

directionsSteps.add(directionStepLayout(context, Column(crossAxisAlignment: CrossAxisAlignment.start, children: stepList), i+1));
directionsSteps.add(directionStepLayout(context, Column(crossAxisAlignment: CrossAxisAlignment.start, children: stepList), i+1, widget.recipe.steps[i].time));
}

} else if (widget.recipe.steps.length == 1) {
Expand All @@ -146,7 +147,8 @@ class RecipeDetailTabBarWidgetState extends State<RecipeDetailTabBarWidget> {
directionStepLayout(
context,
Padding(padding: const EdgeInsets.fromLTRB(20, 12, 15, 10), child: Text(splitInstruction, style: const TextStyle(fontSize: 15))),
i+1
i+1,
widget.recipe.steps.first.time
)
);
}
Expand All @@ -165,41 +167,82 @@ class RecipeDetailTabBarWidgetState extends State<RecipeDetailTabBarWidget> {
}
}

Widget directionStepLayout(BuildContext context, Widget widget, int stepNumber) {
return Container(
alignment: Alignment.centerLeft,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 60,
alignment: Alignment.center,
margin: const EdgeInsets.only(bottom: 5),
child: Container(
height: 30,
width: 30,
alignment: Alignment.center,
Widget directionStepLayout(BuildContext context, Widget widget, int stepNumber, int? stepTime) {
bool collapsed = false;
return StatefulBuilder(builder: (context, setState) {
return Container(
alignment: Alignment.centerLeft,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Container(
width: 60,
alignment: Alignment.center,
margin: const EdgeInsets.only(bottom: 5),
child: Container(
height: 30,
width: 30,
alignment: Alignment.center,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(color: Theme.of(context).primaryColor, width: 2),
),
child:Text((stepNumber).toString(), style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Theme.of(context).primaryColor)),
)
),
if (stepTime != null && stepTime != 0)
Row(
children: [
Icon(Icons.timer_outlined, size: 15, color: (Theme.of(context).brightness.name == 'light') ? Colors.black45 : Colors.grey[600]!),
Text(
' $stepTime min',
style: TextStyle(
fontStyle: FontStyle.italic,
color: (Theme.of(context).brightness.name == 'light') ? Colors.black45 : Colors.grey[600]!,
fontSize: 15
)
)
],
)
],
),
IconButton(
icon: const Icon(Icons.check),
color: (collapsed) ? Theme.of(context).primaryColor : ((Theme.of(context).brightness.name == 'light') ? Colors.black45 : Colors.grey[600]!),
onPressed: () {
setState(() {
collapsed = !collapsed;
});
},
)
],
),
Container(
margin: const EdgeInsets.only(left: 30, bottom: 15),
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(color: Theme.of(context).primaryColor, width: 2),
border: Border(
left: BorderSide(
color: Theme.of(context).primaryColor,
width: 1
)
)
),
child: Collapsible(
collapsed: collapsed,
axis: CollapsibleAxis.vertical,
alignment: Alignment.topCenter,
child: widget,
),
child: Text((stepNumber).toString(), style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Theme.of(context).primaryColor)),
)
],
),
Container(
margin: const EdgeInsets.only(left: 30, bottom: 15),
decoration: BoxDecoration(
border: Border(
left: BorderSide(
color: Theme.of(context).primaryColor,
width: 1
)
)
),
child: widget,
)
],
),
);
}
);
}

Expand Down
Loading

0 comments on commit f77462f

Please sign in to comment.