mirror of
https://github.com/stonega/tsacdop
synced 2025-01-23 12:20:26 +01:00
Don't open page from player on playing episode page.
This commit is contained in:
parent
d15b423fa4
commit
d38c984384
@ -378,7 +378,12 @@ class _EpisodeDetailState extends State<EpisodeDetail> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
Container(child: PlayerWidget(playerKey: _playerKey)),
|
Selector<AudioPlayerNotifier, EpisodeBrief>(
|
||||||
|
selector: (_, audio) => audio.episode,
|
||||||
|
builder: (_, data, __) => Container(
|
||||||
|
child: PlayerWidget(
|
||||||
|
playerKey: _playerKey,
|
||||||
|
isPlayingPage: data == widget.episodeItem))),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -623,8 +628,7 @@ class _MenuBarState extends State<MenuBar> {
|
|||||||
Selector<AudioPlayerNotifier, Tuple2<EpisodeBrief, bool>>(
|
Selector<AudioPlayerNotifier, Tuple2<EpisodeBrief, bool>>(
|
||||||
selector: (_, audio) => Tuple2(audio.episode, audio.playerRunning),
|
selector: (_, audio) => Tuple2(audio.episode, audio.playerRunning),
|
||||||
builder: (_, data, __) {
|
builder: (_, data, __) {
|
||||||
return (widget.episodeItem.title == data.item1?.title &&
|
return (widget.episodeItem == data.item1 && data.item2)
|
||||||
data.item2)
|
|
||||||
? Container(
|
? Container(
|
||||||
padding: EdgeInsets.only(right: 30),
|
padding: EdgeInsets.only(right: 30),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
|
@ -44,8 +44,9 @@ const List kMinPlayerHeight = <double>[70.0, 75.0, 80.0];
|
|||||||
const List kMaxPlayerHeight = <double>[300.0, 325.0, 350.0];
|
const List kMaxPlayerHeight = <double>[300.0, 325.0, 350.0];
|
||||||
|
|
||||||
class PlayerWidget extends StatelessWidget {
|
class PlayerWidget extends StatelessWidget {
|
||||||
PlayerWidget({this.playerKey});
|
PlayerWidget({this.playerKey, this.isPlayingPage = false});
|
||||||
final GlobalKey<AudioPanelState> playerKey;
|
final GlobalKey<AudioPanelState> playerKey;
|
||||||
|
final bool isPlayingPage;
|
||||||
Widget _miniPanel(BuildContext context) {
|
Widget _miniPanel(BuildContext context) {
|
||||||
var audio = Provider.of<AudioPlayerNotifier>(context, listen: false);
|
var audio = Provider.of<AudioPlayerNotifier>(context, listen: false);
|
||||||
final s = context.s;
|
final s = context.s;
|
||||||
@ -231,6 +232,7 @@ class PlayerWidget extends StatelessWidget {
|
|||||||
miniPanel: _miniPanel(context),
|
miniPanel: _miniPanel(context),
|
||||||
expandedPanel: ControlPanel(
|
expandedPanel: ControlPanel(
|
||||||
maxHeight: maxHeight,
|
maxHeight: maxHeight,
|
||||||
|
isPlayingPage: isPlayingPage,
|
||||||
onExpand: () {
|
onExpand: () {
|
||||||
playerKey.currentState.scrollToTop();
|
playerKey.currentState.scrollToTop();
|
||||||
},
|
},
|
||||||
@ -934,11 +936,17 @@ class SleepModeState extends State<SleepMode>
|
|||||||
}
|
}
|
||||||
|
|
||||||
class ControlPanel extends StatefulWidget {
|
class ControlPanel extends StatefulWidget {
|
||||||
ControlPanel({this.onExpand, this.onClose, this.maxHeight, Key key})
|
ControlPanel(
|
||||||
|
{this.onExpand,
|
||||||
|
this.onClose,
|
||||||
|
this.maxHeight,
|
||||||
|
this.isPlayingPage = false,
|
||||||
|
Key key})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
final VoidCallback onExpand;
|
final VoidCallback onExpand;
|
||||||
final VoidCallback onClose;
|
final VoidCallback onClose;
|
||||||
final double maxHeight;
|
final double maxHeight;
|
||||||
|
final bool isPlayingPage;
|
||||||
@override
|
@override
|
||||||
_ControlPanelState createState() => _ControlPanelState();
|
_ControlPanelState createState() => _ControlPanelState();
|
||||||
}
|
}
|
||||||
@ -1324,12 +1332,14 @@ class _ControlPanelState extends State<ControlPanel>
|
|||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
widget.onClose();
|
widget.onClose();
|
||||||
Navigator.push(
|
if (!widget.isPlayingPage) {
|
||||||
context,
|
Navigator.push(
|
||||||
FadeRoute(
|
context,
|
||||||
page: EpisodeDetail(
|
FadeRoute(
|
||||||
episodeItem: data.item1,
|
page: EpisodeDetail(
|
||||||
heroTag: 'playpanel')));
|
episodeItem: data.item1,
|
||||||
|
heroTag: 'playpanel')));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
|
Loading…
Reference in New Issue
Block a user