mucke/lib/presentation/widgets/song_customization_buttons.dart

50 lines
1.6 KiB
Dart
Raw Normal View History

2020-09-19 17:08:48 +02:00
import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:provider/provider.dart';
2020-09-19 20:30:41 +02:00
import '../../domain/entities/song.dart';
2020-09-19 17:08:48 +02:00
import '../state/audio_store.dart';
import '../state/music_data_store.dart';
2020-12-31 17:52:20 +01:00
import 'like_button.dart';
2020-09-19 17:08:48 +02:00
class SongCustomizationButtons extends StatelessWidget {
const SongCustomizationButtons({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
final MusicDataStore musicDataStore = Provider.of<MusicDataStore>(context);
final AudioStore audioStore = Provider.of<AudioStore>(context);
return Observer(
2020-09-19 20:30:41 +02:00
builder: (BuildContext context) {
2020-11-15 16:36:50 +01:00
print('building buttons');
final Song song = audioStore.currentSongStream.value;
2020-09-19 20:30:41 +02:00
return Row(
children: [
IconButton(
2020-09-20 12:33:11 +02:00
icon: Icon(
2020-12-31 17:52:20 +01:00
song.next == null ? Icons.link_off : Icons.link,
color: song.next == null ? Colors.white24 : Colors.white,
2020-09-20 12:33:11 +02:00
),
iconSize: 20.0,
onPressed: () => musicDataStore.toggleNextSongLink(song),
2020-09-19 17:08:48 +02:00
),
const Spacer(),
2020-12-31 17:52:20 +01:00
const LikeButton(),
const Spacer(),
2020-09-19 20:30:41 +02:00
IconButton(
icon: Icon(
2020-12-31 17:52:20 +01:00
Icons.remove_circle_outline_rounded,
2020-09-19 20:30:41 +02:00
size: 20.0,
color: song.blocked ? Colors.white : Colors.white24,
2020-09-19 20:30:41 +02:00
),
onPressed: () => musicDataStore.setSongBlocked(song, !song.blocked),
2020-09-19 20:30:41 +02:00
),
],
mainAxisAlignment: MainAxisAlignment.center,
);
},
2020-09-19 17:08:48 +02:00
);
}
}