1
0
mirror of https://github.com/stonega/tsacdop synced 2025-02-10 16:40:44 +01:00

Fixed get player height issue.

This commit is contained in:
stonegate 2020-07-31 16:50:48 +08:00
parent 4241af7ec8
commit 6bc0d3620c
2 changed files with 23 additions and 21 deletions

View File

@ -219,11 +219,12 @@ class PlayerWidget extends StatelessWidget {
return Selector<AudioPlayerNotifier, Tuple2<bool, PlayerHeight>>( return Selector<AudioPlayerNotifier, Tuple2<bool, PlayerHeight>>(
selector: (_, audio) => Tuple2(audio.playerRunning, audio?.playerHeight), selector: (_, audio) => Tuple2(audio.playerRunning, audio?.playerHeight),
builder: (_, data, __) { builder: (_, data, __) {
if (!data.item1) {
return Center();
} else {
var minHeight = kMinPlayerHeight[data.item2.index]; var minHeight = kMinPlayerHeight[data.item2.index];
var maxHeight = kMaxPlayerHeight[data.item2.index]; var maxHeight = kMaxPlayerHeight[data.item2.index];
return !data.item1 return AudioPanel(
? Center()
: AudioPanel(
minHeight: minHeight, minHeight: minHeight,
maxHeight: maxHeight, maxHeight: maxHeight,
key: playerKey, key: playerKey,
@ -237,6 +238,7 @@ class PlayerWidget extends StatelessWidget {
playerKey.currentState.backToMini(); playerKey.currentState.backToMini();
}, },
)); ));
}
}, },
); );
} }

View File

@ -208,12 +208,12 @@ class AudioPlayerNotifier extends ChangeNotifier {
} }
@override @override
void addListener(VoidCallback listener) async { void addListener(VoidCallback listener) {
await _getPlayerHeight();
super.addListener(listener); super.addListener(listener);
_getPlayerHeight();
_queueUpdate = false; _queueUpdate = false;
await _getAutoSleepTimer(); _getAutoSleepTimer();
await AudioService.connect(); AudioService.connect();
var running = AudioService.running; var running = AudioService.running;
if (running) {} if (running) {}
} }