added clicking sounds on button click (#1236)
parent
0b5edffbf9
commit
50b435b7e9
Binary file not shown.
@ -0,0 +1,20 @@
|
|||||||
|
import 'package:audioplayers/audioplayers.dart';
|
||||||
|
|
||||||
|
class ClickPlayer {
|
||||||
|
late AudioPlayer _player;
|
||||||
|
|
||||||
|
ClickPlayer() {
|
||||||
|
_player = AudioPlayer();
|
||||||
|
_player.setPlayerMode(PlayerMode.lowLatency);
|
||||||
|
_player.setVolume(0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> play() async {
|
||||||
|
await _player.stop();
|
||||||
|
_player.play(AssetSource('sounds/click.ogg'));
|
||||||
|
}
|
||||||
|
|
||||||
|
void dispose() {
|
||||||
|
_player.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue