Skip to content

Commit

Permalink
feat: add share file in mobile playing page
Browse files Browse the repository at this point in the history
  • Loading branch information
Yesterday17 committed Aug 11, 2024
1 parent d3d87be commit b89c7e4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/ui/page/playing/playing_mobile_widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,18 @@ class PlayingScreenMobileBottomBar extends ConsumerWidget {
);
},
),
MenuItemButton(
leadingIcon: const Icon(Icons.file_copy),
child: const Text('[DEV] Export file'),
onPressed: () {
final track = player.playing.source!.track;
final box = context.findRenderObject() as RenderBox?;
shareTrackFile(
track,
box!.localToGlobal(Offset.zero) & box.size,
);
},
),
],
child: const Icon(Icons.more_vert_rounded),
),
Expand Down
9 changes: 9 additions & 0 deletions lib/utils/share.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,12 @@ void shareTrackInfo(TrackInfoWithAlbum track, Rect? sharePositionOrigin,
sharePositionOrigin: sharePositionOrigin,
);
}

void shareTrackFile(TrackInfoWithAlbum track, Rect? sharePositionOrigin) {
final id = track.id;
Share.shareXFiles(
[XFile(getAudioCachePath(id))],
subject: 'Audio File',
sharePositionOrigin: sharePositionOrigin,
);
}

0 comments on commit b89c7e4

Please sign in to comment.