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
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:dievas/src/theme.dart';
///
/// Usage inside a widget's [build] method:
/// ```dart
/// final color = context.colours.action.actionPrimary;
/// final colour = context.colours.action.actionPrimary;
/// final style = context.typography.labelMd;
/// final gap = context.spacing.md;
/// ```
Expand All @@ -35,6 +35,9 @@ extension DievasThemeContextExtension on BuildContext {
/// The opacity sub-system — fractional opacity values.
DievasOpacityThemeData get opacity => DievasTheme.opacityOf(this);

/// The animation sub-system — motion durations and easing curves.
DievasAnimationThemeData get animation => DievasTheme.animationOf(this);

/// The component-level theme data sub-system.
DievasComponentThemeData get components => DievasTheme.componentsOf(this);

Expand Down
7 changes: 7 additions & 0 deletions packages/dievas/test/theme/dievas_theme_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,13 @@ void main() {
expect(DievasTheme.componentsOf(ctx), isA<DievasComponentThemeData>());
});

testWidgets('context.animation returns animation theme', (tester) async {
await tester.pumpWidget(const Harness(child: SizedBox(key: childKey)));
final ctx = tester.element(find.byKey(childKey));
expect(ctx.animation, isA<DievasAnimationThemeData>());
expect(ctx.animation, same(DievasTheme.animationOf(ctx)));
});

testWidgets('typographyOf returns typography theme', (tester) async {
await tester.pumpWidget(const Harness(child: SizedBox(key: childKey)));
final ctx = tester.element(find.byKey(childKey));
Expand Down