Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.0.10
Improved kleurplaat

## 0.0.9
Added kleurplaat

## 0.0.6

* :sparkles: Added new version of Result for mapping API responses
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.0.7"
version: "0.0.10"
equatable:
dependency: transitive
description:
Expand Down
22 changes: 22 additions & 0 deletions lib/common/extensions/text_theme.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import 'package:flutter/material.dart';

/// LinkStyle extension for [TextTheme].
extension LinkStyle on TextTheme {
/// Link style for small text.
TextStyle get linkSmall => bodySmall!.copyWith(
fontWeight: FontWeight.bold,
decoration: TextDecoration.underline,
);

/// Link style for medium text.
TextStyle get linkMedium => bodyMedium!.copyWith(
fontWeight: FontWeight.bold,
decoration: TextDecoration.underline,
);

/// Link style for large text.
TextStyle get linkLarge => bodyLarge!.copyWith(
fontWeight: FontWeight.bold,
decoration: TextDecoration.underline,
);
}
1 change: 1 addition & 0 deletions lib/dcc_toolkit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export 'common/dimensions.dart';
export 'common/extensions/build_context.dart';
export 'common/extensions/color.dart';
export 'common/extensions/iterable.dart';
export 'common/extensions/text_theme.dart';
export 'common/result/result.dart';
export 'logger/bolt_logger.dart';
export 'style/style.dart';
2 changes: 1 addition & 1 deletion lib/style/interface/color_group_interface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ abstract interface class ColorGroupInterface<T> {
/// {@template on_color}
/// The color on the foreground. Usually on top of the [color].
/// {@endtemplate}
T get onColor;
T get onColorContrast;

/// {@template on_color_subtle}
/// The color on the foreground, but more subtle. Usually on top of the [color].
Expand Down
5 changes: 5 additions & 0 deletions lib/style/interface/kleurplaat_interface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,9 @@ abstract interface class KleurplaatInterface<T> {
/// The surface group.
/// {@endtemplate}
SurfaceGroupInterface<T> get surface;

/// {@template surface}
/// The surface inverse group.
/// {@endtemplate}
SurfaceGroupInterface<T>? get surfaceInverse;
}
13 changes: 9 additions & 4 deletions lib/style/interface/surface_group_interface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ abstract interface class SurfaceGroupInterface<T> {
/// {@template onColorContrastPlus}
/// The color on the surface with a higher contrast.
/// {@endtemplate}
T get onColorContrastPlus;
T get onColorContrast;

/// {@template onColorContrastMinus}
/// The color on the surface with a lower contrast.
/// {@endtemplate}
T get onColorContrastMinus;
T get onColorContrastDim;

/// {@template onColorSubtlePlus}
/// The color on the surface with a higher contrast, but more subtle.
/// {@endtemplate}
T get onColorSubtlePlus;
T get onColorSubtle;

/// {@template onColorSubtleMinus}
/// The color on the surface with a lower contrast, but more subtle.
/// {@endtemplate}
T get onColorSubtleMinus;
T get onColorSubtleDim;

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

/// {@template link}
/// The color of the link.
/// {@endtemplate}
T get link;

/// Linearly interpolate with another object.
SurfaceGroupInterface<T> lerp(
covariant SurfaceGroupInterface<T>? other,
Expand Down
7 changes: 4 additions & 3 deletions lib/style/kleurplaat/color_group.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ class ColorGroup implements ColorGroupInterface<Color> {
/// {@macro color_group}
const ColorGroup({
required this.color,
required this.onColor,
required this.onColorContrast,
this.onColorSubtle,
});

@override
final Color color;

@override
final Color onColor;
final Color onColorContrast;

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

return ColorGroup(
color: Color.lerp(color, other.color, t) ?? color,
onColor: Color.lerp(onColor, other.onColor, t) ?? onColor,
onColorContrast: Color.lerp(onColorContrast, other.onColorContrast, t) ??
onColorContrast,
onColorSubtle: onColorSubtle == null || other.onColorSubtle == null
? null
: Color.lerp(onColorSubtle, other.onColorSubtle, t),
Expand Down
21 changes: 14 additions & 7 deletions lib/style/kleurplaat/katjas_kleurplaat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat>
required this.success,
required this.successFill,
required this.surface,
required this.surfaceInverse,
});

@override
Expand Down Expand Up @@ -46,6 +47,9 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat>
@override
final SurfaceGroup surface;

@override
final SurfaceGroup? surfaceInverse;

@override
ThemeExtension<KatjasKleurplaat> copyWith({
ColorGroup? primary,
Expand All @@ -57,6 +61,7 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat>
ColorGroup? success,
ColorGroup? successFill,
SurfaceGroup? surface,
SurfaceGroup? surfaceInverse,
}) =>
KatjasKleurplaat(
primary: primary ?? this.primary,
Expand All @@ -68,6 +73,7 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat>
success: success ?? this.success,
successFill: successFill ?? this.successFill,
surface: surface ?? this.surface,
surfaceInverse: surfaceInverse ?? this.surfaceInverse,
);

@override
Expand All @@ -84,6 +90,7 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat>
success: success.lerp(other.success, t),
successFill: successFill.lerp(other.successFill, t),
surface: surface.lerp(other.surface, t),
surfaceInverse: surfaceInverse?.lerp(other.surfaceInverse, t),
);
}

Expand All @@ -93,17 +100,17 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat>
brightness: brightness,
primary: primary.color,
primaryContainer: primary.color,
onPrimary: primary.onColor,
onPrimaryContainer: primary.onColor,
onPrimary: primary.onColorContrast,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Klopt dit?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ja is renamed en is al eens eerder gemapt.

onPrimaryContainer: primary.onColorContrast,
secondary: content.color,
secondaryContainer: content.color,
onSecondary: content.onColor,
onSecondaryContainer: content.onColor,
onSecondary: content.onColorContrast,
onSecondaryContainer: content.onColorContrast,
tertiary: error.color,
onTertiary: error.onColor,
onTertiary: error.onColorContrast,
error: error.color,
onError: error.onColor,
onError: error.onColorContrast,
surface: surface.color,
onSurface: surface.onColorContrastPlus,
onSurface: surface.onColorContrast,
);
}
35 changes: 19 additions & 16 deletions lib/style/kleurplaat/surface_group.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,32 @@ class SurfaceGroup implements SurfaceGroupInterface<Color> {
/// {@macro surface_group}
const SurfaceGroup({
required this.color,
required this.onColorContrastPlus,
required this.onColorContrastMinus,
required this.onColorSubtlePlus,
required this.onColorSubtleMinus,
required this.onColorContrast,
required this.onColorContrastDim,
required this.onColorSubtle,
required this.onColorSubtleDim,
required this.containerLowest,
required this.containerLow,
required this.container,
required this.containerHigh,
required this.containerHighest,
required this.link,
});

@override
final Color color;

@override
final Color onColorContrastPlus;
final Color onColorContrast;

@override
final Color onColorContrastMinus;
final Color onColorContrastDim;

@override
final Color onColorSubtlePlus;
final Color onColorSubtle;

@override
final Color onColorSubtleMinus;
final Color onColorSubtleDim;

@override
final Color containerLowest;
Expand All @@ -48,26 +49,28 @@ class SurfaceGroup implements SurfaceGroupInterface<Color> {
@override
final Color containerHighest;

@override
final Color link;

@override
SurfaceGroup lerp(SurfaceGroup? other, double t) {
if (other == null) return this;

return SurfaceGroup(
color: Color.lerp(color, other.color, t)!,
onColorContrastPlus:
Color.lerp(onColorContrastPlus, other.onColorContrastPlus, t)!,
onColorContrastMinus:
Color.lerp(onColorContrastMinus, other.onColorContrastMinus, t)!,
onColorSubtlePlus:
Color.lerp(onColorSubtlePlus, other.onColorSubtlePlus, t)!,
onColorSubtleMinus:
Color.lerp(onColorSubtleMinus, other.onColorSubtleMinus, t)!,
onColorContrast: Color.lerp(onColorContrast, other.onColorContrast, t)!,
onColorContrastDim:
Color.lerp(onColorContrastDim, other.onColorContrastDim, t)!,
onColorSubtle: Color.lerp(onColorSubtle, other.onColorSubtle, t)!,
onColorSubtleDim:
Color.lerp(onColorSubtleDim, other.onColorSubtleDim, t)!,
containerLowest: Color.lerp(containerLowest, other.containerLowest, t)!,
containerLow: Color.lerp(containerLow, other.containerLow, t)!,
container: Color.lerp(container, other.container, t)!,
containerHigh: Color.lerp(containerHigh, other.containerHigh, t)!,
containerHighest:
Color.lerp(containerHighest, other.containerHighest, t)!,
link: Color.lerp(link, other.link, t)!,
);
}
}
4 changes: 2 additions & 2 deletions lib/style/text_style/text_style_color_group.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ class TextStyleColorGroup implements ColorGroupInterface<TextStyle> {
/// {@macro color_group}
const TextStyleColorGroup({
required this.color,
required this.onColor,
required this.onColorContrast,
this.onColorSubtle,
});

@override
final TextStyle color;

@override
final TextStyle onColor;
final TextStyle onColorContrast;

@override
final TextStyle? onColorSubtle;
Expand Down
Loading