some ui stuff and skip
This commit is contained in:
parent
5c6a8a0a6d
commit
920fff6870
8 changed files with 89 additions and 87 deletions
|
@ -1,9 +1,11 @@
|
|||
import '../repositories/platform_integration_repository.dart';
|
||||
import '../usecases/pause.dart';
|
||||
import '../usecases/play.dart';
|
||||
import '../usecases/seek_to_next.dart';
|
||||
import '../usecases/seek_to_previous.dart';
|
||||
|
||||
class PlatformIntegrationActor {
|
||||
PlatformIntegrationActor(this._platformIntegrationInfoRepository, this._pause, this._play) {
|
||||
PlatformIntegrationActor(this._platformIntegrationInfoRepository, this._pause, this._play, this._seekToNext, this._seekToPrevious) {
|
||||
_platformIntegrationInfoRepository.eventStream
|
||||
.listen((event) => _handlePlatformIntegrationEvent(event));
|
||||
}
|
||||
|
@ -12,6 +14,8 @@ class PlatformIntegrationActor {
|
|||
|
||||
final Pause _pause;
|
||||
final Play _play;
|
||||
final SeekToNext _seekToNext;
|
||||
final SeekToPrevious _seekToPrevious;
|
||||
|
||||
void _handlePlatformIntegrationEvent(PlatformIntegrationEvent event) {
|
||||
switch (event.type) {
|
||||
|
@ -21,6 +25,12 @@ class PlatformIntegrationActor {
|
|||
case PlatformIntegrationEventType.pause:
|
||||
_pause();
|
||||
break;
|
||||
case PlatformIntegrationEventType.skipNext:
|
||||
_seekToNext();
|
||||
break;
|
||||
case PlatformIntegrationEventType.skipPrevious:
|
||||
_seekToPrevious();
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
|
|
@ -295,6 +295,8 @@ Future<void> setupGetIt() async {
|
|||
getIt(),
|
||||
getIt(),
|
||||
getIt(),
|
||||
getIt(),
|
||||
getIt(),
|
||||
),
|
||||
);
|
||||
|
||||
|
|
|
@ -56,8 +56,8 @@ class CurrentlyPlayingPage extends StatelessWidget {
|
|||
stops: const [
|
||||
0.0,
|
||||
0.2,
|
||||
0.55,
|
||||
0.7,
|
||||
0.6,
|
||||
0.75,
|
||||
1.0,
|
||||
],
|
||||
),
|
||||
|
@ -108,11 +108,11 @@ class CurrentlyPlayingPage extends StatelessWidget {
|
|||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
),
|
||||
const Spacer(
|
||||
flex: 1,
|
||||
flex: 10,
|
||||
),
|
||||
Expanded(
|
||||
flex: 1000,
|
||||
child: Center(
|
||||
flex: 720,
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8.0,
|
||||
|
@ -125,14 +125,41 @@ class CurrentlyPlayingPage extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
const Spacer(
|
||||
flex: 60,
|
||||
flex: 50,
|
||||
),
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(left: 2.0, right: 2.0),
|
||||
child: SongCustomizationButtons(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 12.0, right: 12.0),
|
||||
child: Center(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
song.title,
|
||||
overflow: TextOverflow.fade,
|
||||
softWrap: false,
|
||||
maxLines: 1,
|
||||
style: TEXT_BIG.copyWith(
|
||||
),
|
||||
),
|
||||
Text(
|
||||
song.artist,
|
||||
style: TEXT_SUBTITLE.copyWith(
|
||||
color: Colors.grey[100],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const Spacer(
|
||||
flex: 30,
|
||||
flex: 50,
|
||||
),
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(left: 6.0, right: 6.0),
|
||||
child: SongCustomizationButtons(),
|
||||
),
|
||||
const Spacer(
|
||||
flex: 20,
|
||||
),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 2.0),
|
||||
|
@ -146,7 +173,7 @@ class CurrentlyPlayingPage extends StatelessWidget {
|
|||
child: TimeProgressIndicator(),
|
||||
),
|
||||
const Spacer(
|
||||
flex: 100,
|
||||
flex: 60,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../domain/entities/song.dart';
|
||||
import '../theming.dart';
|
||||
import '../utils.dart';
|
||||
|
||||
class AlbumArt extends StatelessWidget {
|
||||
|
@ -31,57 +30,6 @@ class AlbumArt extends StatelessWidget {
|
|||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
song.title,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
// softWrap: false,
|
||||
maxLines: 2,
|
||||
style: TEXT_BIG.copyWith(
|
||||
shadows: [
|
||||
const Shadow(
|
||||
blurRadius: 2.0,
|
||||
color: Colors.black87,
|
||||
offset: Offset(.5, .5),
|
||||
),
|
||||
const Shadow(
|
||||
blurRadius: 8.0,
|
||||
color: Colors.black54,
|
||||
offset: Offset(0, 0),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Text(
|
||||
song.artist,
|
||||
style: TEXT_SUBTITLE.copyWith(
|
||||
color: Colors.grey[100],
|
||||
shadows: [
|
||||
const Shadow(
|
||||
blurRadius: 2.0,
|
||||
color: Colors.black87,
|
||||
offset: Offset(.5, .5),
|
||||
),
|
||||
const Shadow(
|
||||
blurRadius: 8.0,
|
||||
color: Colors.black54,
|
||||
offset: Offset(0, 0),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
@ -29,6 +29,7 @@ class LikeButton extends StatelessWidget {
|
|||
color: Colors.white24,
|
||||
),
|
||||
onPressed: () => musicDataStore.incrementLikeCount(song),
|
||||
visualDensity: VisualDensity.compact,
|
||||
);
|
||||
} else {
|
||||
return IconButton(
|
||||
|
@ -56,6 +57,7 @@ class LikeButton extends StatelessWidget {
|
|||
}
|
||||
return musicDataStore.resetLikeCount(song);
|
||||
},
|
||||
visualDensity: VisualDensity.compact,
|
||||
);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -33,7 +33,7 @@ class NextButton extends StatelessWidget {
|
|||
}
|
||||
return IconButton(
|
||||
icon: const Icon(
|
||||
Icons.skip_next,
|
||||
Icons.skip_next_rounded,
|
||||
),
|
||||
iconSize: iconSize,
|
||||
onPressed: null,
|
||||
|
|
|
@ -17,31 +17,34 @@ class SongCustomizationButtons extends StatelessWidget {
|
|||
|
||||
return Observer(
|
||||
builder: (BuildContext context) {
|
||||
print('building buttons');
|
||||
final Song song = audioStore.currentSongStream.value;
|
||||
return Row(
|
||||
children: [
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
song.next == null ? Icons.link_off : Icons.link,
|
||||
color: song.next == null ? Colors.white24 : Colors.white,
|
||||
return Container(
|
||||
child: Row(
|
||||
children: [
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
song.next == null ? Icons.link_off : Icons.link,
|
||||
color: song.next == null ? Colors.white24 : Colors.white,
|
||||
),
|
||||
iconSize: 20.0,
|
||||
onPressed: () => musicDataStore.toggleNextSongLink(song),
|
||||
visualDensity: VisualDensity.compact,
|
||||
),
|
||||
iconSize: 20.0,
|
||||
onPressed: () => musicDataStore.toggleNextSongLink(song),
|
||||
),
|
||||
const Spacer(),
|
||||
const LikeButton(),
|
||||
const Spacer(),
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
Icons.remove_circle_outline_rounded,
|
||||
size: 20.0,
|
||||
color: song.blocked ? Colors.white : Colors.white24,
|
||||
const LikeButton(
|
||||
iconSize: 20.0,
|
||||
),
|
||||
onPressed: () => musicDataStore.setSongBlocked(song, !song.blocked),
|
||||
),
|
||||
],
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
Icons.remove_circle_outline_rounded,
|
||||
size: 20.0,
|
||||
color: song.blocked ? Colors.white : Colors.white24,
|
||||
),
|
||||
onPressed: () => musicDataStore.setSongBlocked(song, !song.blocked),
|
||||
visualDensity: VisualDensity.compact,
|
||||
),
|
||||
],
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
|
|
@ -25,6 +25,16 @@ class PlatformIntegrationDataSourceImpl extends BaseAudioHandler
|
|||
_eventSubject.add(PlatformIntegrationEvent(type: PlatformIntegrationEventType.pause));
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> skipToNext() async {
|
||||
_eventSubject.add(PlatformIntegrationEvent(type: PlatformIntegrationEventType.skipNext));
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> skipToPrevious() async {
|
||||
_eventSubject.add(PlatformIntegrationEvent(type: PlatformIntegrationEventType.skipPrevious));
|
||||
}
|
||||
|
||||
// PlatformIntegrationDataSource interface
|
||||
|
||||
@override
|
||||
|
|
Loading…
Add table
Reference in a new issue