sound_library 1.0.0 sound_library: ^1.0.0 copied to clipboard
Easy UI sounds to directly use in your app through mis develop sound library database
Features #
Easy and free 🆓 UI sounds library 🎶 for your general purposes 🎧 🔊
Getting started #
In the pubspec.yaml
of your flutter project, add the following dependency:
dependencies:
...
sound_library: ^1.0.0
Add this import line
import 'package:sound_library/sound_library.dart';
Available sounds
Try out the sounds in the example project
Live example: Sounds Library
Name | Description |
---|---|
Click | General button click |
Action | General action sound (Usually no user interaction) |
Open | Open drawer, open menu, open popup, etc. |
Deleted | Delete item, delete file, etc. |
Welcome | Welcome sound |
Success | Indicates success or completed action |
Drag | Drag and drop sound |
Intro | Intro sound |
Add to cart | Add to cart sound |
Close (Wood hit) | High pitched sound of two wood blocks |
Order Complete | Order completed sound |
Cashing machine | Cashing machine sound |
Usage #
Play a sound with a volume
level and position
on the track
SoundPlayer.play(Sounds.click, volume: 0.5, position: Duration(milliseconds: 500);
Play a sound from the Sounds
library
SoundPlayer.play(Sounds.click);
Play a sound from a URL
path
SoundPlayer.playFromUrl(path);
Play a sound from a file
path
SoundPlayer.playFromDeviceFilePath(file);
Play a sound from an asset
path
SoundPlayer.playFromAssetPath(asset);
Play a sound from bytes
SoundPlayer.playFromBytes(bytes);
Check if audio is currently enabled
bool enabled = SoundPlayer.isAudioEnabled;
Check if audio is enabled
on the device storage
This will also load the state from the device storage onto the isAudioEnabled
property
bool enabled = await SoundPlayer.checkLocalStorageEnabled();
Enable/disable sounds
This will also save the state to the device storage
SoundPlayer.setAudioEnabled(true/false);
Additional information #
This package assumes corresponding permissions depending on platform. Also, take a look at the example project for more information.