From 02743f239fafed86d0043b2e90d4e47c85a9e83f Mon Sep 17 00:00:00 2001 From: Outlet7493 Date: Sun, 14 Jan 2024 13:50:59 +0000 Subject: [PATCH] add share button to video modal sheet --- lib/l10n/app_en.arb | 4 ++++ .../views/components/video_modal_sheet.dart | 20 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 4738f617..2f2a538f 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -96,6 +96,10 @@ } } }, + "share": "Share", + "@share": { + "description": "asking user if to share" + }, "shareYoutubeLink": "Share YouTube link", "@shareYoutubeLink": { "description": "asking user to share youtube link" diff --git a/lib/videos/views/components/video_modal_sheet.dart b/lib/videos/views/components/video_modal_sheet.dart index c9ce9925..01f362ff 100644 --- a/lib/videos/views/components/video_modal_sheet.dart +++ b/lib/videos/views/components/video_modal_sheet.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:invidious/player/states/player.dart'; +import 'package:invidious/utils.dart'; import 'package:invidious/videos/models/base_video.dart'; import 'package:invidious/videos/views/components/add_to_playlist_button.dart'; import 'package:invidious/videos/views/components/download_modal_sheet.dart'; @@ -56,6 +57,11 @@ class VideoModalSheet extends StatelessWidget { DownloadModalSheet.showVideoModalSheet(context, video); } + void _showSharingSheet(BuildContext context) { + Navigator.of(context).pop(); + showSharingSheet(context, video); + } + @override Widget build(BuildContext context) { var locals = AppLocalizations.of(context)!; @@ -110,6 +116,20 @@ class VideoModalSheet extends StatelessWidget { ], ), ), + Padding( + padding: getDeviceType() == DeviceType.phone + ? const EdgeInsets.only(top: 8.0) + : const EdgeInsets.only(right: 16.0), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + IconButton.filledTonal( + onPressed: () => _showSharingSheet(context), + icon: const Icon(Icons.share)), + Text(locals.share) + ], + ), + ), ], ), ),