39 lines
1.2 KiB
Dart
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: 320.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: 32.5,
|
|
child: Center(
|
|
child: Text(
|
|
text,
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(color: textColor),
|
|
),
|
|
),
|
|
)
|
|
);
|
|
ScaffoldMessenger.of(context).showSnackBar(snackBar);*/
|
|
}
|