mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-06-19 08:15:16 +00:00
Added support of weblink posts
This commit is contained in:
@ -23,6 +23,7 @@ import 'package:comunic/utils/navigation_utils.dart';
|
||||
import 'package:comunic/utils/post_utils.dart';
|
||||
import 'package:comunic/utils/ui_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
/// Single posts tile
|
||||
///
|
||||
@ -166,6 +167,10 @@ class _PostTileState extends State<PostTile> {
|
||||
postContent = _buildPostImage();
|
||||
break;
|
||||
|
||||
case PostKind.WEB_LINK:
|
||||
postContent = _buildPostWebLink();
|
||||
break;
|
||||
|
||||
default:
|
||||
}
|
||||
|
||||
@ -249,6 +254,41 @@ class _PostTileState extends State<PostTile> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPostWebLink() {
|
||||
return Card(
|
||||
color: Color.fromRGBO(0xf7, 0xf7, 0xf7, 1),
|
||||
child: InkWell(
|
||||
onTap: () => launch(widget.post.linkURL),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 8.0),
|
||||
child: NetworkImageWidget(
|
||||
url: widget.post.linkImage,
|
||||
width: 70,
|
||||
roundedEdges: false,
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(htmlDecodeCharacters(widget.post.linkTitle),
|
||||
style: TextStyle(fontSize: 20.0)),
|
||||
Text(
|
||||
widget.post.linkURL,
|
||||
maxLines: 3,
|
||||
),
|
||||
Text(htmlDecodeCharacters(widget.post.linkDescription))
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Build the list of comments
|
||||
Widget _buildComments() {
|
||||
assert(widget.post.hasComments);
|
||||
|
Reference in New Issue
Block a user