This repository has been archived by the owner on Jul 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
match page - loading screen before chat, fix unsent message not disap…
…pearing, search by name instead of username, display username in profile page, unsent message message border (and refactor messagetilecontent)
- Loading branch information
Showing
12 changed files
with
433 additions
and
474 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:intl/intl.dart'; | ||
import 'package:tundr/constants/my_palette.dart'; | ||
import 'package:tundr/models/message.dart'; | ||
import 'package:tundr/pages/media/media_view.dart'; | ||
import 'package:tundr/utils/from_theme.dart'; | ||
|
||
import 'package:tundr/widgets/media/media_thumbnail.dart'; | ||
import 'referenced_message_tile.dart'; | ||
|
||
class MessageTileContent extends StatelessWidget { | ||
final Message message; | ||
final bool fromMe; | ||
final Widget statusIcon; | ||
final Function onViewReferencedMessage; | ||
|
||
MessageTileContent({ | ||
@required this.message, | ||
@required this.fromMe, | ||
@required this.statusIcon, | ||
@required this.onViewReferencedMessage, | ||
}); | ||
|
||
void _openMedia(BuildContext context) => Navigator.push( | ||
context, | ||
MaterialPageRoute( | ||
builder: (context) => MediaViewPage(media: message.media), | ||
), | ||
); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Column( | ||
crossAxisAlignment: | ||
fromMe ? CrossAxisAlignment.end : CrossAxisAlignment.start, | ||
children: <Widget>[ | ||
Container( | ||
constraints: BoxConstraints(maxWidth: 200), | ||
padding: fromMe ? const EdgeInsets.all(8) : EdgeInsets.zero, | ||
decoration: fromMe | ||
? fromTheme( | ||
context, | ||
dark: BoxDecoration(color: MyPalette.white), | ||
light: BoxDecoration( | ||
color: MyPalette.white, | ||
borderRadius: BorderRadius.circular(10), | ||
boxShadow: [MyPalette.primaryShadow], | ||
), | ||
) | ||
: null, | ||
child: Column( | ||
crossAxisAlignment: | ||
fromMe ? CrossAxisAlignment.end : CrossAxisAlignment.start, | ||
children: <Widget>[ | ||
if (message.referencedMessage != null) | ||
Padding( | ||
padding: const EdgeInsets.only(bottom: 8), | ||
child: GestureDetector( | ||
child: ReferencedMessageTile( | ||
message: message.referencedMessage, | ||
), | ||
onTap: onViewReferencedMessage, | ||
), | ||
), | ||
if (message.media != null) | ||
Padding( | ||
padding: const EdgeInsets.only(bottom: 8), | ||
child: GestureDetector( | ||
child: SizedBox( | ||
width: 200, | ||
height: 260, | ||
child: ClipRRect( | ||
borderRadius: fromTheme( | ||
context, | ||
dark: BorderRadius.zero, | ||
light: BorderRadius.circular(6), | ||
), | ||
child: MediaThumbnail(message.media), | ||
), | ||
), | ||
onTap: () => _openMedia(context), | ||
), | ||
), | ||
Text( | ||
message.text, | ||
style: TextStyle( | ||
color: fromMe | ||
? MyPalette.black | ||
: Theme.of(context).colorScheme.onPrimary, | ||
fontSize: 16, | ||
), | ||
), | ||
], | ||
), | ||
), | ||
SizedBox(height: 5), | ||
Row( | ||
mainAxisSize: MainAxisSize.min, | ||
children: <Widget>[ | ||
Text( | ||
DateFormat.jm().format(message.sentOn), | ||
style: TextStyle( | ||
color: MyPalette.grey, | ||
fontSize: 12, | ||
), | ||
), | ||
SizedBox(width: 4), | ||
if (statusIcon != null) statusIcon, | ||
], | ||
), | ||
], | ||
); | ||
} | ||
} |
Oops, something went wrong.