Skip to content

Commit

Permalink
Rename 'readonly' to 'readOnly' in CodeController, bump version to v0…
Browse files Browse the repository at this point in the history
….2.23
  • Loading branch information
alexeyinkin committed May 5, 2023
1 parent f97d6c5 commit b4e7714
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
## 0.2.23

* Added `CodeController.readOnly`.

## 0.2.22

* Fixed most of the search bugs (Issue [228](https://github.com/akvelon/flutter-code-editor/issues/228)).
* Added `CodeController.readOnly`.

## 0.2.21

Expand Down
8 changes: 4 additions & 4 deletions lib/src/code_field/code_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class CodeController extends TextEditingController {
/// Makes the text un-editable, but allows to set the full text.
/// Focusing and moving the selection inside of a [CodeField] will
/// still be possible.
final bool readonly;
final bool readOnly;

String get languageId => _languageId;

Expand Down Expand Up @@ -147,7 +147,7 @@ class CodeController extends TextEditingController {
Map<String, TextStyle>? theme,
this.analysisResult = const AnalysisResult(issues: []),
this.patternMap,
this.readonly = false,
this.readOnly = false,
this.stringMap,
this.params = const EditorParams(),
this.modifiers = const [
Expand Down Expand Up @@ -654,7 +654,7 @@ class CodeController extends TextEditingController {
void modifySelectedLines(
String Function(String line) modifierCallback,
) {
if (readonly) {
if (readOnly) {
return;
}

Expand Down Expand Up @@ -733,7 +733,7 @@ class CodeController extends TextEditingController {
Code get code => _code;

CodeEditResult? _getEditResultNotBreakingReadOnly(TextEditingValue newValue) {
if (readonly) {
if (readOnly) {
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/src/code_field/code_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class CodeField extends StatefulWidget {
/// {@macro flutter.widgets.editableText.readOnly}
///
/// This is just passed as a parameter to a [TextField].
/// See also [CodeController.readonly].
/// See also [CodeController.readOnly].
final bool readOnly;

final Color? background;
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_code_editor
description: A customizable code field supporting syntax highlighting and code folding.
version: 0.2.22
version: 0.2.23
repository: https://github.com/akvelon/flutter-code-editor

environment:
Expand Down
4 changes: 2 additions & 2 deletions test/src/code_field/code_controller_readonly_field_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import 'package:flutter_code_editor/flutter_code_editor.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
group('CodeController.readonly', () {
group('CodeController.readOnly', () {
test('Setting readonly restricts modification of text', () {
const initialText = 'Aaa\nAaaa';
final controller = CodeController(
text: initialText,
readonly: true,
readOnly: true,
);

controller.value = const TextEditingValue(
Expand Down

0 comments on commit b4e7714

Please sign in to comment.