Skip to content

Commit

Permalink
Fix after review (apache#24613)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyinkin committed Dec 15, 2022
1 parent 8657893 commit 9a5192a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ class SnippetEditingController extends ChangeNotifier {
}

void _toStartOfFullLine(int line) {
if (line >= codeController.code.lines.length) {
return;
}

final fullPosition = codeController.code.lines.lines[line].textRange.start;
final visiblePosition = codeController.code.hiddenRanges.cutPosition(
fullPosition,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,16 @@ class _SnippetEditorState extends State<SnippetEditor> {
@override
Widget build(BuildContext context) {
final ext = Theme.of(context).extension<BeamThemeExtension>()!;
final isMultifile = widget.controller.selectedExample?.isMultiFile ?? false;
final isEnabled = widget.isEditable && !isMultifile;
final isMultiFile = widget.controller.selectedExample?.isMultiFile ?? false;
final isEnabled = widget.isEditable && !isMultiFile;

return Semantics(
container: true,
textField: true,
multiline: true,
enabled: isEnabled,
readOnly: isEnabled,
label: 'widgets.codeEditor.label',
multiline: true,
readOnly: isEnabled,
textField: true,
child: FocusScope(
node: FocusScopeNode(canRequestFocus: isEnabled),
child: CodeTheme(
Expand All @@ -106,9 +106,9 @@ class _SnippetEditorState extends State<SnippetEditor> {
controller: _scrollController,
child: CodeField(
key: ValueKey(widget.controller.codeController),
focusNode: _focusNode,
enabled: isEnabled,
controller: widget.controller.codeController,
enabled: isEnabled,
focusNode: _focusNode,
textStyle: ext.codeRootStyle,
),
),
Expand Down

0 comments on commit 9a5192a

Please sign in to comment.