Skip to content

Commit

Permalink
fix: close #366
Browse files Browse the repository at this point in the history
  • Loading branch information
lucien144 committed Mar 14, 2023
1 parent 9d506f7 commit aa79ce3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 20 deletions.
9 changes: 6 additions & 3 deletions lib/components/mail_list_item.dart
Expand Up @@ -12,9 +12,9 @@ import 'package:fyx/model/MainRepository.dart';
import 'package:fyx/pages/NewMessagePage.dart';
import 'package:fyx/theme/Helpers.dart';
import 'package:fyx/theme/IconReply.dart';
import 'package:fyx/theme/IconUnread.dart';
import 'package:fyx/theme/skin/Skin.dart';
import 'package:fyx/theme/skin/SkinColors.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';

class MailListItem extends StatefulWidget {
Expand Down Expand Up @@ -56,8 +56,11 @@ class _MailListItemState extends State<MailListItem> {
topRightWidget: Row(
children: <Widget>[
Visibility(
visible: widget.mail.isUnread,
child: IconUnread(),
visible: widget.mail.isOutgoing && widget.mail.isUnread,
child: Icon(
MdiIcons.emailMarkAsUnread,
color: colors.text.withOpacity(0.38),
),
),
SizedBox(
width: 4,
Expand Down
5 changes: 4 additions & 1 deletion lib/model/Mail.dart
Expand Up @@ -24,13 +24,16 @@ class Mail extends IPost {
_time = DateTime.parse(json['inserted_at'] ?? '0').millisecondsSinceEpoch;
_direction = json['incoming'] ?? false;
content = ContentRegular(json['content'], isCompact: this.isCompact);
_message_status = (json['unread'] ?? false) ? MailStatus.unread : MailStatus.read;
_message_status = json['unread'] == null ? MailStatus.unknown : (json['unread'] ? MailStatus.unread : MailStatus.read);
_new = json['new'] ?? false;
_active = json['activity'];
}

bool get isUnread => status == MailStatus.unread;

bool get isIncoming => _direction == true;
bool get isOutgoing => _direction == false;

bool get isNew => _new;

Active? get active => _active == null ? null : Active.fromJson(_active!);
Expand Down
16 changes: 0 additions & 16 deletions lib/theme/IconUnread.dart

This file was deleted.

0 comments on commit aa79ce3

Please sign in to comment.