add inkwell
This commit is contained in:
+78
-57
@@ -16,6 +16,7 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
|||||||
|
|
||||||
import 'image_group.dart';
|
import 'image_group.dart';
|
||||||
import 'message_text.dart';
|
import 'message_text.dart';
|
||||||
|
import 'utils.dart';
|
||||||
|
|
||||||
typedef AttachmentBuilder = Widget Function(BuildContext, Message, Attachment);
|
typedef AttachmentBuilder = Widget Function(BuildContext, Message, Attachment);
|
||||||
|
|
||||||
@@ -354,69 +355,89 @@ class _MessageWidgetState extends State<MessageWidget> {
|
|||||||
var hostDisplayName =
|
var hostDisplayName =
|
||||||
_getWebsiteName(hostName.toLowerCase()) ?? hostName.capitalize();
|
_getWebsiteName(hostName.toLowerCase()) ?? hostName.capitalize();
|
||||||
|
|
||||||
return Column(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
if (urlAttachment.imageUrl != null)
|
Column(
|
||||||
SizedBox(
|
children: [
|
||||||
height: 16.0,
|
if (urlAttachment.imageUrl != null)
|
||||||
),
|
SizedBox(
|
||||||
if (urlAttachment.imageUrl != null)
|
height: 16.0,
|
||||||
Container(
|
),
|
||||||
margin: EdgeInsets.symmetric(horizontal: 8.0),
|
if (urlAttachment.imageUrl != null)
|
||||||
child: Stack(
|
Container(
|
||||||
clipBehavior: Clip.antiAlias,
|
margin: EdgeInsets.symmetric(horizontal: 8.0),
|
||||||
children: [
|
child: Stack(
|
||||||
CachedNetworkImage(imageUrl: urlAttachment.imageUrl),
|
clipBehavior: Clip.antiAlias,
|
||||||
Positioned(
|
children: [
|
||||||
left: 0.0,
|
CachedNetworkImage(imageUrl: urlAttachment.imageUrl),
|
||||||
bottom: 0.0,
|
Positioned(
|
||||||
child: Container(
|
left: 0.0,
|
||||||
child: Padding(
|
bottom: 0.0,
|
||||||
padding: const EdgeInsets.only(
|
child: Container(
|
||||||
top: 8.0, left: 8.0, right: 8.0),
|
child: Padding(
|
||||||
child: Text(
|
padding: const EdgeInsets.only(
|
||||||
hostDisplayName,
|
top: 8.0,
|
||||||
style: TextStyle(
|
left: 8.0,
|
||||||
fontWeight: FontWeight.w700,
|
right: 8.0,
|
||||||
color: Color(0xFF006CFF),
|
),
|
||||||
|
child: Text(
|
||||||
|
hostDisplayName,
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
color: Color(0xFF006CFF),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topRight: Radius.circular(16.0),
|
||||||
|
),
|
||||||
|
color: Color(0xFFE9F2FF),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
decoration: BoxDecoration(
|
],
|
||||||
borderRadius:
|
),
|
||||||
BorderRadius.only(topRight: Radius.circular(16.0)),
|
clipBehavior: Clip.antiAlias,
|
||||||
color: Color(0xFFE9F2FF),
|
decoration:
|
||||||
|
BoxDecoration(borderRadius: BorderRadius.circular(8.0)),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: widget.textPadding,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
if (urlAttachment.title != null)
|
||||||
|
Text(
|
||||||
|
urlAttachment.title,
|
||||||
|
maxLines: 1,
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 12.0,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
if (urlAttachment.text != null)
|
||||||
),
|
Text(
|
||||||
],
|
urlAttachment.text,
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
fontSize: 12.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Positioned.fill(
|
||||||
|
child: Material(
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () => launchURL(
|
||||||
|
context,
|
||||||
|
urlAttachment.ogScrapeUrl,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
clipBehavior: Clip.antiAlias,
|
|
||||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(8.0)),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: widget.textPadding,
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
if (urlAttachment.title != null)
|
|
||||||
Text(
|
|
||||||
urlAttachment.title,
|
|
||||||
maxLines: 1,
|
|
||||||
style: TextStyle(
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
fontSize: 12.0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (urlAttachment.text != null)
|
|
||||||
Text(
|
|
||||||
urlAttachment.text,
|
|
||||||
style: TextStyle(
|
|
||||||
fontWeight: FontWeight.w400,
|
|
||||||
fontSize: 12.0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user