mucke/lib/presentation/widgets/next_song.dart

53 lines
1.4 KiB
Dart
Raw Normal View History

2020-07-12 18:25:34 +02:00
import 'package:flutter/material.dart';
2021-05-17 21:44:59 +02:00
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:get_it/get_it.dart';
2020-07-12 18:25:34 +02:00
import '../../domain/entities/song.dart';
2021-05-17 21:44:59 +02:00
import '../state/audio_store.dart';
2020-07-12 18:25:34 +02:00
class NextSong extends StatelessWidget {
2021-05-17 21:44:59 +02:00
const NextSong({Key key}) : super(key: key);
2020-07-12 18:25:34 +02:00
@override
Widget build(BuildContext context) {
2021-05-17 21:44:59 +02:00
return Observer(builder: (BuildContext context) {
final audioStore = GetIt.I<AudioStore>();
final List<Song> queue = audioStore.queueStream.value;
final int index = audioStore.queueIndexStream.value;
if (index < queue.length - 1) {
final Song song = queue[index + 1];
return RichText(
textAlign: TextAlign.center,
text: TextSpan(
style: const TextStyle(
fontSize: 14,
color: Colors.white70,
2020-12-31 17:52:20 +01:00
),
2021-05-17 21:44:59 +02:00
children: [
TextSpan(
text: '${song.title}',
style: const TextStyle(
fontWeight: FontWeight.w300,
),
2020-08-24 16:43:22 +02:00
),
2021-05-17 21:44:59 +02:00
const TextSpan(text: ''),
TextSpan(
text: '${song.artist}',
style: const TextStyle(
fontWeight: FontWeight.w300,
),
),
],
),
);
} else {
return Container(
height: 16.0,
);
}
});
2020-07-12 18:25:34 +02:00
}
}