Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Akvelon editor (#23415) #23825

Merged
merged 2 commits into from
Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was brought by https://pub.dev/packages/autotrie
and will be tree-shaken away.

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