From 101c1ab7973541d67c8e3a491cad5f256a526548 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Mon, 1 Jul 2019 12:18:10 +0200 Subject: [PATCH] Added support for YouTube videos --- lib/ui/tiles/post_tile.dart | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/ui/tiles/post_tile.dart b/lib/ui/tiles/post_tile.dart index 746a124..80f1bda 100644 --- a/lib/ui/tiles/post_tile.dart +++ b/lib/ui/tiles/post_tile.dart @@ -168,6 +168,10 @@ class _PostTileState extends State { postContent = _buildPostImage(); break; + case PostKind.YOUTUBE: + postContent = _buildPostYouTube(); + break; + case PostKind.WEB_LINK: postContent = _buildPostWebLink(); break; @@ -259,6 +263,22 @@ class _PostTileState extends State { ); } + Widget _buildPostYouTube() { + return RaisedButton( + color: Colors.red, + textColor: Colors.white, + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(Icons.ondemand_video), + Text(tr("YouTube movie")) + ], + ), + onPressed: () => + launch("https://youtube.com/watch/?v=" + widget.post.filePath), + ); + } + Widget _buildPostWebLink() { return Card( color: Color.fromRGBO(0xf7, 0xf7, 0xf7, 1),