Skip to content

Commit

Permalink
add inline documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
tilucasoli committed Dec 3, 2024
1 parent cd8ea71 commit 5824b1f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/mix/lib/src/theme/tokens/breakpoints_token.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ class BreakpointToken extends MixToken<Breakpoint> {
}
}

/// A resolver for breakpoint tokens.
/// {@macro mix.token.resolver}
@immutable
class BreakpointResolver extends Breakpoint with WithTokenResolver<Breakpoint> {
@override
final BuildContextResolver<Breakpoint> resolve;

/// Creates a new breakpoint resolver with the given [resolve] function.
/// {@macro mix.token.resolver}
const BreakpointResolver(this.resolve);
}

Expand Down
9 changes: 7 additions & 2 deletions packages/mix/lib/src/theme/tokens/color_token.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,20 @@ class ColorSwatchToken<T> extends ColorToken {
}
}

/// A color resolver that allows dynamic resolution of a color value.
/// {@template mix.token.resolver}
/// A resolver that allows dynamic resolution of a token value.
///
/// This is useful when the color value is dependent on the current [BuildContext],
/// This is useful when the token value is dependent on the current [BuildContext],
/// and cannot be resolved statically.
///
/// For more information, see [Dynamic Themes](https://www.fluttermix.com/docs/guides/design-token#dynamic-themes).
/// {@endtemplate}
class ColorResolver extends Color with WithTokenResolver<Color> {
/// The function used to resolve the color value dynamically.
@override
final BuildContextResolver<Color> resolve;

/// {@macro mix.token.resolver}
const ColorResolver(this.resolve) : super(0);
}

Expand Down
2 changes: 2 additions & 0 deletions packages/mix/lib/src/theme/tokens/radius_token.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ class RadiusToken extends MixToken<Radius> {
}
}

/// {@macro mix.token.resolver}
@immutable
class RadiusResolver extends Radius with WithTokenResolver<Radius> {
@override
final BuildContextResolver<Radius> resolve;

/// {@macro mix.token.resolver}
const RadiusResolver(this.resolve) : super.circular(0);
}

Expand Down
1 change: 1 addition & 0 deletions packages/mix/lib/src/theme/tokens/text_style_token.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class TextStyleToken extends MixToken<TextStyle> {
}
}

/// {@macro mix.token.resolver}
@immutable
class TextStyleResolver extends TextStyle with WithTokenResolver<TextStyle> {
@override
Expand Down

0 comments on commit 5824b1f

Please sign in to comment.