selfprivacy.org.app/lib/logic/models/message.dart

21 lines
444 B
Dart
Raw Normal View History

2021-01-14 21:48:05 +00:00
import 'package:intl/intl.dart';
2022-06-05 19:36:32 +00:00
final DateFormat formatter = DateFormat('hh:mm');
2021-01-14 21:48:05 +00:00
class Message {
2021-01-18 10:21:55 +00:00
Message({this.text, this.type = MessageType.normal}) : time = DateTime.now();
Message.warn({this.text})
: type = MessageType.warning,
time = DateTime.now();
2021-01-14 21:48:05 +00:00
2021-03-15 15:39:44 +00:00
final String? text;
2021-01-14 21:48:05 +00:00
final DateTime time;
2021-01-18 10:21:55 +00:00
final MessageType type;
2022-02-16 07:28:29 +00:00
String get timeString => formatter.format(time);
2021-01-18 10:21:55 +00:00
}
enum MessageType {
normal,
warning,
2021-01-14 21:48:05 +00:00
}