This is an automated email from the ASF dual-hosted git repository. damccorm pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push: new 4a09ea94727 [Tour of Beam] [Frontend] Markdown selection fix (#26496) 4a09ea94727 is described below commit 4a09ea94727120596750edb8ce0127c12059c692 Author: Darkhan Nausharipov <31556582+naushari...@users.noreply.github.com> AuthorDate: Wed May 3 19:47:20 2023 +0600 [Tour of Beam] [Frontend] Markdown selection fix (#26496) * flutter_markdown_selectionarea (#26452) * todo (#26452) * Change the displayed name of user snippets (#26452) * comments (#26452) * Improve comments (#26452) * pubspec lock --------- Co-authored-by: darkhan.nausharipov <darkhan.naushari...@kzn.akvelon.com> Co-authored-by: Alexey Inkin <alexey.in...@akvelon.com> --- .../pages/tour/widgets/markdown/code_builder.dart | 2 +- .../pages/tour/widgets/markdown/tob_markdown.dart | 33 +++++++++++----------- learning/tour-of-beam/frontend/pubspec.lock | 8 +++--- learning/tour-of-beam/frontend/pubspec.yaml | 7 ++++- .../assets/translations/en.yaml | 2 +- .../lib/src/cache/example_cache.dart | 3 +- .../lib/src/controllers/playground_controller.dart | 2 +- .../playground_components/lib/src/theme/theme.dart | 2 +- .../frontend/playground_components/pubspec.yaml | 7 ++++- playground/frontend/pubspec.lock | 8 +++--- 10 files changed, 43 insertions(+), 31 deletions(-) diff --git a/learning/tour-of-beam/frontend/lib/pages/tour/widgets/markdown/code_builder.dart b/learning/tour-of-beam/frontend/lib/pages/tour/widgets/markdown/code_builder.dart index 2eaabc10a50..b770f777a7e 100644 --- a/learning/tour-of-beam/frontend/lib/pages/tour/widgets/markdown/code_builder.dart +++ b/learning/tour-of-beam/frontend/lib/pages/tour/widgets/markdown/code_builder.dart @@ -17,7 +17,7 @@ */ import 'package:flutter/material.dart'; -import 'package:flutter_markdown/flutter_markdown.dart'; +import 'package:flutter_markdown_selectionarea/flutter_markdown_selectionarea.dart'; import 'package:markdown/markdown.dart' as md; import 'package:playground_components/playground_components.dart'; diff --git a/learning/tour-of-beam/frontend/lib/pages/tour/widgets/markdown/tob_markdown.dart b/learning/tour-of-beam/frontend/lib/pages/tour/widgets/markdown/tob_markdown.dart index dcbf11d8efa..0e6557f9852 100644 --- a/learning/tour-of-beam/frontend/lib/pages/tour/widgets/markdown/tob_markdown.dart +++ b/learning/tour-of-beam/frontend/lib/pages/tour/widgets/markdown/tob_markdown.dart @@ -17,7 +17,7 @@ */ import 'package:flutter/material.dart'; -import 'package:flutter_markdown/flutter_markdown.dart'; +import 'package:flutter_markdown_selectionarea/flutter_markdown_selectionarea.dart'; import 'package:playground_components/playground_components.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -38,21 +38,22 @@ class TobMarkdown extends StatelessWidget { @override Widget build(BuildContext context) { - return Markdown( - data: data.tabsToSpaces(_spaceCount), - builders: { - 'code': MarkdownCodeBuilder(), - }, - onTapLink: (text, url, title) async { - if (url != null) { - await launchUrl(Uri.parse(url)); - } - }, - padding: padding, - selectable: true, - shrinkWrap: shrinkWrap, - styleSheet: - Theme.of(context).extension<BeamThemeExtension>()!.markdownStyle, + return SelectionArea( + child: Markdown( + data: data.tabsToSpaces(_spaceCount), + builders: { + 'code': MarkdownCodeBuilder(), + }, + onTapLink: (text, url, title) async { + if (url != null) { + await launchUrl(Uri.parse(url)); + } + }, + padding: padding, + shrinkWrap: shrinkWrap, + styleSheet: + Theme.of(context).extension<BeamThemeExtension>()!.markdownStyle, + ), ); } } diff --git a/learning/tour-of-beam/frontend/pubspec.lock b/learning/tour-of-beam/frontend/pubspec.lock index 08713d667b1..7f071d272f0 100644 --- a/learning/tour-of-beam/frontend/pubspec.lock +++ b/learning/tour-of-beam/frontend/pubspec.lock @@ -496,14 +496,14 @@ packages: description: flutter source: sdk version: "0.0.0" - flutter_markdown: + flutter_markdown_selectionarea: dependency: "direct main" description: - name: flutter_markdown - sha256: "7b25c10de1fea883f3c4f9b8389506b54053cd00807beab69fd65c8653a2711f" + name: flutter_markdown_selectionarea + sha256: "4ce7f7eb337d75afcb8613f49e484ffc561e695b5369ff588b6549e422078569" url: "https://pub.dev" source: hosted - version: "0.6.14" + version: "0.6.14+3" flutter_svg: dependency: "direct main" description: diff --git a/learning/tour-of-beam/frontend/pubspec.yaml b/learning/tour-of-beam/frontend/pubspec.yaml index df297d075c4..bcefe4d2fcb 100644 --- a/learning/tour-of-beam/frontend/pubspec.yaml +++ b/learning/tour-of-beam/frontend/pubspec.yaml @@ -38,7 +38,12 @@ dependencies: firebase_auth_platform_interface: ^6.11.7 firebase_core: ^2.1.1 flutter: { sdk: flutter } - flutter_markdown: ^0.6.12 + + # TODO(nausharipov): return flutter_markdown when it is fixed, https://github.com/apache/beam/issues/26498 + # The exact version is used because this non-official package can be poorly maintained. + # Same in playground_components. + flutter_markdown_selectionarea: 0.6.14+3 + flutter_svg: ^2.0.1 get_it: ^7.2.0 google_fonts: ^4.0.3 diff --git a/playground/frontend/playground_components/assets/translations/en.yaml b/playground/frontend/playground_components/assets/translations/en.yaml index 565017e997c..8b670fc1294 100644 --- a/playground/frontend/playground_components/assets/translations/en.yaml +++ b/playground/frontend/playground_components/assets/translations/en.yaml @@ -31,7 +31,7 @@ errors: examples: defaultTitle: 'Catalog' - userSharedName: 'User Shared Code' + userSharedName: 'User Snippet' ui: copyright: '© The Apache Software Foundation' diff --git a/playground/frontend/playground_components/lib/src/cache/example_cache.dart b/playground/frontend/playground_components/lib/src/cache/example_cache.dart index 6582ba7ee14..af0147a8fa6 100644 --- a/playground/frontend/playground_components/lib/src/cache/example_cache.dart +++ b/playground/frontend/playground_components/lib/src/cache/example_cache.dart @@ -19,6 +19,7 @@ import 'dart:async'; import 'package:collection/collection.dart'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/foundation.dart'; import '../exceptions/catalog_loading_exception.dart'; @@ -134,7 +135,7 @@ class ExampleCache extends ChangeNotifier { return Example( complexity: result.complexity, files: result.files, - name: 'User Snippet', + name: 'examples.userSharedName'.tr(), isMultiFile: result.files.length > 1, path: id, sdk: result.sdk, diff --git a/playground/frontend/playground_components/lib/src/controllers/playground_controller.dart b/playground/frontend/playground_components/lib/src/controllers/playground_controller.dart index 74eb34b673b..533ee35262f 100644 --- a/playground/frontend/playground_components/lib/src/controllers/playground_controller.dart +++ b/playground/frontend/playground_components/lib/src/controllers/playground_controller.dart @@ -289,7 +289,7 @@ class PlaygroundController with ChangeNotifier { final sharedExample = Example( datasets: snippetController.example?.datasets ?? [], files: files, - name: files.first.name, + name: 'examples.userSharedName'.tr(), path: snippetId, sdk: snippetController.sdk, type: ExampleType.example, diff --git a/playground/frontend/playground_components/lib/src/theme/theme.dart b/playground/frontend/playground_components/lib/src/theme/theme.dart index 9709b21492f..71790e0f9ef 100644 --- a/playground/frontend/playground_components/lib/src/theme/theme.dart +++ b/playground/frontend/playground_components/lib/src/theme/theme.dart @@ -18,7 +18,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_code_editor/flutter_code_editor.dart'; -import 'package:flutter_markdown/flutter_markdown.dart'; +import 'package:flutter_markdown_selectionarea/flutter_markdown.dart'; import 'package:google_fonts/google_fonts.dart'; import '../../playground_components.dart'; diff --git a/playground/frontend/playground_components/pubspec.yaml b/playground/frontend/playground_components/pubspec.yaml index 4dfe7ff0d2f..4329ad9ef3e 100644 --- a/playground/frontend/playground_components/pubspec.yaml +++ b/playground/frontend/playground_components/pubspec.yaml @@ -37,7 +37,12 @@ dependencies: equatable: ^2.0.5 flutter: { sdk: flutter } flutter_code_editor: ^0.2.20 - flutter_markdown: ^0.6.12 + + # TODO(nausharipov): return flutter_markdown when it is fixed, https://github.com/apache/beam/issues/26498 + # The exact version is used because this non-official package can be poorly maintained. + # Same in Tour of Beam's file. + flutter_markdown_selectionarea: 0.6.14+3 + flutter_svg: ^2.0.1 fluttertoast: ^8.1.1 get_it: ^7.2.0 diff --git a/playground/frontend/pubspec.lock b/playground/frontend/pubspec.lock index d676e72c7c5..22213b56777 100644 --- a/playground/frontend/pubspec.lock +++ b/playground/frontend/pubspec.lock @@ -432,14 +432,14 @@ packages: description: flutter source: sdk version: "0.0.0" - flutter_markdown: + flutter_markdown_selectionarea: dependency: transitive description: - name: flutter_markdown - sha256: "7b25c10de1fea883f3c4f9b8389506b54053cd00807beab69fd65c8653a2711f" + name: flutter_markdown_selectionarea + sha256: "4ce7f7eb337d75afcb8613f49e484ffc561e695b5369ff588b6549e422078569" url: "https://pub.dev" source: hosted - version: "0.6.14" + version: "0.6.14+3" flutter_svg: dependency: "direct main" description: