diff --git a/lib/config_editor.dart b/lib/config_editor.dart index 1e49807..999544d 100644 --- a/lib/config_editor.dart +++ b/lib/config_editor.dart @@ -3,7 +3,9 @@ import "dart:io"; import "package:flutter/material.dart"; import "package:flutter_code_editor/flutter_code_editor.dart"; +import "package:flutter_highlight/themes/a11y-dark.dart" show a11yDarkTheme; import "package:flutter_riverpod/flutter_riverpod.dart"; +import "package:highlight/languages/yaml.dart" show yaml; import "dual_pane.dart"; import "utils.dart"; @@ -18,7 +20,7 @@ class ConfigEditor extends ConsumerStatefulWidget { } class _ConfigEditorState extends ConsumerState { - final codeController = CodeController(); + final codeController = CodeController(language: yaml); //Not HOCON, but close enough final vScrollController = ScrollController(); late File openConfig; @@ -66,14 +68,20 @@ class _ConfigEditorState extends ConsumerState { color: Colors.grey.shade900, child: SingleChildScrollView( controller: vScrollController, - child: CodeField( - background: Colors.grey.shade900, - onChanged: (_) => hasChanged = true, - textStyle: pixelCode, - controller: codeController, - minLines: null, - maxLines: null, - // expands: true, + child: CodeTheme( + data: CodeThemeData(styles: a11yDarkTheme), + child: CodeField( + gutterStyle: const GutterStyle( + showFoldingHandles: false, + ), + background: Colors.transparent, + onChanged: (_) => hasChanged = true, + textStyle: pixelCode, + controller: codeController, + minLines: null, + maxLines: null, + // expands: true, + ), ), ), ); diff --git a/pubspec.lock b/pubspec.lock index 9caa764..04e99ac 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -244,7 +244,7 @@ packages: source: hosted version: "0.3.2" flutter_highlight: - dependency: transitive + dependency: "direct main" description: name: flutter_highlight sha256: "7b96333867aa07e122e245c033b8ad622e4e3a42a1a2372cbb098a2541d8782c" @@ -302,7 +302,7 @@ packages: source: hosted version: "2.1.2" highlight: - dependency: transitive + dependency: "direct main" description: name: highlight sha256: "5353a83ffe3e3eca7df0abfb72dcf3fa66cc56b953728e7113ad4ad88497cf21" diff --git a/pubspec.yaml b/pubspec.yaml index a88965b..fe9aa56 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -35,7 +35,9 @@ dependencies: flutter: sdk: flutter flutter_code_editor: ^0.3.2 + flutter_highlight: ^0.7.0 flutter_riverpod: ^2.5.1 + highlight: ^0.7.0 path: ^1.9.0 rxdart: ^0.28.0 shared_preferences: ^2.3.2