Skip to content

Commit

Permalink
Config editor colours!
Browse files Browse the repository at this point in the history
  • Loading branch information
TechnicJelle committed Sep 4, 2024
1 parent dbda747 commit a371e4c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
26 changes: 17 additions & 9 deletions lib/config_editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -18,7 +20,7 @@ class ConfigEditor extends ConsumerStatefulWidget {
}

class _ConfigEditorState extends ConsumerState<ConfigEditor> {
final codeController = CodeController();
final codeController = CodeController(language: yaml); //Not HOCON, but close enough
final vScrollController = ScrollController();

late File openConfig;
Expand Down Expand Up @@ -66,14 +68,20 @@ class _ConfigEditorState extends ConsumerState<ConfigEditor> {
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,
),
),
),
);
Expand Down
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ packages:
source: hosted
version: "0.3.2"
flutter_highlight:
dependency: transitive
dependency: "direct main"
description:
name: flutter_highlight
sha256: "7b96333867aa07e122e245c033b8ad622e4e3a42a1a2372cbb098a2541d8782c"
Expand Down Expand Up @@ -302,7 +302,7 @@ packages:
source: hosted
version: "2.1.2"
highlight:
dependency: transitive
dependency: "direct main"
description:
name: highlight
sha256: "5353a83ffe3e3eca7df0abfb72dcf3fa66cc56b953728e7113ad4ad88497cf21"
Expand Down
2 changes: 2 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a371e4c

Please sign in to comment.