Skip to content

Commit

Permalink
Rename a widget (apache#24613)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyinkin committed Dec 15, 2022
1 parent 401b098 commit d7cb6c7
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class EmbeddedEditor extends StatelessWidget {
return const LoadingIndicator();
}

return EditorTextArea(
return SnippetEditor(
controller: snippetController,
isEditable: isEditable,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class CodeTextAreaWrapper extends StatelessWidget {
child: Stack(
children: [
Positioned.fill(
child: EditorTextArea(
child: SnippetEditor(
controller: snippetController,
isEditable: true,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export 'src/widgets/clickable.dart';
export 'src/widgets/complexity.dart';
export 'src/widgets/dismissible_overlay.dart';
export 'src/widgets/divider.dart';
export 'src/widgets/editor_text_area.dart';
export 'src/widgets/header_icon_button.dart';
export 'src/widgets/loading_error.dart';
export 'src/widgets/loading_indicator.dart';
Expand All @@ -76,6 +75,7 @@ export 'src/widgets/reset_button.dart';
export 'src/widgets/run_or_cancel_button.dart';
export 'src/widgets/shortcut_tooltip.dart';
export 'src/widgets/shortcuts_manager.dart';
export 'src/widgets/snippet_editor.dart';
export 'src/widgets/split_view.dart';
export 'src/widgets/tab_header.dart';
export 'src/widgets/toasts/toast_listener.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ extension ExampleTypeToString on ExampleType {
class ExampleBase with Comparable<ExampleBase>, EquatableMixin {
final Complexity? complexity;

// Index of the line to focus, 1-based.
/// Index of the line to focus, 1-based.
final int contextLine;
final String description;
final bool isMultiFile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
* limitations under the License.
*/

// TODO(alexeyinkin): Refactor this, merge into snippet_editor.dart

import 'dart:math';

import 'package:flutter/material.dart';
Expand All @@ -27,11 +25,11 @@ import 'package:flutter_code_editor/flutter_code_editor.dart';
import '../controllers/snippet_editing_controller.dart';
import '../theme/theme.dart';

class EditorTextArea extends StatefulWidget {
class SnippetEditor extends StatefulWidget {
final SnippetEditingController controller;
final bool isEditable;

EditorTextArea({
SnippetEditor({
required this.controller,
required this.isEditable,
}) : super(
Expand All @@ -40,14 +38,13 @@ class EditorTextArea extends StatefulWidget {
);

@override
State<EditorTextArea> createState() => _EditorTextAreaState();
State<SnippetEditor> createState() => _SnippetEditorState();
}

class _EditorTextAreaState extends State<EditorTextArea> {
class _SnippetEditorState extends State<SnippetEditor> {
bool _didAutoFocus = false;
final _focusNode = FocusNode();
final _scrollController = ScrollController();
final _sizeKey = LabeledGlobalKey('CodeFieldKey');

@override
void didChangeDependencies() {
Expand Down Expand Up @@ -100,7 +97,6 @@ class _EditorTextAreaState extends State<EditorTextArea> {
readOnly: isEnabled,
label: 'widgets.codeEditor.label',
child: FocusScope(
key: _sizeKey,
node: FocusScopeNode(canRequestFocus: isEnabled),
child: CodeTheme(
data: ext.codeTheme,
Expand Down

0 comments on commit d7cb6c7

Please sign in to comment.