mirror of
https://github.com/vleeuwenmenno/supplements.git
synced 2025-09-11 18:29:12 +02:00
feat: Integrate ShadSonner for improved toast notifications across multiple screens
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
|
||||
import '../../models/supplement.dart';
|
||||
import '../../providers/supplement_provider.dart';
|
||||
@@ -183,10 +184,17 @@ Future<void> showBulkTakeDialog(
|
||||
|
||||
Navigator.of(context).pop();
|
||||
if (recorded > 0) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Recorded $recorded supplement${recorded == 1 ? '' : 's'}'),
|
||||
backgroundColor: Colors.green,
|
||||
final sonner = ShadSonner.of(context);
|
||||
final id = DateTime.now().millisecondsSinceEpoch;
|
||||
sonner.show(
|
||||
ShadToast(
|
||||
id: id,
|
||||
title: Text('Recorded $recorded supplement${recorded == 1 ? '' : 's'}'),
|
||||
action: ShadButton(
|
||||
size: ShadButtonSize.sm,
|
||||
child: const Text('Dismiss'),
|
||||
onPressed: () => sonner.hide(id),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user