Skip to content

Commit f56816d

Browse files
committed
💄 Aligned with Katja for the kleurplaat
1 parent 14e8d1e commit f56816d

File tree

10 files changed

+150
-71
lines changed

10 files changed

+150
-71
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import 'package:flutter/material.dart';
2+
3+
extension LinkStyle on TextTheme {
4+
TextStyle get linkSmall => bodySmall!.copyWith(
5+
fontWeight: FontWeight.bold,
6+
decoration: TextDecoration.underline,
7+
);
8+
9+
TextStyle get linkMedium => bodyMedium!.copyWith(
10+
fontWeight: FontWeight.bold,
11+
decoration: TextDecoration.underline,
12+
);
13+
14+
TextStyle get linkLarge => bodyLarge!.copyWith(
15+
fontWeight: FontWeight.bold,
16+
decoration: TextDecoration.underline,
17+
);
18+
}

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: 3 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,7 @@ 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) ?? onColorContrast,
3232
onColorSubtle: onColorSubtle == null || other.onColorSubtle == null
3333
? null
3434
: Color.lerp(onColorSubtle, other.onColorSubtle, t),

lib/style/kleurplaat/katjas_kleurplaat.dart

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import 'package:dcc_toolkit/style/kleurplaat/surface_group.dart';
44
import 'package:flutter/material.dart';
55

66
/// {@macro kleurplaat}
7-
class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat>
8-
implements KleurplaatInterface<Color> {
7+
class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat> implements KleurplaatInterface<Color> {
98
/// {@macro kleurplaat}
109
const KatjasKleurplaat({
1110
required this.primary,
@@ -17,6 +16,7 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat>
1716
required this.success,
1817
required this.successFill,
1918
required this.surface,
19+
required this.surfaceInverse,
2020
});
2121

2222
@override
@@ -46,6 +46,9 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat>
4646
@override
4747
final SurfaceGroup surface;
4848

49+
@override
50+
final SurfaceGroup? surfaceInverse;
51+
4952
@override
5053
ThemeExtension<KatjasKleurplaat> copyWith({
5154
ColorGroup? primary,
@@ -57,6 +60,7 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat>
5760
ColorGroup? success,
5861
ColorGroup? successFill,
5962
SurfaceGroup? surface,
63+
SurfaceGroup? surfaceInverse,
6064
}) =>
6165
KatjasKleurplaat(
6266
primary: primary ?? this.primary,
@@ -68,6 +72,7 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat>
6872
success: success ?? this.success,
6973
successFill: successFill ?? this.successFill,
7074
surface: surface ?? this.surface,
75+
surfaceInverse: surfaceInverse ?? this.surfaceInverse,
7176
);
7277

7378
@override
@@ -84,26 +89,26 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat>
8489
success: success.lerp(other.success, t),
8590
successFill: successFill.lerp(other.successFill, t),
8691
surface: surface.lerp(other.surface, t),
92+
surfaceInverse: surfaceInverse?.lerp(other.surfaceInverse, t),
8793
);
8894
}
8995

9096
/// Converts the [KatjasKleurplaat] to a [ColorScheme].
91-
ColorScheme toColorScheme({Brightness brightness = Brightness.light}) =>
92-
ColorScheme(
97+
ColorScheme toColorScheme({Brightness brightness = Brightness.light}) => ColorScheme(
9398
brightness: brightness,
9499
primary: primary.color,
95100
primaryContainer: primary.color,
96-
onPrimary: primary.onColor,
97-
onPrimaryContainer: primary.onColor,
101+
onPrimary: primary.onColorContrast,
102+
onPrimaryContainer: primary.onColorContrast,
98103
secondary: content.color,
99104
secondaryContainer: content.color,
100-
onSecondary: content.onColor,
101-
onSecondaryContainer: content.onColor,
105+
onSecondary: content.onColorContrast,
106+
onSecondaryContainer: content.onColorContrast,
102107
tertiary: error.color,
103-
onTertiary: error.onColor,
108+
onTertiary: error.onColorContrast,
104109
error: error.color,
105-
onError: error.onColor,
110+
onError: error.onColorContrast,
106111
surface: surface.color,
107-
onSurface: surface.onColorContrastPlus,
112+
onSurface: surface.onColorContrast,
108113
);
109114
}

lib/style/kleurplaat/surface_group.dart

Lines changed: 18 additions & 18 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,25 @@ 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: Color.lerp(onColorContrastDim, other.onColorContrastDim, t)!,
63+
onColorSubtle: Color.lerp(onColorSubtle, other.onColorSubtle, t)!,
64+
onColorSubtleDim: Color.lerp(onColorSubtleDim, other.onColorSubtleDim, t)!,
6565
containerLowest: Color.lerp(containerLowest, other.containerLowest, t)!,
6666
containerLow: Color.lerp(containerLow, other.containerLow, t)!,
6767
container: Color.lerp(container, other.container, t)!,
6868
containerHigh: Color.lerp(containerHigh, other.containerHigh, t)!,
69-
containerHighest:
70-
Color.lerp(containerHighest, other.containerHighest, t)!,
69+
containerHighest: Color.lerp(containerHighest, other.containerHighest, t)!,
70+
link: Color.lerp(link, other.link, t)!,
7171
);
7272
}
7373
}

lib/style/text_style/text_style_color_group.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ class TextStyleColorGroup implements ColorGroupInterface<TextStyle> {
66
/// {@macro color_group}
77
const TextStyleColorGroup({
88
required this.color,
9-
required this.onColor,
9+
required this.onColorContrast,
1010
this.onColorSubtle,
1111
});
1212

1313
@override
1414
final TextStyle color;
1515

1616
@override
17-
final TextStyle onColor;
17+
final TextStyle onColorContrast;
1818

1919
@override
2020
final TextStyle? onColorSubtle;

0 commit comments

Comments
 (0)