mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2024-11-04 16:03:13 +00:00
23 lines
470 B
Dart
23 lines
470 B
Dart
import 'package:intl/intl.dart';
|
|
|
|
final DateFormat formatter = DateFormat('hh:mm');
|
|
|
|
class Message {
|
|
Message({this.text, this.type = MessageType.normal}) : time = DateTime.now();
|
|
|
|
final String? text;
|
|
final DateTime time;
|
|
final MessageType type;
|
|
String get timeString => formatter.format(time);
|
|
|
|
static Message warn({final String? text}) => Message(
|
|
text: text,
|
|
type: MessageType.warning,
|
|
);
|
|
}
|
|
|
|
enum MessageType {
|
|
normal,
|
|
warning,
|
|
}
|