Skip to content

Commit

Permalink
Use Akvelon editor (apache#23415) (apache#23825)
Browse files Browse the repository at this point in the history
* Use Akvelon editor (apache#23415)

* Upgrade Akvelon editor (apache#23415)
  • Loading branch information
alexeyinkin authored and ryanthompson592 committed Oct 28, 2022
1 parent 4cf9fbb commit 37d7687
Show file tree
Hide file tree
Showing 7 changed files with 111 additions and 43 deletions.
51 changes: 42 additions & 9 deletions learning/tour-of-beam/frontend/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 0 additions & 4 deletions learning/tour-of-beam/frontend/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -138,7 +138,6 @@ final kLightTheme = ThemeData(
secondaryBackgroundColor: BeamLightThemeColors.secondaryBackground,
codeBackgroundColor: BeamLightThemeColors.codeBackground,
codeRootStyle: GoogleFonts.sourceCodePro(
backgroundColor: BeamLightThemeColors.primaryBackground,
color: BeamLightThemeColors.text,
fontSize: codeFontSize,
),
Expand Down Expand Up @@ -212,7 +211,6 @@ final kDarkTheme = ThemeData(
secondaryBackgroundColor: BeamDarkThemeColors.secondaryBackground,
codeBackgroundColor: BeamDarkThemeColors.codeBackground,
codeRootStyle: GoogleFonts.sourceCodePro(
backgroundColor: BeamDarkThemeColors.primaryBackground,
color: BeamDarkThemeColors.text,
fontSize: codeFontSize,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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() {
Expand All @@ -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,
),
),
),
),
),
Expand Down Expand Up @@ -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;
}
Expand Down
5 changes: 1 addition & 4 deletions playground/frontend/playground_components/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
60 changes: 50 additions & 10 deletions playground/frontend/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 37d7687

Please sign in to comment.