mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-09-19 13:58:50 +00:00
Get and show the list of conversations
This commit is contained in:
55
lib/ui/tiles/conversation_tile.dart
Normal file
55
lib/ui/tiles/conversation_tile.dart
Normal file
@@ -0,0 +1,55 @@
|
||||
import 'package:comunic/models/conversation.dart';
|
||||
import 'package:comunic/utils/intl_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Single conversation tile
|
||||
///
|
||||
/// @author Pierre HUBERT
|
||||
|
||||
class ConversationTile extends StatelessWidget {
|
||||
final Conversation conversation;
|
||||
|
||||
const ConversationTile({Key key, this.conversation}) : super(key: key);
|
||||
|
||||
_buildSubInformation(IconData icon, String content) {
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
icon,
|
||||
size: 15.0,
|
||||
color: Colors.grey,
|
||||
),
|
||||
Text(" " + content),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListTile(
|
||||
title: Text(conversation.name == null ? "Unknown" : conversation.name),
|
||||
leading: Icon(
|
||||
conversation.sawLastMessage ? Icons.check_circle : Icons.lens,
|
||||
color: conversation.sawLastMessage ? null : Colors.blue,
|
||||
),
|
||||
isThreeLine: true,
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: <Widget>[
|
||||
_buildSubInformation(Icons.access_time, "time"), //TODO : improve the way the time is shown
|
||||
_buildSubInformation(
|
||||
Icons.group,
|
||||
conversation.members.length == 1
|
||||
? tr("1 member")
|
||||
: tr(
|
||||
"%num% members",
|
||||
args: {
|
||||
"num": conversation.members.length.toString(),
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user