@@ -14,6 +14,7 @@ import '../../common/view/snackbars.dart';
1414import '../../common/view/ui_constants.dart' ;
1515import '../../l10n/l10n.dart' ;
1616import 'chat_master_detail_page.dart' ;
17+ import 'chat_master_tile_menu.dart' ;
1718import 'chat_room_master_tile_subtitle.dart' ;
1819
1920class ChatRoomMasterTile extends StatelessWidget with WatchItMixin {
@@ -40,79 +41,83 @@ class ChatRoomMasterTile extends StatelessWidget with WatchItMixin {
4041 ).data ??
4142 room.pushRuleState;
4243
43- return Opacity (
44- opacity: processingJoinOrLeave || loadingArchive ? 0.3 : 1 ,
45- child: Padding (
46- padding: const EdgeInsets .only (bottom: 5 ),
47- child: Stack (
48- alignment: Alignment .center,
49- children: [
50- YaruMasterTile (
51- selected: selectedRoom? .id != null && selectedRoom? .id == room.id,
52- leading: ChatAvatar (
53- key: ValueKey (room.avatar? .toString ()),
54- avatarUri: pushRuleState == PushRuleState .dontNotify
44+ return ChatMasterTileMenu (
45+ room: room,
46+ child: Opacity (
47+ opacity: processingJoinOrLeave || loadingArchive ? 0.3 : 1 ,
48+ child: Padding (
49+ padding: const EdgeInsets .only (bottom: 5 ),
50+ child: Stack (
51+ alignment: Alignment .center,
52+ children: [
53+ YaruMasterTile (
54+ selected:
55+ selectedRoom? .id != null && selectedRoom? .id == room.id,
56+ leading: ChatAvatar (
57+ key: ValueKey (room.avatar? .toString ()),
58+ avatarUri: pushRuleState == PushRuleState .dontNotify
59+ ? null
60+ : room.avatar,
61+ fallBackIcon: room.membership != Membership .invite
62+ ? pushRuleState == PushRuleState .dontNotify
63+ ? pushRuleState.getIconData ()
64+ : room.isDirectChat
65+ ? YaruIcons .user
66+ : YaruIcons .users
67+ : YaruIcons .mail_unread,
68+ ),
69+ title: Text (
70+ room.membership == Membership .invite
71+ ? context.l10n.invite
72+ : room.getLocalizedDisplayname (),
73+ maxLines: 2 ,
74+ ),
75+ subtitle: room.membership == Membership .invite
76+ ? Text (room.getLocalizedDisplayname ())
77+ : ChatRoomMasterTileSubTitle (room: room),
78+ onTap: processingJoinOrLeave || loadingArchive
5579 ? null
56- : room.avatar,
57- fallBackIcon: room.membership != Membership .invite
58- ? pushRuleState == PushRuleState .dontNotify
59- ? pushRuleState.getIconData ()
60- : room.isDirectChat
61- ? YaruIcons .user
62- : YaruIcons .users
63- : YaruIcons .mail_unread,
64- ),
65- title: Text (
66- room.membership == Membership .invite
67- ? context.l10n.invite
68- : room.getLocalizedDisplayname (),
69- maxLines: 2 ,
70- ),
71- subtitle: room.membership == Membership .invite
72- ? Text (room.getLocalizedDisplayname ())
73- : ChatRoomMasterTileSubTitle (room: room),
74- onTap: processingJoinOrLeave || loadingArchive
75- ? null
76- : () async {
77- if (room.isArchived) {
78- chatModel.setSelectedRoom (room);
79- } else {
80- if (room.membership == Membership .invite) {
81- showDialog (
82- context: context,
83- builder: (context) =>
84- ChatInvitationDialog (room: room),
85- );
80+ : () async {
81+ if (room.isArchived) {
82+ chatModel.setSelectedRoom (room);
8683 } else {
87- await chatModel.joinRoom (
88- room,
89- onFail: (e) =>
90- showSnackBar (context, content: Text (e)),
91- );
84+ if (room.membership == Membership .invite) {
85+ showDialog (
86+ context: context,
87+ builder: (context) =>
88+ ChatInvitationDialog (room: room),
89+ );
90+ } else {
91+ await chatModel.joinRoom (
92+ room,
93+ onFail: (e) =>
94+ showSnackBar (context, content: Text (e)),
95+ );
96+ }
9297 }
93- }
94- di <DraftModel >().setAttaching (false );
98+ di <DraftModel >().setAttaching (false );
9599
96- masterScaffoldKey.currentState? .hideDrawer ();
97- },
98- ),
99- if (! room.isArchived) ...[
100- if (room.notificationCount > 0 )
101- Positioned (
102- right: kBigPadding,
103- child: Badge (
104- largeSize: 11 ,
105- smallSize: 11 ,
106- label: Text (room.notificationCount.toString ()),
100+ masterScaffoldKey.currentState? .hideDrawer ();
101+ },
102+ ),
103+ if (! room.isArchived) ...[
104+ if (room.notificationCount > 0 )
105+ Positioned (
106+ right: kBigPadding,
107+ child: Badge (
108+ largeSize: 11 ,
109+ smallSize: 11 ,
110+ label: Text (room.notificationCount.toString ()),
111+ ),
112+ )
113+ else if (room.isFavourite)
114+ Positioned (
115+ right: kBigPadding,
116+ child: ChatRoomPinButton (room: room, small: true ),
107117 ),
108- )
109- else if (room.isFavourite)
110- Positioned (
111- right: kBigPadding,
112- child: ChatRoomPinButton (room: room, small: true ),
113- ),
118+ ],
114119 ],
115- ] ,
120+ ) ,
116121 ),
117122 ),
118123 );
0 commit comments