manager-app/lib/Components/message_notification.dart
Thomas Fransolet 4818a1af52 Configuration (create, update, del) + Section (create, update, del)
more test to be sure for section but should be ok
2025-05-13 17:12:04 +02:00

39 lines
1.2 KiB
Dart

//import 'package:another_flushbar/flushbar.dart';
import 'package:flutter/material.dart';
showNotification (Color backgroundColor, Color textColor, String text, BuildContext context, int? duration) async {
/*await Flushbar(
message: text,
messageColor: textColor,
margin: EdgeInsets.all(8),
backgroundColor: backgroundColor,
borderRadius: BorderRadius.circular(8),
duration: duration == null ? Duration(milliseconds: 1500) : Duration(milliseconds: duration),
).show(context);*/
final snackBar = SnackBar(
behavior: SnackBarBehavior.floating,
duration: duration == null ? Duration(milliseconds: 1500) : Duration(milliseconds: duration),
width: 450.0, // Width of the SnackBar.
backgroundColor: backgroundColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
padding: const EdgeInsets.symmetric(
horizontal: 10.0, // Inner padding for SnackBar content.
),
content: Container(
height: 50.5,
child: Center(
child: Text(
text,
textAlign: TextAlign.center,
style: TextStyle(color: textColor),
),
),
)
);
ScaffoldMessenger.of(context).showSnackBar(snackBar);
}