Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
BertrandBev committed Nov 19, 2022
1 parent 9da2345 commit fed48e7
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions lib/src/code_field/code_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,21 @@ class CodeController extends TextEditingController {
notifyListeners();
}

Map<String, TextStyle>? _theme;
// Map<String, TextStyle>? _theme;

/// The theme to apply to the [language] parsing result
@Deprecated('Use CodeTheme widget to provide theme to CodeField.')
Map<String, TextStyle>? get theme => _theme;
// /// The theme to apply to the [language] parsing result
// @Deprecated('Use CodeTheme widget to provide theme to CodeField.')
// Map<String, TextStyle>? get theme => _theme;

@Deprecated('Use CodeTheme widget to provide theme to CodeField.')
set theme(Map<String, TextStyle>? theme) {
if (theme == _theme) {
return;
}
// @Deprecated('Use CodeTheme widget to provide theme to CodeField.')
// set theme(Map<String, TextStyle>? theme) {
// if (theme == _theme) {
// return;
// }

_theme = theme;
notifyListeners();
}
// _theme = theme;
// notifyListeners();
// }

/// A map of specific regexes to style
final Map<String, TextStyle>? patternMap;
Expand Down Expand Up @@ -80,8 +80,8 @@ class CodeController extends TextEditingController {
CodeController({
String? text,
Mode? language,
@Deprecated('Use CodeTheme widget to provide theme to CodeField.')
Map<String, TextStyle>? theme,
// @Deprecated('Use CodeTheme widget to provide theme to CodeField.')
// Map<String, TextStyle>? theme,
this.patternMap,
this.stringMap,
this.params = const EditorParams(),
Expand All @@ -91,8 +91,7 @@ class CodeController extends TextEditingController {
TabModifier(),
],
this.onChange,
}) : _theme = theme,
super(text: text) {
}) : super(text: text) {
this.language = language;

// Create modifier map
Expand Down Expand Up @@ -266,8 +265,7 @@ class CodeController extends TextEditingController {
void _traverse(Node node) {
var val = node.value;
final nodeChildren = node.children;
final nodeStyle =
widgetTheme?.styles[node.className] ?? _theme?[node.className];
final nodeStyle = widgetTheme?.styles[node.className];

if (val != null) {
var child = TextSpan(text: val, style: nodeStyle);
Expand Down

0 comments on commit fed48e7

Please sign in to comment.