forked from akvelon/flutter-code-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcode_theme_data.dart
59 lines (48 loc) · 1.26 KB
/
code_theme_data.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import 'package:flutter/widgets.dart';
@immutable
class CodeThemeData {
final Map<String, TextStyle> styles;
CodeThemeData({
Map<String, TextStyle>? styles,
TextStyle? classStyle,
TextStyle? commentStyle,
TextStyle? functionStyle,
TextStyle? keywordStyle,
TextStyle? paramsStyle,
TextStyle? quoteStyle,
TextStyle? titleStyle,
TextStyle? variableStyle,
}) : styles = styles ?? {} {
if (classStyle != null) {
this.styles['class'] = classStyle;
}
if (commentStyle != null) {
this.styles['comment'] = commentStyle;
}
if (functionStyle != null) {
this.styles['function'] = functionStyle;
}
if (keywordStyle != null) {
this.styles['keyword'] = keywordStyle;
}
if (paramsStyle != null) {
this.styles['params'] = paramsStyle;
}
if (quoteStyle != null) {
this.styles['quote'] = quoteStyle;
}
if (titleStyle != null) {
this.styles['title'] = titleStyle;
}
if (variableStyle != null) {
this.styles['variable'] = variableStyle;
}
}
@override
int get hashCode => styles.hashCode;
@override
bool operator ==(Object other) {
return identical(this, other) ||
other is CodeThemeData && styles == other.styles;
}
}