Files
pluriwave/lib/tema/pluri_animate.dart
T
FreeTLab 202bef3539 feat(ui): design token discipline, accessibility and i18n pass
- Replace all hardcoded Color literals outside lib/tema with theme tokens (new static brand palette in PluriWaveTokens); media notification uses the brand color instead of the Material default purple
- Favorite button on station cards grows to a 48dp target and becomes an independent semantics node for screen readers (Semantics container fix)
- All flutter_animate call sites route through the PluriAnimate reduced-motion gate (zero direct .animate() left)
- Locale-aware short dates via intl DateFormat (new lib/l10n/formato_fechas.dart) replacing the hardcoded DD/MM/YYYY; proper plural messages for the favorites counter; example stream URL as a localized key - all 13 locales
- Rounded shimmer placeholders matching card radii; shimmer loading state in search instead of a bare spinner; rounded icon variants unified in settings; bottom-sheet conventions on the custom station form
- Fix latent debug crash: vacation editor read AppLocalizations in initState
- 11 new tests (121 total green), flutter analyze clean
2026-06-11 23:42:16 +02:00

53 lines
1.9 KiB
Dart

import 'package:flutter/widgets.dart';
import 'package:flutter_animate/flutter_animate.dart';
/// Reduced-motion-aware entry animations (S5-R3).
///
/// Every entry animation in the app should go through these helpers so the
/// OS "disable animations" accessibility setting is honored from a single
/// call site. When reduced motion is active the child is returned untouched
/// (no [Animate] wrapper at all).
extension PluriAnimate on Widget {
/// Fade-in entry animation.
Widget pluriFadeIn(
BuildContext context, {
Duration duration = const Duration(milliseconds: 350),
Duration delay = Duration.zero,
Curve curve = Curves.easeOutCubic,
}) {
if (_animacionesDeshabilitadas(context)) return this;
return animate(delay: delay).fadeIn(duration: duration, curve: curve);
}
/// Fade + subtle scale entry animation.
Widget pluriScaleIn(
BuildContext context, {
Duration duration = const Duration(milliseconds: 350),
Duration delay = Duration.zero,
Curve curve = Curves.easeOutCubic,
double begin = 0.96,
}) {
if (_animacionesDeshabilitadas(context)) return this;
return animate(delay: delay)
.fadeIn(duration: duration, curve: curve)
.scaleXY(begin: begin, end: 1, duration: duration, curve: curve);
}
/// Fade + subtle vertical slide entry animation.
Widget pluriFadeSlideIn(
BuildContext context, {
Duration duration = const Duration(milliseconds: 350),
Duration delay = Duration.zero,
Curve curve = Curves.easeOutCubic,
double beginY = 0.1,
}) {
if (_animacionesDeshabilitadas(context)) return this;
return animate(delay: delay)
.fadeIn(duration: duration, curve: curve)
.slideY(begin: beginY, end: 0, duration: duration, curve: curve);
}
bool _animacionesDeshabilitadas(BuildContext context) =>
MediaQuery.maybeDisableAnimationsOf(context) ?? false;
}