2020-07-12 18:25:34 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_mobx/flutter_mobx.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
import '../state/audio_store.dart';
|
|
|
|
|
|
|
|
class NextButton extends StatelessWidget {
|
|
|
|
const NextButton({Key key, this.iconSize = 24.0}) : super(key: key);
|
|
|
|
|
|
|
|
final double iconSize;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
final AudioStore audioStore = Provider.of<AudioStore>(context);
|
|
|
|
|
|
|
|
return Observer(
|
|
|
|
builder: (BuildContext context) {
|
2020-12-31 17:52:20 +01:00
|
|
|
final queue = audioStore.queueStream.value;
|
|
|
|
final int index = audioStore.queueIndexStream.value;
|
2020-07-12 18:25:34 +02:00
|
|
|
|
2020-12-31 17:52:20 +01:00
|
|
|
if (index != null && index < queue.length - 1) {
|
2020-07-12 18:25:34 +02:00
|
|
|
return IconButton(
|
2020-12-31 17:52:20 +01:00
|
|
|
icon: const Icon(Icons.skip_next_rounded),
|
2020-07-12 18:25:34 +02:00
|
|
|
iconSize: iconSize,
|
2020-12-31 17:52:20 +01:00
|
|
|
onPressed: () => audioStore.skipToNext(),
|
2020-07-12 18:25:34 +02:00
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return IconButton(
|
2020-08-12 20:59:00 +02:00
|
|
|
icon: const Icon(
|
2020-07-12 18:25:34 +02:00
|
|
|
Icons.skip_next,
|
|
|
|
),
|
|
|
|
iconSize: iconSize,
|
|
|
|
onPressed: null,
|
|
|
|
);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|