42 lines
1.3 KiB
Dart
42 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
/// M3 Expressive status pill — uses tonal container colors with a
|
|
/// smooth, spring-physics-inspired animation.
|
|
class StatusPill extends StatelessWidget {
|
|
const StatusPill({super.key, required this.label, this.isEmphasized = false});
|
|
|
|
final String label;
|
|
final bool isEmphasized;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final scheme = Theme.of(context).colorScheme;
|
|
// isEmphasized uses primaryContainer (higher tonal weight) to visually
|
|
// distinguish high-priority statuses from routine ones.
|
|
final background = isEmphasized
|
|
? scheme.primaryContainer
|
|
: scheme.tertiaryContainer;
|
|
final foreground = isEmphasized
|
|
? scheme.onPrimaryContainer
|
|
: scheme.onTertiaryContainer;
|
|
|
|
return AnimatedContainer(
|
|
duration: const Duration(milliseconds: 400),
|
|
curve: Curves.easeOutCubic,
|
|
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 6),
|
|
decoration: BoxDecoration(
|
|
color: background,
|
|
borderRadius: BorderRadius.circular(28),
|
|
),
|
|
child: Text(
|
|
label.toUpperCase(),
|
|
style: Theme.of(context).textTheme.labelSmall?.copyWith(
|
|
color: foreground,
|
|
fontWeight: FontWeight.w700,
|
|
letterSpacing: 0.5,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|