@ -6,7 +6,7 @@ import '/models/conversations.dart';
import ' /views/main/conversation/detail.dart ' ;
import ' /utils/time.dart ' ;
class ConversationListItem extends StatefulWidget {
class ConversationListItem extends StatefulWidget {
final Conversation conversation ;
const ConversationListItem ( {
Key ? key ,
@ -33,70 +33,71 @@ class _ConversationListItemState extends State<ConversationListItem> {
) ;
} ) ) . then ( onGoBack ) : null ;
} ,
child: Container (
padding: const EdgeInsets . only ( left: 16 , right: 0 , top: 10 , bottom: 10 ) ,
child: ! loaded ? null : Row (
padding: const EdgeInsets . only ( left: 16 , right: 0 , top: 10 , bottom: 10 ) ,
child: ! loaded ? null : Row (
children: < Widget > [
Expanded (
child: Row (
children: < Widget > [
CustomCircleAvatar (
initials: widget . conversation . name [ 0 ] . toUpperCase ( ) ,
imagePath: null ,
) ,
const SizedBox ( width: 16 ) ,
Expanded (
child: Row (
children: < Widget > [
CustomCircleAvatar (
initials: widget . conversation . name [ 0 ] . toUpperCase ( ) ,
imagePath: null ,
) ,
const SizedBox ( width: 16 ) ,
Expanded (
child: Align (
alignment: Alignment . centerLeft ,
child: Container (
color: Colors . transparent ,
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: < Widget > [
Text (
widget . conversation . name ,
style: const TextStyle ( fontSize: 16 )
) ,
recentMessage ! = null ?
const SizedBox ( height: 2 ) :
const SizedBox . shrink ( )
,
recentMessage ! = null ?
Text (
recentMessage ! . data ,
overflow: TextOverflow . ellipsis ,
maxLines: 1 ,
style: TextStyle (
fontSize: 13 ,
color: Colors . grey . shade600 ,
fontWeight: conversation . isRead ? FontWeight . normal : FontWeight . bold ,
) ,
) :
const SizedBox . shrink ( ) ,
] ,
) ,
) ,
) ,
child: Align (
alignment: Alignment . centerLeft ,
child: Container (
color: Colors . transparent ,
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: < Widget > [
Text (
widget . conversation . name ,
style: const TextStyle ( fontSize: 16 )
) ,
recentMessage ! = null ?
const SizedBox ( height: 2 ) :
const SizedBox . shrink ( )
,
recentMessage ! = null ?
Text (
recentMessage ! . data ,
overflow: TextOverflow . ellipsis ,
maxLines: 1 ,
style: TextStyle (
fontSize: 13 ,
color: Colors . grey . shade600 ,
fontWeight: conversation . isRead ? FontWeight . normal : FontWeight . bold ,
) ,
) :
const SizedBox . shrink ( ) ,
] ,
) ,
recentMessage ! = null ?
Padding (
padding: const EdgeInsets . only ( left: 10 ) ,
child: Text (
convertToAgo ( recentMessage ! . createdAt , short: true ) ,
style: TextStyle (
fontSize: 13 ,
color: Colors . grey . shade600 ,
) ,
)
) :
const SizedBox . shrink ( ) ,
] ,
) ,
) ,
) ,
recentMessage ! = null ?
Padding (
padding: const EdgeInsets . only ( left: 10 ) ,
child: Text (
convertToAgo ( recentMessage ! . createdAt , short: true ) ,
style: TextStyle (
fontSize: 13 ,
color: Colors . grey . shade600 ,
) ,
)
) :
const SizedBox . shrink ( ) ,
] ,
) ,
) ,
) ;
] ,
) ,
) ,
) ;
}
@ override