-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontext.dart
66 lines (58 loc) · 2.07 KB
/
context.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
60
61
62
63
64
65
66
import 'dart:ui';
const _black = Color(0xFF000000);
const _grey = Color(0xFF607D8B);
const _transparent = Color(0x00000000);
const _white = Color(0xFFFFFFFF);
class TabContext {
final Color backgroundColor;
final Paint chartFillPaint;
final Paint chartStrokePaint;
final Color labelTextColor;
final Paint noteLabelPaint;
final Paint noteShapePaint;
final Paint techniquePaint;
TabContext(
{this.backgroundColor = _transparent,
required Color chartColor,
required this.labelTextColor,
required Color noteLabelColor,
required Color noteShapeColor,
required Color techniqueColor})
: chartFillPaint = Paint()
..color = chartColor
..style = PaintingStyle.fill,
chartStrokePaint = Paint()
..color = chartColor
..strokeWidth = 1
..style = PaintingStyle.stroke,
noteLabelPaint = Paint()
..color = noteLabelColor
..strokeWidth = 2
..style = PaintingStyle.stroke,
noteShapePaint = Paint()
..color = noteShapeColor
..style = PaintingStyle.fill,
techniquePaint = Paint()
..color = techniqueColor
..strokeWidth = 2
..style = PaintingStyle.stroke;
factory TabContext.forBrightness(Brightness brightness) {
const backgroundColor = _transparent;
const chartColor = _grey;
final labelColor = brightness == Brightness.dark ? _white : _black;
final noteLabelColor = brightness == Brightness.dark ? _black : _white;
final noteShapeColor = brightness == Brightness.dark ? _white : _black;
const techniqueColor = _grey;
return TabContext(
backgroundColor: backgroundColor,
chartColor: chartColor,
labelTextColor: labelColor,
noteLabelColor: noteLabelColor,
noteShapeColor: noteShapeColor,
techniqueColor: techniqueColor);
}
Color get chartColor => chartFillPaint.color;
Color get noteLabelColor => noteLabelPaint.color;
Color get noteShapeColor => noteShapePaint.color;
Color get techniqueColor => techniquePaint.color;
}