imessage fix (#6)
* first draft : static views wip * refactor to ChatMessage and ChatMessageHeader * add pedantic * fix lints * remove hardcoded message * appBar title : iMessage * format date * cupertino style and model view * fix display of message based on isReceived or sent * SendMessageInput * refactor to MessagesPage * MissingPluginException * use builtins instead of custom stream builders * handle isReceived * delete channel header * fix layout issues in ChannelPreview * fix formatDate * sticky message input * usage of builtin MessageListCore * remove unused imports and a todo * rename channelsStates to channels * replace file imports /w package:imessage/filename * remove size required ChannelNameText * lint and format * sendMessage * transition animation * stream_chat_flutter_core instead * format Date differently if same week * add padding to bubble * remove iMessage text from header * reverse message order * if same day don't display date * padding chat bubble right * remove unused extension * constraint message width * group messages By dates * unused import * fix bug input + layout+ preview onTap * change updatedAt to createdAt * add filter on channel * handle refresh * handle pagination with core LazyLoadScrollView * preview simple medias * upload bug * fix attachment * visual changes to message input * remove size * clean up * wait 5 sec before displaying image(hack) * fix a couple of things * fix padding in channel preview * fix upload + debugShowCheckedModeBanner false * fix overflow and refactor to Divider * fix android build * add imessage clone hero image * update README Co-authored-by: Sacha Arbonel <[email protected]>
This commit is contained in:
co-authored by
Sacha Arbonel
parent
6feccd57dd
commit
f861eb4584
@@ -9,6 +9,7 @@ import 'utils.dart';
|
||||
class ChannelPreview extends StatelessWidget {
|
||||
final VoidCallback onTap;
|
||||
final Channel channel;
|
||||
|
||||
const ChannelPreview({
|
||||
Key key,
|
||||
@required this.onTap,
|
||||
@@ -24,9 +25,9 @@ class ChannelPreview extends StatelessWidget {
|
||||
? lastMessage?.attachments //TODO: ugly
|
||||
?.map((e) {
|
||||
if (e.type == 'image') {
|
||||
return '📷';
|
||||
return '📷 ';
|
||||
} else if (e.type == 'video') {
|
||||
return '🎬';
|
||||
return '🎬 ';
|
||||
}
|
||||
return null;
|
||||
})
|
||||
@@ -35,57 +36,78 @@ class ChannelPreview extends StatelessWidget {
|
||||
: '';
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 8.0),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
color: CupertinoColors.white),
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: Container(
|
||||
constraints: BoxConstraints.tightFor(
|
||||
height: 90,
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8.0,
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
ChannelImage(channel: channel, size: 50),
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(vertical: 16.0, horizontal: 8.0),
|
||||
child: ChannelImage(
|
||||
channel: channel,
|
||||
size: 50,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: ChannelNameText(
|
||||
channel: channel,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: ChannelNameText(
|
||||
channel: channel,
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: Text(
|
||||
isSameWeek(channel.lastMessageAt)
|
||||
? formatDateSameWeek(channel.lastMessageAt)
|
||||
: formatDate(channel.lastMessageAt),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: CupertinoColors.systemGrey),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
'$prefix ${lastMessage?.text ?? ''}',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.normal,
|
||||
color: CupertinoColors.systemGrey),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
isSameWeek(channel.lastMessageAt)
|
||||
? formatDateSameWeek(channel.lastMessageAt)
|
||||
: formatDate(channel.lastMessageAt),
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: CupertinoColors.systemGrey,
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
CupertinoIcons.right_chevron,
|
||||
color: CupertinoColors.systemGrey3,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
'$prefix${lastMessage?.text ?? ''}',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.normal,
|
||||
color: CupertinoColors.systemGrey,
|
||||
fontSize: 16,
|
||||
),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Divider(),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user