aves/lib/widgets/common/identity/aves_caption.dart
2022-10-03 17:00:08 +02:00

42 lines
1.1 KiB
Dart

import 'package:aves/theme/durations.dart';
import 'package:aves/widgets/common/basic/animated_text.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class AvesCaption extends StatelessWidget {
final String data;
const AvesCaption(
this.data, {
super.key,
});
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final subtitleStyle = theme.textTheme.caption!;
final subtitleChangeShadowColor = theme.colorScheme.onPrimary;
return AnimatedText(
// provide key to refresh on theme brightness change
key: ValueKey(subtitleChangeShadowColor),
data,
style: subtitleStyle.copyWith(
shadows: [
Shadow(
color: subtitleChangeShadowColor.withOpacity(0),
blurRadius: 0,
)
],
),
changedStyle: subtitleStyle.copyWith(
shadows: [
Shadow(
color: subtitleChangeShadowColor,
blurRadius: 3,
)
],
),
duration: context.read<DurationsData>().formTextStyleTransition,
);
}
}