202bef3539
- 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
337 lines
9.2 KiB
Dart
337 lines
9.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../tema/pluriwave_theme.dart';
|
|
import '../tema/pluriwave_tokens.dart';
|
|
import 'pluri_glass_surface.dart';
|
|
import 'pluri_icon.dart';
|
|
|
|
class PluriScreenHeader extends StatelessWidget {
|
|
const PluriScreenHeader({
|
|
super.key,
|
|
required this.title,
|
|
required this.subtitle,
|
|
required this.glyph,
|
|
this.primaryActionLabel,
|
|
this.onPrimaryAction,
|
|
this.trailing,
|
|
});
|
|
|
|
final String title;
|
|
final String subtitle;
|
|
final PluriIconGlyph glyph;
|
|
final String? primaryActionLabel;
|
|
final VoidCallback? onPrimaryAction;
|
|
final Widget? trailing;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final t = context.pluriTokens;
|
|
final theme = Theme.of(context);
|
|
final width = MediaQuery.sizeOf(context).width;
|
|
final scale = MediaQuery.textScalerOf(context).scale(1);
|
|
final compact = width < 380 || scale >= 1.25;
|
|
final iconSize = compact ? 50.0 : 56.0;
|
|
|
|
Widget glyphBadge() => Container(
|
|
width: iconSize,
|
|
height: iconSize,
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
gradient: LinearGradient(
|
|
colors: [
|
|
PluriWaveTokens.brightCyan.withValues(alpha: 0.95),
|
|
t.electricMagenta,
|
|
t.warmCoral,
|
|
],
|
|
),
|
|
boxShadow: [
|
|
BoxShadow(color: t.glowColor, blurRadius: 28, spreadRadius: 2),
|
|
],
|
|
),
|
|
child: Center(
|
|
child: PluriIcon(
|
|
glyph: glyph,
|
|
variant: PluriIconVariant.filled,
|
|
size: compact ? 25 : 28,
|
|
),
|
|
),
|
|
);
|
|
|
|
Widget textBlock() => Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
title,
|
|
maxLines: compact ? 2 : 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: theme.textTheme.headlineSmall?.copyWith(
|
|
fontWeight: FontWeight.w900,
|
|
letterSpacing: -0.7,
|
|
height: 1.05,
|
|
),
|
|
),
|
|
const SizedBox(height: 6),
|
|
Text(
|
|
subtitle,
|
|
maxLines: compact ? 4 : 3,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: theme.textTheme.bodyMedium?.copyWith(
|
|
color: theme.colorScheme.onSurface.withValues(alpha: 0.78),
|
|
height: 1.28,
|
|
),
|
|
),
|
|
if (primaryActionLabel != null) ...[
|
|
const SizedBox(height: 12),
|
|
FilledButton.tonalIcon(
|
|
onPressed: onPrimaryAction,
|
|
icon: const Icon(Icons.auto_awesome_rounded, size: 18),
|
|
label: Text(primaryActionLabel!),
|
|
),
|
|
],
|
|
],
|
|
);
|
|
|
|
Widget foreground() {
|
|
if (compact) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
glyphBadge(),
|
|
const SizedBox(width: 14),
|
|
Expanded(child: textBlock()),
|
|
],
|
|
),
|
|
if (trailing != null) ...[
|
|
const SizedBox(height: 14),
|
|
Align(alignment: Alignment.centerLeft, child: trailing!),
|
|
],
|
|
],
|
|
);
|
|
}
|
|
|
|
return Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
glyphBadge(),
|
|
const SizedBox(width: 14),
|
|
Expanded(child: textBlock()),
|
|
if (trailing != null) ...[
|
|
const SizedBox(width: 12),
|
|
ConstrainedBox(
|
|
constraints: const BoxConstraints(maxWidth: 220),
|
|
child: trailing!,
|
|
),
|
|
],
|
|
],
|
|
);
|
|
}
|
|
|
|
return Padding(
|
|
padding: EdgeInsets.fromLTRB(
|
|
t.spacingMd,
|
|
t.spacingSm,
|
|
t.spacingMd,
|
|
t.spacingSm,
|
|
),
|
|
child: PluriGlassSurface(
|
|
borderRadius: BorderRadius.circular(t.radiusLg + 8),
|
|
padding: EdgeInsets.symmetric(
|
|
horizontal: compact ? 16 : 20,
|
|
vertical: compact ? 18 : 20,
|
|
),
|
|
child: Stack(
|
|
children: [
|
|
Positioned.fill(
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.circular(t.radiusLg + 8),
|
|
child: Opacity(
|
|
opacity: 0.24,
|
|
child: Image.asset(
|
|
'assets/images/aurora_wave_banner.png',
|
|
fit: BoxFit.cover,
|
|
errorBuilder: (_, __, ___) => const SizedBox.shrink(),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Positioned.fill(
|
|
child: DecoratedBox(
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(t.radiusLg + 8),
|
|
gradient: LinearGradient(
|
|
begin: Alignment.centerLeft,
|
|
end: Alignment.centerRight,
|
|
colors: [
|
|
Colors.black.withValues(alpha: 0.58),
|
|
Colors.black.withValues(alpha: 0.18),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Positioned(
|
|
right: -36,
|
|
top: -42,
|
|
child: _Orb(
|
|
color: t.electricMagenta.withValues(alpha: 0.38),
|
|
size: 128,
|
|
),
|
|
),
|
|
Positioned(
|
|
right: 10,
|
|
top: 10,
|
|
child: Opacity(
|
|
opacity: 0.18,
|
|
child: Image.asset(
|
|
'assets/icons/pluriwave_app_mark.png',
|
|
width: 120,
|
|
height: 120,
|
|
errorBuilder: (_, __, ___) => const SizedBox.shrink(),
|
|
),
|
|
),
|
|
),
|
|
Positioned(
|
|
right: 44,
|
|
bottom: -54,
|
|
child: _Orb(
|
|
color: PluriWaveTokens.brightCyan.withValues(alpha: 0.22),
|
|
size: 116,
|
|
),
|
|
),
|
|
Padding(
|
|
padding: EdgeInsets.all(compact ? 2 : 4),
|
|
child: foreground(),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class PluriStatusPill extends StatelessWidget {
|
|
const PluriStatusPill({
|
|
super.key,
|
|
required this.icon,
|
|
required this.label,
|
|
this.accent,
|
|
});
|
|
|
|
final IconData icon;
|
|
final String label;
|
|
final Color? accent;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final t = context.pluriTokens;
|
|
final color = accent ?? t.electricMagenta;
|
|
return Tooltip(
|
|
message: label,
|
|
child: Container(
|
|
constraints: const BoxConstraints(maxWidth: 220),
|
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(999),
|
|
color: color.withValues(alpha: 0.13),
|
|
border: Border.all(color: color.withValues(alpha: 0.38)),
|
|
),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Icon(icon, size: 16, color: color),
|
|
const SizedBox(width: 7),
|
|
Flexible(
|
|
child: Text(
|
|
label,
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: Theme.of(
|
|
context,
|
|
).textTheme.labelMedium?.copyWith(fontWeight: FontWeight.w800),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class PluriEmptyState extends StatelessWidget {
|
|
const PluriEmptyState({
|
|
super.key,
|
|
required this.glyph,
|
|
required this.title,
|
|
required this.subtitle,
|
|
});
|
|
|
|
final PluriIconGlyph glyph;
|
|
final String title;
|
|
final String subtitle;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final t = context.pluriTokens;
|
|
final theme = Theme.of(context);
|
|
return Center(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(24),
|
|
child: PluriGlassSurface(
|
|
borderRadius: BorderRadius.circular(t.radiusLg + 10),
|
|
padding: const EdgeInsets.all(28),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
PluriIcon(
|
|
glyph: glyph,
|
|
variant: PluriIconVariant.activeGlow,
|
|
size: 58,
|
|
),
|
|
const SizedBox(height: 18),
|
|
Text(
|
|
title,
|
|
textAlign: TextAlign.center,
|
|
style: theme.textTheme.titleLarge?.copyWith(
|
|
fontWeight: FontWeight.w900,
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
subtitle,
|
|
textAlign: TextAlign.center,
|
|
style: theme.textTheme.bodyMedium?.copyWith(
|
|
color: theme.colorScheme.onSurface.withValues(alpha: 0.72),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class _Orb extends StatelessWidget {
|
|
const _Orb({required this.color, required this.size});
|
|
|
|
final Color color;
|
|
final double size;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return IgnorePointer(
|
|
child: Container(
|
|
width: size,
|
|
height: size,
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
gradient: RadialGradient(colors: [color, color.withValues(alpha: 0)]),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|