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 #42 from phantomate/dev
Browse files Browse the repository at this point in the history
Add markdown support
  • Loading branch information
phantomate authored Jul 30, 2023
2 parents 0ed124c + fe77786 commit 02463a8
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/components/widgets/recipe_detail_tabbar_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:untare/extensions/double_extension.dart';
import 'package:flutter_gen/gen_l10n/app_locales.dart';
import 'package:collapsible/collapsible.dart';
import 'package:fraction/fraction.dart';
import 'package:flutter_markdown/flutter_markdown.dart';

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

stepList.addAll(recipe.steps[i].ingredients.map((item) => ingredientComponent(item, servings, newServings, true, context)).toList());

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

directionsSteps.add(directionStepLayout(context, Column(crossAxisAlignment: CrossAxisAlignment.start, children: stepList), i+1, recipe.steps[i].time, recipe.steps[i].name));
}
Expand All @@ -149,7 +155,12 @@ class RecipeDetailTabBarWidgetState extends State<RecipeDetailTabBarWidget> {
directionsSteps.add(
directionStepLayout(
context,
Padding(padding: const EdgeInsets.fromLTRB(20, 12, 15, 10), child: Text(splitInstruction, style: const TextStyle(fontSize: 15))),
Padding(
padding: const EdgeInsets.fromLTRB(20, 12, 15, 10),
child: MarkdownBody(
data: splitInstruction,
styleSheet: MarkdownStyleSheet(
p: const TextStyle(fontSize: 15)))),
i+1,
recipe.steps.first.time,
recipe.steps.first.name
Expand Down
16 changes: 16 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,14 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_markdown:
dependency: "direct main"
description:
name: flutter_markdown
sha256: dc6d5258653f6857135b32896ccda7f7af0c54dcec832495ad6835154c6c77c0
url: "https://pub.dev"
source: hosted
version: "0.6.15"
flutter_phoenix:
dependency: "direct main"
description:
Expand Down Expand Up @@ -726,6 +734,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.1.1"
markdown:
dependency: transitive
description:
name: markdown
sha256: acf35edccc0463a9d7384e437c015a3535772e09714cf60e07eeef3a15870dcd
url: "https://pub.dev"
source: hosted
version: "7.1.1"
matcher:
dependency: transitive
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ dependencies:
collapsible: ^1.0.0
share_plus: ^6.3.1
fraction: ^4.1.4
flutter_markdown: ^0.6.15

dependency_overrides:
flutter_chips_input:
Expand Down

0 comments on commit 02463a8

Please sign in to comment.