mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-25 22:39:22 +00:00
Add call notice on conversations list
This commit is contained in:
parent
d10b1d0d22
commit
4614f3ae2e
@ -1,6 +1,7 @@
|
||||
import 'package:comunic/helpers/conversations_helper.dart';
|
||||
import 'package:comunic/lists/users_list.dart';
|
||||
import 'package:comunic/models/conversation.dart';
|
||||
import 'package:comunic/ui/routes/main_route/main_route.dart';
|
||||
import 'package:comunic/ui/widgets/conversation_image_widget.dart';
|
||||
import 'package:comunic/ui/widgets/custom_list_tile.dart';
|
||||
import 'package:comunic/utils/date_utils.dart';
|
||||
@ -52,8 +53,11 @@ class ConversationTile extends StatelessWidget {
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CustomListTile(
|
||||
Widget build(BuildContext context) => Column(
|
||||
children: [_buildMainTile(context), _buildCallTile(context)],
|
||||
);
|
||||
|
||||
Widget _buildMainTile(BuildContext context) => CustomListTile(
|
||||
onTap: () => onOpen(conversation),
|
||||
// Conversation name
|
||||
title: Text(
|
||||
@ -72,8 +76,8 @@ class ConversationTile extends StatelessWidget {
|
||||
: (conversation.color ?? Colors.blue).withOpacity(0.2),
|
||||
|
||||
// Leading icon
|
||||
leading:
|
||||
ConversationImageWidget(conversation: conversation, users: usersList),
|
||||
leading: ConversationImageWidget(
|
||||
conversation: conversation, users: usersList),
|
||||
|
||||
// Conversation information
|
||||
isThreeLine: true,
|
||||
@ -112,6 +116,21 @@ class ConversationTile extends StatelessWidget {
|
||||
]).then(_conversationMenuCallback);
|
||||
},
|
||||
);
|
||||
|
||||
/// Build call tile, in case of ongoing call
|
||||
Widget _buildCallTile(BuildContext context) {
|
||||
if (!conversation.isHavingCall) return Container();
|
||||
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(bottom: 20),
|
||||
child: ListTile(
|
||||
onTap: () => MainController.of(context).startCall(conversation.id),
|
||||
dense: true,
|
||||
title: Text(tr("Ongoing call")),
|
||||
leading: Icon(Icons.call),
|
||||
tileColor: Colors.yellow.withOpacity(0.2),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Method called each time an option of the menu is selected
|
||||
|
Loading…
Reference in New Issue
Block a user