mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-26 06:49: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/helpers/conversations_helper.dart';
|
||||||
import 'package:comunic/lists/users_list.dart';
|
import 'package:comunic/lists/users_list.dart';
|
||||||
import 'package:comunic/models/conversation.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/conversation_image_widget.dart';
|
||||||
import 'package:comunic/ui/widgets/custom_list_tile.dart';
|
import 'package:comunic/ui/widgets/custom_list_tile.dart';
|
||||||
import 'package:comunic/utils/date_utils.dart';
|
import 'package:comunic/utils/date_utils.dart';
|
||||||
@ -52,8 +53,11 @@ class ConversationTile extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) => Column(
|
||||||
return CustomListTile(
|
children: [_buildMainTile(context), _buildCallTile(context)],
|
||||||
|
);
|
||||||
|
|
||||||
|
Widget _buildMainTile(BuildContext context) => CustomListTile(
|
||||||
onTap: () => onOpen(conversation),
|
onTap: () => onOpen(conversation),
|
||||||
// Conversation name
|
// Conversation name
|
||||||
title: Text(
|
title: Text(
|
||||||
@ -72,8 +76,8 @@ class ConversationTile extends StatelessWidget {
|
|||||||
: (conversation.color ?? Colors.blue).withOpacity(0.2),
|
: (conversation.color ?? Colors.blue).withOpacity(0.2),
|
||||||
|
|
||||||
// Leading icon
|
// Leading icon
|
||||||
leading:
|
leading: ConversationImageWidget(
|
||||||
ConversationImageWidget(conversation: conversation, users: usersList),
|
conversation: conversation, users: usersList),
|
||||||
|
|
||||||
// Conversation information
|
// Conversation information
|
||||||
isThreeLine: true,
|
isThreeLine: true,
|
||||||
@ -112,6 +116,21 @@ class ConversationTile extends StatelessWidget {
|
|||||||
]).then(_conversationMenuCallback);
|
]).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
|
/// Method called each time an option of the menu is selected
|
||||||
|
Loading…
Reference in New Issue
Block a user