@@ -69,9 +69,6 @@ class CodeController extends TextEditingController {
69
69
/// A map of specific regexes to style
70
70
final Map <String , TextStyle >? patternMap;
71
71
72
- /// A map of specific keywords to style
73
- final Map <String , TextStyle >? stringMap;
74
-
75
72
/// Common editor params such as the size of a tab in spaces
76
73
///
77
74
/// Will be exposed to all [modifiers]
@@ -101,7 +98,6 @@ class CodeController extends TextEditingController {
101
98
102
99
final _styleList = < TextStyle > [];
103
100
final _modifierMap = < String , CodeModifier > {};
104
- RegExp ? _styleRegExp;
105
101
late PopupController popupController;
106
102
final autocompleter = Autocompleter ();
107
103
late final historyController = CodeHistoryController (codeController: this );
@@ -143,12 +139,9 @@ class CodeController extends TextEditingController {
143
139
this .namedSectionParser,
144
140
Set <String > readOnlySectionNames = const {},
145
141
Set <String > visibleSectionNames = const {},
146
- @Deprecated ('Use CodeTheme widget to provide theme to CodeField.' )
147
- Map <String , TextStyle >? theme,
148
142
this .analysisResult = const AnalysisResult (issues: []),
149
143
this .patternMap,
150
144
this .readOnly = false ,
151
- this .stringMap,
152
145
this .params = const EditorParams (),
153
146
this .modifiers = const [
154
147
IndentModifier (),
@@ -178,15 +171,10 @@ class CodeController extends TextEditingController {
178
171
179
172
// Build styleRegExp
180
173
final patternList = < String > [];
181
- if (stringMap != null ) {
182
- patternList.addAll (stringMap! .keys.map ((e) => r'(\b' + e + r'\b)' ));
183
- _styleList.addAll (stringMap! .values);
184
- }
185
174
if (patternMap != null ) {
186
175
patternList.addAll (patternMap! .keys.map ((e) => '($e )' ));
187
176
_styleList.addAll (patternMap! .values);
188
177
}
189
- _styleRegExp = RegExp (patternList.join ('|' ), multiLine: true );
190
178
191
179
popupController = PopupController (onCompletionSelected: insertSelectedWord);
192
180
@@ -911,47 +899,9 @@ class CodeController extends TextEditingController {
911
899
).build ();
912
900
}
913
901
914
- if (_styleRegExp != null ) {
915
- return _processPatterns (text, style);
916
- }
917
-
918
902
return TextSpan (text: text, style: style);
919
903
}
920
904
921
- TextSpan _processPatterns (String text, TextStyle ? style) {
922
- final children = < TextSpan > [];
923
-
924
- text.splitMapJoin (
925
- _styleRegExp! ,
926
- onMatch: (Match m) {
927
- if (_styleList.isEmpty) {
928
- return '' ;
929
- }
930
-
931
- int idx;
932
- for (idx = 1 ;
933
- idx < m.groupCount &&
934
- idx <= _styleList.length &&
935
- m.group (idx) == null ;
936
- idx++ ) {}
937
-
938
- children.add (
939
- TextSpan (
940
- text: m[0 ],
941
- style: _styleList[idx - 1 ],
942
- ),
943
- );
944
- return '' ;
945
- },
946
- onNonMatch: (String span) {
947
- children.add (TextSpan (text: span, style: style));
948
- return '' ;
949
- },
950
- );
951
-
952
- return TextSpan (style: style, children: children);
953
- }
954
-
955
905
CodeThemeData _getTheme (BuildContext context) {
956
906
return CodeTheme .of (context) ?? CodeThemeData ();
957
907
}
0 commit comments