This commit is contained in:
Forrest 2026-07-29 22:41:38 -04:00
parent 981b4836f9
commit ed910748cb
34 changed files with 2054 additions and 153 deletions

38
lib/widgets/toast.dart Normal file
View file

@ -0,0 +1,38 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../theme/tokens.dart';
/// Shows a themed, transient confirmation toast plus a light haptic tick.
///
/// Rendered as a fixed [SnackBar], so it settles just above the app's bottom
/// chrome (mini-player + tab bar) rather than over it. Styled to match the
/// dense, near-black terminal aesthetic — [TimbreColors.surface] fill, warm
/// [TimbreColors.foreground] text, with the live accent used for the leading
/// [icon]. Any in-flight toast is cleared first so rapid taps don't stack.
void showToast(BuildContext context, String message, {IconData? icon}) {
final accent = Theme.of(context).colorScheme.primary;
HapticFeedback.selectionClick();
ScaffoldMessenger.of(context)
..clearSnackBars()
..showSnackBar(
SnackBar(
backgroundColor: TimbreColors.surface,
duration: const Duration(seconds: 2),
content: Row(
children: [
if (icon != null) ...[
Icon(icon, size: 16, color: accent),
const SizedBox(width: TimbreSpacing.md),
],
Expanded(
child: Text(
message,
style: const TextStyle(color: TimbreColors.foreground),
),
),
],
),
),
);
}