-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(radio): add return to livestream & play similar station buttons
Fixes #937
- Loading branch information
1 parent
3790021
commit 8aa1207
Showing
9 changed files
with
189 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import '../../common/view/icons.dart'; | ||
import '../../l10n/l10n.dart'; | ||
import '../../player/player_model.dart'; | ||
import '../../search/search_model.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:watch_it/watch_it.dart'; | ||
|
||
import '../radio_model.dart'; | ||
|
||
class NextStationButton extends StatelessWidget with WatchItMixin { | ||
const NextStationButton({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final loading = watchPropertyValue((SearchModel m) => m.loading); | ||
final audio = watchPropertyValue((PlayerModel m) => m.audio); | ||
|
||
return IconButton( | ||
tooltip: context.l10n.searchSimilarStation, | ||
onPressed: loading | ||
? null | ||
: () { | ||
if (audio == null) return; | ||
di<RadioModel>().init().then((host) { | ||
if (host == null) return null; | ||
return di<SearchModel>().nextSimilarStation(audio).then( | ||
(station) { | ||
if (station == audio) return; | ||
di<PlayerModel>().startPlaylist( | ||
audios: [station], | ||
listName: station.uuid ?? station.toString(), | ||
); | ||
}, | ||
); | ||
}); | ||
}, | ||
icon: Icon(Iconz().explore), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.