Skip to content

Commit

Permalink
Merge pull request #458 from Outlet7493/video-modal-sheet-share
Browse files Browse the repository at this point in the history
Add share to video modal sheet and bug fix
  • Loading branch information
lamarios authored Jan 15, 2024
2 parents d0d045d + 02743f2 commit 4357e71
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions lib/videos/states/add_to_playlist.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class AddToPlaylistCubit extends Cubit<AddToPlaylistController> {
late List<Playlist> playlists;
if (state.isLoggedIn) {
playlists = await service.getUserPlaylists();
} else {
playlists = List.empty();
}
emit(state.copyWith(playlists: playlists, loading: false));
}
Expand Down
20 changes: 20 additions & 0 deletions lib/videos/views/components/video_modal_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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)!;
Expand Down Expand Up @@ -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)
],
),
),
],
),
),
Expand Down
2 changes: 1 addition & 1 deletion submodules/flutter
Submodule flutter updated 139 files

0 comments on commit 4357e71

Please sign in to comment.