You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by pa...@apache.org on 2022/10/27 03:13:17 UTC

[beam] branch master updated: Use Akvelon editor (#23415) (#23825)

This is an automated email from the ASF dual-hosted git repository.

pabloem 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 acd9cbeebc8 Use Akvelon editor (#23415) (#23825)
acd9cbeebc8 is described below

commit acd9cbeebc810106eb6f8825a4e85c67bcb8d8a7
Author: alexeyinkin <al...@akvelon.com>
AuthorDate: Thu Oct 27 07:13:10 2022 +0400

    Use Akvelon editor (#23415) (#23825)
    
    * Use Akvelon editor (#23415)
    
    * Upgrade Akvelon editor (#23415)
---
 learning/tour-of-beam/frontend/pubspec.lock        | 51 ++++++++++++++----
 learning/tour-of-beam/frontend/pubspec.yaml        |  4 --
 .../controllers/snippet_editing_controller.dart    |  2 +-
 .../playground_components/lib/src/theme/theme.dart |  4 +-
 .../lib/src/widgets/editor_textarea.dart           | 28 +++++-----
 .../frontend/playground_components/pubspec.yaml    |  5 +-
 playground/frontend/pubspec.lock                   | 60 ++++++++++++++++++----
 7 files changed, 111 insertions(+), 43 deletions(-)

diff --git a/learning/tour-of-beam/frontend/pubspec.lock b/learning/tour-of-beam/frontend/pubspec.lock
index f3d88fa9e0f..9983b9bb530 100644
--- a/learning/tour-of-beam/frontend/pubspec.lock
+++ b/learning/tour-of-beam/frontend/pubspec.lock
@@ -50,6 +50,13 @@ packages:
       url: "https://pub.dartlang.org"
     source: hosted
     version: "2.9.0"
+  autotrie:
+    dependency: transitive
+    description:
+      name: autotrie
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "2.0.0"
   boolean_selector:
     dependency: transitive
     description:
@@ -120,6 +127,13 @@ packages:
       url: "https://pub.dartlang.org"
     source: hosted
     version: "1.2.1"
+  charcode:
+    dependency: transitive
+    description:
+      name: charcode
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "1.3.1"
   checked_yaml:
     dependency: transitive
     description:
@@ -141,15 +155,6 @@ packages:
       url: "https://pub.dartlang.org"
     source: hosted
     version: "4.2.0"
-  code_text_field:
-    dependency: "direct main"
-    description:
-      path: "."
-      ref: "9e2c9fe52a69481f038f4b6609e8a0a776429437"
-      resolved-ref: "9e2c9fe52a69481f038f4b6609e8a0a776429437"
-      url: "https://github.com/BertrandBev/code_field.git"
-    source: git
-    version: "1.0.3"
   collection:
     dependency: transitive
     description:
@@ -267,6 +272,13 @@ packages:
     description: flutter
     source: sdk
     version: "0.0.0"
+  flutter_code_editor:
+    dependency: transitive
+    description:
+      name: flutter_code_editor
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "0.1.1"
   flutter_driver:
     dependency: transitive
     description: flutter
@@ -390,6 +402,13 @@ packages:
       url: "https://pub.dartlang.org"
     source: hosted
     version: "0.7.0"
+  hive:
+    dependency: transitive
+    description:
+      name: hive
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "2.2.3"
   http:
     dependency: "direct main"
     description:
@@ -668,6 +687,13 @@ packages:
       url: "https://pub.dartlang.org"
     source: hosted
     version: "0.27.5"
+  scrollable_positioned_list:
+    dependency: transitive
+    description:
+      name: scrollable_positioned_list
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "0.3.5"
   shared_preferences:
     dependency: "direct main"
     description:
@@ -834,6 +860,13 @@ packages:
       url: "https://pub.dartlang.org"
     source: hosted
     version: "2.17.4"
+  tuple:
+    dependency: transitive
+    description:
+      name: tuple
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "2.0.1"
   typed_data:
     dependency: transitive
     description:
diff --git a/learning/tour-of-beam/frontend/pubspec.yaml b/learning/tour-of-beam/frontend/pubspec.yaml
index da6c4c74ffa..a6e829542e0 100644
--- a/learning/tour-of-beam/frontend/pubspec.yaml
+++ b/learning/tour-of-beam/frontend/pubspec.yaml
@@ -28,10 +28,6 @@ environment:
 
 dependencies:
   app_state: ^0.8.1
-  code_text_field:
-    git:
-      url: https://github.com/BertrandBev/code_field.git
-      ref: 9e2c9fe52a69481f038f4b6609e8a0a776429437
   easy_localization: ^3.0.1
   easy_localization_ext: ^0.1.0
   easy_localization_loader: ^1.0.0
diff --git a/playground/frontend/playground_components/lib/src/controllers/snippet_editing_controller.dart b/playground/frontend/playground_components/lib/src/controllers/snippet_editing_controller.dart
index 9e36eed809b..1ff20ecfcd1 100644
--- a/playground/frontend/playground_components/lib/src/controllers/snippet_editing_controller.dart
+++ b/playground/frontend/playground_components/lib/src/controllers/snippet_editing_controller.dart
@@ -16,8 +16,8 @@
  * limitations under the License.
  */
 
-import 'package:code_text_field/code_text_field.dart';
 import 'package:flutter/widgets.dart';
+import 'package:flutter_code_editor/flutter_code_editor.dart';
 
 import '../enums/complexity.dart';
 import '../models/example.dart';
diff --git a/playground/frontend/playground_components/lib/src/theme/theme.dart b/playground/frontend/playground_components/lib/src/theme/theme.dart
index fed70dee36b..14c811abe93 100644
--- a/playground/frontend/playground_components/lib/src/theme/theme.dart
+++ b/playground/frontend/playground_components/lib/src/theme/theme.dart
@@ -16,8 +16,8 @@
  * limitations under the License.
  */
 
-import 'package:code_text_field/code_text_field.dart';
 import 'package:flutter/material.dart';
+import 'package:flutter_code_editor/flutter_code_editor.dart';
 import 'package:flutter_markdown/flutter_markdown.dart';
 import 'package:google_fonts/google_fonts.dart';
 
@@ -138,7 +138,6 @@ final kLightTheme = ThemeData(
       secondaryBackgroundColor: BeamLightThemeColors.secondaryBackground,
       codeBackgroundColor: BeamLightThemeColors.codeBackground,
       codeRootStyle: GoogleFonts.sourceCodePro(
-        backgroundColor: BeamLightThemeColors.primaryBackground,
         color: BeamLightThemeColors.text,
         fontSize: codeFontSize,
       ),
@@ -212,7 +211,6 @@ final kDarkTheme = ThemeData(
       secondaryBackgroundColor: BeamDarkThemeColors.secondaryBackground,
       codeBackgroundColor: BeamDarkThemeColors.codeBackground,
       codeRootStyle: GoogleFonts.sourceCodePro(
-        backgroundColor: BeamDarkThemeColors.primaryBackground,
         color: BeamDarkThemeColors.text,
         fontSize: codeFontSize,
       ),
diff --git a/playground/frontend/playground_components/lib/src/widgets/editor_textarea.dart b/playground/frontend/playground_components/lib/src/widgets/editor_textarea.dart
index 05231d0ee8b..9714177ec94 100644
--- a/playground/frontend/playground_components/lib/src/widgets/editor_textarea.dart
+++ b/playground/frontend/playground_components/lib/src/widgets/editor_textarea.dart
@@ -18,8 +18,8 @@
 
 // TODO(alexeyinkin): Refactor this, merge into snippet_editor.dart
 
-import 'package:code_text_field/code_text_field.dart';
 import 'package:flutter/material.dart';
+import 'package:flutter_code_editor/flutter_code_editor.dart';
 
 import '../models/example.dart';
 import '../models/sdk.dart';
@@ -58,7 +58,7 @@ class EditorTextArea extends StatefulWidget {
 
 class _EditorTextAreaState extends State<EditorTextArea> {
   var focusNode = FocusNode();
-  final GlobalKey codeFieldKey = LabeledGlobalKey('CodeFieldKey');
+  final GlobalKey _sizeKey = LabeledGlobalKey('CodeFieldKey');
 
   @override
   void dispose() {
@@ -82,16 +82,21 @@ class _EditorTextAreaState extends State<EditorTextArea> {
       readOnly: widget.enabled,
       label: 'widgets.codeEditor.label',
       child: FocusScope(
+        key: _sizeKey,
         node: FocusScopeNode(canRequestFocus: widget.isEditable),
         child: CodeTheme(
           data: ext.codeTheme,
-          child: CodeField(
-            key: codeFieldKey,
-            focusNode: focusNode,
-            enabled: widget.enabled,
-            controller: widget.codeController,
-            textStyle: ext.codeRootStyle,
-            expands: true,
+          child: Container(
+            color: ext.codeTheme.styles['root']?.backgroundColor,
+            child: SingleChildScrollView(
+              child: CodeField(
+                key: ValueKey(widget.codeController),
+                focusNode: focusNode,
+                enabled: widget.enabled,
+                controller: widget.codeController,
+                textStyle: ext.codeRootStyle,
+              ),
+            ),
           ),
         ),
       ),
@@ -137,9 +142,8 @@ class _EditorTextAreaState extends State<EditorTextArea> {
   }
 
   int _getQntOfStringsOnScreen() {
-    RenderBox rBox =
-        codeFieldKey.currentContext?.findRenderObject() as RenderBox;
-    double height = rBox.size.height * .75;
+    final renderBox = _sizeKey.currentContext!.findRenderObject()! as RenderBox;
+    final height = renderBox.size.height * .75;
 
     return height ~/ codeFontSize;
   }
diff --git a/playground/frontend/playground_components/pubspec.yaml b/playground/frontend/playground_components/pubspec.yaml
index 1a4c91197a0..27d09cc81da 100644
--- a/playground/frontend/playground_components/pubspec.yaml
+++ b/playground/frontend/playground_components/pubspec.yaml
@@ -26,16 +26,13 @@ environment:
 
 dependencies:
   aligned_dialog: ^0.0.6
-  code_text_field:
-    git:
-      url: https://github.com/BertrandBev/code_field.git
-      ref: 9e2c9fe52a69481f038f4b6609e8a0a776429437
   collection: ^1.16.0
   easy_localization: ^3.0.1
   easy_localization_ext: ^0.1.1
   easy_localization_loader: ^1.0.0
   equatable: ^2.0.5
   flutter: { sdk: flutter }
+  flutter_code_editor: ^0.1.2
   flutter_markdown: ^0.6.12
   flutter_svg: ^1.0.3
   google_fonts: ^3.0.1
diff --git a/playground/frontend/pubspec.lock b/playground/frontend/pubspec.lock
index 7b3186dbd6b..f9c577ab7df 100644
--- a/playground/frontend/pubspec.lock
+++ b/playground/frontend/pubspec.lock
@@ -50,6 +50,13 @@ packages:
       url: "https://pub.dartlang.org"
     source: hosted
     version: "2.9.0"
+  autotrie:
+    dependency: transitive
+    description:
+      name: autotrie
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "2.0.0"
   boolean_selector:
     dependency: transitive
     description:
@@ -148,15 +155,6 @@ packages:
       url: "https://pub.dartlang.org"
     source: hosted
     version: "4.1.0"
-  code_text_field:
-    dependency: transitive
-    description:
-      path: "."
-      ref: "9e2c9fe52a69481f038f4b6609e8a0a776429437"
-      resolved-ref: "9e2c9fe52a69481f038f4b6609e8a0a776429437"
-      url: "https://github.com/BertrandBev/code_field.git"
-    source: git
-    version: "1.0.3"
   collection:
     dependency: "direct main"
     description:
@@ -274,6 +272,13 @@ packages:
     description: flutter
     source: sdk
     version: "0.0.0"
+  flutter_code_editor:
+    dependency: transitive
+    description:
+      name: flutter_code_editor
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "0.1.2"
   flutter_highlight:
     dependency: transitive
     description:
@@ -293,6 +298,13 @@ packages:
     description: flutter
     source: sdk
     version: "0.0.0"
+  flutter_markdown:
+    dependency: transitive
+    description:
+      name: flutter_markdown
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "0.6.12"
   flutter_svg:
     dependency: "direct main"
     description:
@@ -359,6 +371,13 @@ packages:
       url: "https://pub.dartlang.org"
     source: hosted
     version: "0.7.0"
+  hive:
+    dependency: transitive
+    description:
+      name: hive
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "2.2.3"
   html:
     dependency: transitive
     description:
@@ -421,7 +440,7 @@ packages:
       name: json_annotation
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "4.5.0"
+    version: "4.7.0"
   linked_scroll_controller:
     dependency: transitive
     description:
@@ -443,6 +462,13 @@ packages:
       url: "https://pub.dartlang.org"
     source: hosted
     version: "1.0.2"
+  markdown:
+    dependency: transitive
+    description:
+      name: markdown
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "6.0.1"
   matcher:
     dependency: transitive
     description:
@@ -639,6 +665,13 @@ packages:
       url: "https://pub.dartlang.org"
     source: hosted
     version: "1.2.0"
+  scrollable_positioned_list:
+    dependency: transitive
+    description:
+      name: scrollable_positioned_list
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "0.3.5"
   shared_preferences:
     dependency: "direct main"
     description:
@@ -777,6 +810,13 @@ packages:
       url: "https://pub.dartlang.org"
     source: hosted
     version: "1.0.0"
+  tuple:
+    dependency: transitive
+    description:
+      name: tuple
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "2.0.1"
   typed_data:
     dependency: transitive
     description: