Skip to content

Commit 4bd8f8f

Browse files
authored
Merge pull request #17 from DutchCodingCompany/feature/sync-kleurplaat
Feature/sync kleurplaat
2 parents 14e8d1e + 4e318a7 commit 4bd8f8f

14 files changed

+163
-67
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 0.0.10
2+
Improved kleurplaat
3+
4+
## 0.0.9
5+
Added kleurplaat
6+
17
## 0.0.6
28

39
* :sparkles: Added new version of Result for mapping API responses

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ packages:
212212
path: ".."
213213
relative: true
214214
source: path
215-
version: "0.0.7"
215+
version: "0.0.10"
216216
equatable:
217217
dependency: transitive
218218
description:
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import 'package:flutter/material.dart';
2+
3+
/// LinkStyle extension for [TextTheme].
4+
extension LinkStyle on TextTheme {
5+
/// Link style for small text.
6+
TextStyle get linkSmall => bodySmall!.copyWith(
7+
fontWeight: FontWeight.bold,
8+
decoration: TextDecoration.underline,
9+
);
10+
11+
/// Link style for medium text.
12+
TextStyle get linkMedium => bodyMedium!.copyWith(
13+
fontWeight: FontWeight.bold,
14+
decoration: TextDecoration.underline,
15+
);
16+
17+
/// Link style for large text.
18+
TextStyle get linkLarge => bodyLarge!.copyWith(
19+
fontWeight: FontWeight.bold,
20+
decoration: TextDecoration.underline,
21+
);
22+
}

lib/dcc_toolkit.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export 'common/dimensions.dart';
33
export 'common/extensions/build_context.dart';
44
export 'common/extensions/color.dart';
55
export 'common/extensions/iterable.dart';
6+
export 'common/extensions/text_theme.dart';
67
export 'common/result/result.dart';
78
export 'logger/bolt_logger.dart';
89
export 'style/style.dart';

