Can download songs

This commit is contained in:
2022-06-05 15:49:53 +02:00
parent c82dc6754f
commit dd81d5654c
7 changed files with 107 additions and 2 deletions

View File

@ -8,6 +8,7 @@ import 'package:flutter/material.dart';
import 'package:music_web_player/api.dart';
import 'package:music_web_player/ui/cover_image.dart';
import 'package:music_web_player/ui/player_web_interface.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:video_player/video_player.dart';
extension DurationExt on Duration {
@ -191,7 +192,24 @@ class _MusicPlayerState extends State<MusicPlayer> {
),
Positioned(
top: 10, right: 10, child: _buildToggleListButton()),
top: 10,
right: 10,
child: fluent.Row(
children: [
_buildToggleListButton(),
],
)),
Positioned(
bottom: 10,
right: 10,
child: fluent.Row(
children: [
_buildDownloadTrackButton(),
const SizedBox(width: 10),
_buildAboutButton(),
],
)),
],
),
),
@ -284,6 +302,22 @@ class _MusicPlayerState extends State<MusicPlayer> {
),
);
Widget _buildDownloadTrackButton() => fluent.Button(
onPressed: () =>
launchUrlString(currMusic.musicURL, webOnlyWindowName: "_blank"),
child: const fluent.Icon(fluent.FluentIcons.download),
);
Widget _buildAboutButton() => fluent.Button(
onPressed: () => showLicensePage(
context: context,
applicationName: "Music Player",
applicationIcon:
const fluent.Icon(FluentIcons.music_note_2_24_regular),
),
child: const fluent.Icon(fluent.FluentIcons.info),
);
Widget _buildToggleListButton() => fluent.ToggleButton(
checked: _showPlaylist,
onChanged: (s) => setState(() => _showPlaylist = s),