Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/config/app_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ abstract class AppConfig {
static const String pushNotificationsAppId = 'uz.uzinfocom.uchar';
static const double borderRadius = 18.0;
static const double columnWidth = 360.0;
static const double imageMessagePadding = 2.5;
static const double innerWidgetRadius = borderRadius - imageMessagePadding;

static const String website = 'https://uchar.uz';
static const String enablePushTutorial =
Expand Down
290 changes: 145 additions & 145 deletions lib/pages/chat/events/image_bubble.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,179 +79,179 @@ class ImageBubble extends StatelessWidget {

@override
Widget build(BuildContext context) {
var borderRadius =
final borderRadius =
this.borderRadius ?? BorderRadius.circular(AppConfig.borderRadius);

final imageBorderRadius = BorderRadius.only(
topLeft: Radius.circular(AppConfig.borderRadius - 2),
topRight: Radius.circular(AppConfig.borderRadius - 2),
bottomLeft: Radius.circular(AppConfig.borderRadius / 2),
bottomRight: Radius.circular(AppConfig.borderRadius / 2),
);

final fileDescription = event.fileDescription;
final textColor = this.textColor;

if (fileDescription != null) {
borderRadius = borderRadius.copyWith(
bottomLeft: Radius.zero,
bottomRight: Radius.zero,
);
}
// if (fileDescription != null) {
// borderRadius = borderRadius.copyWith(
// bottomLeft: Radius.zero,
// bottomRight: Radius.zero,
// );
// }

final messageTime = event.originServerTs;
final formattedTime =
"${messageTime.hour.toString().padLeft(2, '0')}:${messageTime.minute.toString().padLeft(2, '0')}";

return Column(
mainAxisSize: .min,
spacing: 6,
children: [
Material(
color: Colors.transparent,
clipBehavior: Clip.hardEdge,
shape: RoundedRectangleBorder(borderRadius: borderRadius),
child: InkWell(
onTap: () => _onTap(context),
borderRadius: borderRadius,
child: Padding(
padding: const EdgeInsets.all(2.5),
child: Hero(
tag: event.eventId,
child: ClipRRect(
borderRadius: imageBorderRadius,
child: Stack(
alignment: Alignment.bottomRight,
children: [
MxcImage(
event: event,
width: width,
height: height,
fit: fit,
animated: animated,
isThumbnail: thumbnailOnly,
placeholder: event.messageType == MessageTypes.Sticker
? null
: _buildPlaceholder,
),

if (fileDescription == null)
Padding(
padding: const EdgeInsets.only(
right: 8.0,
bottom: 8.0,
return SizedBox(
width: width,
child: Column(
mainAxisSize: .min,
spacing: 6,
children: [
SizedBox(
height: height,
width: width,
child: Material(
color: Colors.transparent,
clipBehavior: Clip.hardEdge,
shape: RoundedRectangleBorder(borderRadius: borderRadius),
child: InkWell(
onTap: () => _onTap(context),
borderRadius: borderRadius,
child: Padding(
padding: const EdgeInsets.all(AppConfig.imageMessagePadding),
child: Hero(
tag: event.eventId,
child: ClipRRect(
borderRadius: borderRadius,
child: Stack(
alignment: Alignment.bottomRight,
children: [
MxcImage(
event: event,
width: width,
height: height,
fit: fit,
animated: animated,
isThumbnail: thumbnailOnly,
placeholder: event.messageType == MessageTypes.Sticker
? null
: _buildPlaceholder,
),
child: DecoratedBox(
decoration: BoxDecoration(
color: Colors.black.withValues(alpha: .3),
borderRadius: BorderRadius.all(
Radius.circular(AppConfig.borderRadius / 3),

if (fileDescription == null)
Padding(
padding: const EdgeInsets.only(
right: 8.0,
bottom: 8.0,
),
),
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 7,
vertical: 3,
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
formattedTime,
style: TextStyle(
color: Colors.white,
fontSize: 10,
),
child: DecoratedBox(
decoration: BoxDecoration(
color: Colors.black.withValues(alpha: .3),
borderRadius: BorderRadius.all(
Radius.circular(AppConfig.borderRadius / 3),
),

if (messageStatus != null) SizedBox(width: 6,),

if (messageStatus != null) MessageStatusWidget(
iconColor: Colors.white,
status: messageStatus,
),
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 7,
vertical: 3,
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
formattedTime,
style: TextStyle(
color: Colors.white,
fontSize: 10,
),
),

if (messageStatus != null) SizedBox(width: 6,),

if (messageStatus != null) MessageStatusWidget(
iconColor: Colors.white,
status: messageStatus,
),
],
),
],
),
),
),
),
),
],
],
),
),
),
),
),
),
),
),
if (fileDescription != null && textColor != null)
SizedBox(
width: width,
child: Padding(
padding: const EdgeInsets.only(left: 6, right: 12,),
child: SizedBox(
width: double.infinity,
child: Wrap(
// alignment: WrapAlignment.end,
alignment: WrapAlignment.start,
children: [
Linkify(
text: fileDescription,
textScaleFactor: MediaQuery.textScalerOf(
context,
).scale(1),
style: TextStyle(
color: textColor,
fontSize:
AppSettings.fontSizeFactor.value *
AppConfig.messageFontSize,
),
options: const LinkifyOptions(humanize: false),
linkStyle: TextStyle(
color: linkColor,
fontSize:
AppSettings.fontSizeFactor.value *
AppConfig.messageFontSize,
decoration: TextDecoration.underline,
decorationColor: linkColor,
if (fileDescription != null && textColor != null)
SizedBox(
width: width,
child: Padding(
padding: const EdgeInsets.only(left: 6, right: 12,),
child: SizedBox(
width: double.infinity,
child: Wrap(
// alignment: WrapAlignment.end,
alignment: WrapAlignment.start,
children: [
Linkify(
text: fileDescription,
textScaleFactor: MediaQuery.textScalerOf(
context,
).scale(1),
style: TextStyle(
color: textColor,
fontSize:
AppSettings.fontSizeFactor.value *
AppConfig.messageFontSize,
),
options: const LinkifyOptions(humanize: false),
linkStyle: TextStyle(
color: linkColor,
fontSize:
AppSettings.fontSizeFactor.value *
AppConfig.messageFontSize,
decoration: TextDecoration.underline,
decorationColor: linkColor,
),
onOpen: (url) =>
UrlLauncher(context, url.url).launchUrl(),
),
onOpen: (url) =>
UrlLauncher(context, url.url).launchUrl(),
),

Align(
alignment: Alignment.topRight,
child: Transform.translate(
offset: const Offset(0, -15),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
formattedTime,
style: TextStyle(
color: textColor,
fontSize:
AppSettings.fontSizeFactor.value *
(AppConfig.messageFontSize - 5),

Align(
alignment: Alignment.topRight,
child: Transform.translate(
offset: const Offset(0, -15),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
formattedTime,
style: TextStyle(
color: textColor,
fontSize:
AppSettings.fontSizeFactor.value *
(AppConfig.messageFontSize - 5),
),
),
),

const SizedBox(
width: 6,
),

MessageStatusWidget(
iconColor: textColor,
status: messageStatus,
),
],

const SizedBox(
width: 6,
),

MessageStatusWidget(
iconColor: textColor,
status: messageStatus,
),
],
),
),
),
),
],
],
),
),
),
),
),
],
],
),
);
}
}
Loading
Loading