lib/style/interface/color_group_interface.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ abstract interface class ColorGroupInterface<T> {
1212
/// {@template on_color}
1313
/// The color on the foreground. Usually on top of the [color].
1414
/// {@endtemplate}
15-
T get onColor;
15+
T get onColorContrast;
1616

1717
/// {@template on_color_subtle}
1818
/// The color on the foreground, but more subtle. Usually on top of the [color].

lib/style/interface/kleurplaat_interface.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,9 @@ abstract interface class KleurplaatInterface<T> {
5050
/// The surface group.
5151
/// {@endtemplate}
5252
SurfaceGroupInterface<T> get surface;
53+
54+
/// {@template surface}
55+
/// The surface inverse group.
56+
/// {@endtemplate}
57+
SurfaceGroupInterface<T>? get surfaceInverse;
5358
}

lib/style/interface/surface_group_interface.dart

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,22 @@ abstract interface class SurfaceGroupInterface<T> {
1212
/// {@template onColorContrastPlus}
1313
/// The color on the surface with a higher contrast.
1414
/// {@endtemplate}
15-
T get onColorContrastPlus;
15+
T get onColorContrast;
1616

1717
/// {@template onColorContrastMinus}
1818
/// The color on the surface with a lower contrast.
1919
/// {@endtemplate}
20-
T get onColorContrastMinus;
20+
T get onColorContrastDim;
2121

2222
/// {@template onColorSubtlePlus}
2323
/// The color on the surface with a higher contrast, but more subtle.
2424
/// {@endtemplate}
25-
T get onColorSubtlePlus;
25+
T get onColorSubtle;
2626

2727
/// {@template onColorSubtleMinus}
2828
/// The color on the surface with a lower contrast, but more subtle.
2929
/// {@endtemplate}
30-
T get onColorSubtleMinus;
30+
T get onColorSubtleDim;
3131

3232
/// {@template containerLowest}
3333
/// The color of the lowest container.
@@ -54,6 +54,11 @@ abstract interface class SurfaceGroupInterface<T> {
5454
/// {@endtemplate}
5555
T get containerHighest;
5656

57+
/// {@template link}
58+
/// The color of the link.
59+
/// {@endtemplate}
60+
T get link;
61+
5762
/// Linearly interpolate with another object.
5863
SurfaceGroupInterface<T> lerp(
5964
covariant SurfaceGroupInterface<T>? other,

lib/style/kleurplaat/color_group.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ class ColorGroup implements ColorGroupInterface<Color> {
77
/// {@macro color_group}
88
const ColorGroup({
99
required this.color,
10-
required this.onColor,
10+
required this.onColorContrast,
1111
this.onColorSubtle,
1212
});
1313

1414
@override
1515
final Color color;
1616

1717
@override
18-
final Color onColor;
18+
final Color onColorContrast;
1919

2020
@override
2121
final Color? onColorSubtle;
@@ -28,7 +28,8 @@ class ColorGroup implements ColorGroupInterface<Color> {
2828

2929
return ColorGroup(
3030
color: Color.lerp(color, other.color, t) ?? color,
31-
onColor: Color.lerp(onColor, other.onColor, t) ?? onColor,
31+
onColorContrast: Color.lerp(onColorContrast, other.onColorContrast, t) ??
32+
onColorContrast,
3233
onColorSubtle: onColorSubtle == null || other.onColorSubtle == null
3334
? null
3435
: Color.lerp(onColorSubtle, other.onColorSubtle, t),

lib/style/kleurplaat/katjas_kleurplaat.dart

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat>
1717
required this.success,
1818
required this.successFill,
1919
required this.surface,
20+
required this.surfaceInverse,
2021
});
2122

2223
@override
@@ -46,6 +47,9 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat>
4647
@override
4748
final SurfaceGroup surface;
4849

50+
@override
51+
final SurfaceGroup? surfaceInverse;
52+
4953
@override
5054
ThemeExtension<KatjasKleurplaat> copyWith({
5155
ColorGroup? primary,
@@ -57,6 +61,7 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat>
5761
ColorGroup? success,
5862
ColorGroup? successFill,
5963
SurfaceGroup? surface,
64+
SurfaceGroup? surfaceInverse,
6065
}) =>
6166
KatjasKleurplaat(
6267
primary: primary ?? this.primary,
@@ -68,6 +73,7 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat>
6873
success: success ?? this.success,
6974
successFill: successFill ?? this.successFill,
7075
surface: surface ?? this.surface,
76+
surfaceInverse: surfaceInverse ?? this.surfaceInverse,
7177
);
7278

7379
@override
@@ -84,6 +90,7 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat>
8490
success: success.lerp(other.success, t),
8591
successFill: successFill.lerp(other.successFill, t),
8692
surface: surface.lerp(other.surface, t),
93+
surfaceInverse: surfaceInverse?.lerp(other.surfaceInverse, t),
8794
);
8895
}
8996

@@ -93,17 +100,17 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat>
93100
brightness: brightness,
94101
primary: primary.color,
95102
primaryContainer: primary.color,
96-
onPrimary: primary.onColor,
97-
onPrimaryContainer: primary.onColor,
103+
onPrimary: primary.onColorContrast,
104+
onPrimaryContainer: primary.onColorContrast,
98105
secondary: content.color,
99106
secondaryContainer: content.color,
100-
onSecondary: content.onColor,
101-
onSecondaryContainer: content.onColor,
107+
onSecondary: content.onColorContrast,
108+
onSecondaryContainer: content.onColorContrast,
102109
tertiary: error.color,
103-
onTertiary: error.onColor,
110+
onTertiary: error.onColorContrast,
104111
error: error.color,
105-
onError: error.onColor,
112+
onError: error.onColorContrast,
106113
surface: surface.color,
107-
onSurface: surface.onColorContrastPlus,
114+
onSurface: surface.onColorContrast,
108115
);
109116
}

lib/style/kleurplaat/surface_group.dart

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,32 @@ class SurfaceGroup implements SurfaceGroupInterface<Color> {
77
/// {@macro surface_group}
88
const SurfaceGroup({
99
required this.color,
10-
required this.onColorContrastPlus,
11-
required this.onColorContrastMinus,
12-
required this.onColorSubtlePlus,
13-
required this.onColorSubtleMinus,
10+
required this.onColorContrast,
11+
required this.onColorContrastDim,
12+
required this.onColorSubtle,
13+
required this.onColorSubtleDim,
1414
required this.containerLowest,
1515
required this.containerLow,
1616
required this.container,
1717
required this.containerHigh,
1818
required this.containerHighest,
19+
required this.link,
1920
});
2021

2122
@override
2223
final Color color;
2324

2425
@override
25-
final Color onColorContrastPlus;
26+
final Color onColorContrast;
2627

2728
@override
28-
final Color onColorContrastMinus;
29+
final Color onColorContrastDim;
2930

3031
@override
31-
final Color onColorSubtlePlus;
32+
final Color onColorSubtle;
3233

3334
@override
34-
final Color onColorSubtleMinus;
35+
final Color onColorSubtleDim;
3536

3637
@override
3738
final Color containerLowest;
@@ -48,26 +49,28 @@ class SurfaceGroup implements SurfaceGroupInterface<Color> {
4849
@override
4950
final Color containerHighest;
5051

52+
@override
53+
final Color link;
54+
5155
@override
5256
SurfaceGroup lerp(SurfaceGroup? other, double t) {
5357
if (other == null) return this;
5458

5559
return SurfaceGroup(
5660
color: Color.lerp(color, other.color, t)!,
57-
onColorContrastPlus:
58-
Color.lerp(onColorContrastPlus, other.onColorContrastPlus, t)!,
59-
onColorContrastMinus:
60-
Color.lerp(onColorContrastMinus, other.onColorContrastMinus, t)!,
61-
onColorSubtlePlus:
62-
Color.lerp(onColorSubtlePlus, other.onColorSubtlePlus, t)!,
63-
onColorSubtleMinus:
64-
Color.lerp(onColorSubtleMinus, other.onColorSubtleMinus, t)!,
61+
onColorContrast: Color.lerp(onColorContrast, other.onColorContrast, t)!,
62+
onColorContrastDim:
63+
Color.lerp(onColorContrastDim, other.onColorContrastDim, t)!,
64+
onColorSubtle: Color.lerp(onColorSubtle, other.onColorSubtle, t)!,
65+
onColorSubtleDim:
66+
Color.lerp(onColorSubtleDim, other.onColorSubtleDim, t)!,
6567
containerLowest: Color.lerp(containerLowest, other.containerLowest, t)!,
6668
containerLow: Color.lerp(containerLow, other.containerLow, t)!,
6769
container: Color.lerp(container, other.container, t)!,
6870
containerHigh: Color.lerp(containerHigh, other.containerHigh, t)!,
6971
containerHighest:
7072
Color.lerp(containerHighest, other.containerHighest, t)!,
73+
link: Color.lerp(link, other.link, t)!,
7174
);
7275
}
7376
}

0 commit comments

Comments
 (0)