@@ -2,7 +2,8 @@ import 'package:flutter/cupertino.dart';
22import 'package:imessage/channel_image.dart' ;
33import 'package:imessage/channel_name_text.dart' ;
44import 'package:imessage/utils.dart' ;
5- import 'package:stream_chat_flutter/stream_chat_flutter.dart' show Channel;
5+ import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'
6+ show Channel;
67
78import 'utils.dart' ;
89
@@ -23,7 +24,7 @@ class ChannelPreview extends StatelessWidget {
2324 : null ;
2425
2526 final prefix = lastMessage? .attachments != null
26- ? lastMessage? .attachments //TODO: ugly
27+ ? lastMessage? .attachments
2728 .map ((e) {
2829 if (e.type == 'image' ) {
2930 return '📷 ' ;
@@ -35,13 +36,12 @@ class ChannelPreview extends StatelessWidget {
3536 .where ((e) => e != null )
3637 .join (' ' )
3738 : '' ;
39+
3840 return GestureDetector (
3941 onTap: onTap,
4042 behavior: HitTestBehavior .opaque,
41- child: Container (
42- constraints: BoxConstraints .tightFor (
43- height: 90 ,
44- ),
43+ child: SizedBox (
44+ height: 70 ,
4545 child: Padding (
4646 padding: const EdgeInsets .symmetric (
4747 horizontal: 8.0 ,
@@ -50,11 +50,10 @@ class ChannelPreview extends StatelessWidget {
5050 crossAxisAlignment: CrossAxisAlignment .start,
5151 children: [
5252 Padding (
53- padding:
54- const EdgeInsets .symmetric (vertical: 16.0 , horizontal: 8.0 ),
53+ padding: const EdgeInsets .only (left: 16.0 , right: 8.0 ),
5554 child: ChannelImage (
5655 channel: channel,
57- size: 50 ,
56+ size: 46 ,
5857 ),
5958 ),
6059 Expanded (
@@ -67,47 +66,49 @@ class ChannelPreview extends StatelessWidget {
6766 crossAxisAlignment: CrossAxisAlignment .start,
6867 children: [
6968 Padding (
70- padding: const EdgeInsets .symmetric (horizontal: 8.0 ),
71- child: ChannelNameText (
72- channel: channel,
73- ),
69+ padding: const EdgeInsets .symmetric (horizontal: 4.0 ),
70+ child: ChannelNameText (channel: channel),
7471 ),
7572 Padding (
76- padding: const EdgeInsets .symmetric (horizontal: 8 .0 ),
73+ padding: const EdgeInsets .symmetric (horizontal: 4 .0 ),
7774 child: Row (
7875 children: [
7976 Text (
8077 isSameWeek (channel.lastMessageAt! )
8178 ? formatDateSameWeek (channel.lastMessageAt! )
8279 : formatDate (channel.lastMessageAt! ),
83- style: TextStyle (
84- fontSize: 15 ,
80+ style: const TextStyle (
81+ fontSize: 13 ,
8582 color: CupertinoColors .systemGrey,
8683 ),
8784 ),
88- Icon (
89- CupertinoIcons .right_chevron,
90- color: CupertinoColors .systemGrey3,
85+ const Padding (
86+ padding: EdgeInsets .only (left: 4.0 ),
87+ child: Icon (
88+ CupertinoIcons .chevron_right,
89+ size: 16 ,
90+ color: CupertinoColors .systemGrey3,
91+ ),
9192 ),
9293 ],
9394 ),
9495 )
9596 ],
9697 ),
9798 Padding (
98- padding: const EdgeInsets .all (8 .0 ),
99+ padding: const EdgeInsets .all (4 .0 ),
99100 child: Text (
100101 '$prefix ${lastMessage ?.text ?? '' }' ,
101- style: TextStyle (
102+ style: const TextStyle (
102103 fontWeight: FontWeight .normal,
103104 color: CupertinoColors .systemGrey,
104- fontSize: 16 ,
105+ fontSize: 14 ,
105106 ),
106107 maxLines: 2 ,
107108 overflow: TextOverflow .ellipsis,
108109 ),
109110 ),
110- Divider (),
111+ const Divider (),
111112 ],
112113 ),
113114 )
0 commit comments