resonance

Creator: coderz1093

Last updated:

0 purchases

resonance Image
resonance Images
Add to Cart

Description:

resonance

Resonance #
Resonance is volume and vibration controller plugin. This plugin based on the Android volume and vibration controller. The plugin let you control volume without user interaction and allow customable vibration pattern.

Download #
Get the latest plugin directly from Pub.
Features #
Volume Control #

Get current volume level
Get max volume level
Set volume level
Set max volume level
Set mute volume level
Showing volume UI (Android only)
Volume stream types (music, notification, alarm, etc.)
Listenable volume level change

Vibration #

Create Vibration
Create Pattern Vibration
Cancel Pattern Vibration

Usage #

Get current volume level

var crntVol = await Resonance.volumeGetCurrentLevel(streamType: StreamType.alarm);
print(crntVol);
copied to clipboard

Set volume level

var crntVol = await Resonance.volumeSetLevel(0.5, showVolumeUI: true);
print(crntVol);
copied to clipboard

Add volume listener

double _volumeLevel = 0;

@override
void initState() {
// Add listener
Resonance().addVolumeListener((volume) {
setState(() {
_volumeLevel = volume;
});
});
super.initState();
}

@override
void dispose() {
// Remove listener
Resonance().removeVolumeListener();
super.dispose();
}
copied to clipboard

Create one-shot vibration by certain duration

await Resonance.vibrate(duration: const Duration(milliseconds: 1000));
copied to clipboard

Create pattern vibration

await Resonance.vibratePattern(
[0, 400, 1000, 600, 1000, 800],
amplitude: 255, // Default: null
repeat: false, // Default: false
);
copied to clipboard

Cancel active pattern vibration

await Resonance.vibrationCancel();
copied to clipboard
Status #
Version 1.0.3 is released
Note #
Only work for Android.
API #



Return
Method
Description




Future<double>
volumeGetCurrentLevel(StreamType streamType)
Returns device's current volume level.


Future<double>
volumeGetMaxLevel(StreamType streamType)
Returns device's maximum volume level.


Future<double>
volumeSetLevel(double volumeValue, StreamType streamType, bool showVolumeUI)
Set device's volume level to given volumeValue parameter and returns current volume level.


Future<double>
volumeSetMaxLevel(StreamType streamType, bool showVolumeUI)
Set device's volume level to maximum and returns current volume level.


Future<double>
volumeSetMuteLevel(StreamType streamType, bool showVolumeUI)
Set device's volume level to minimum or muted and returns current volume level.


StreamSubscription<double>
addVolumeListener(Function(double volume) function)
Add volume change listener to handle given callback.


void
removeVolumeListener()
Cancel listener from broadcast stream


Future<bool>
vibrate(Duration? duration)
Create vibration by certain duration, default duration is 400ms and returns boolean status.


Future<bool>
vibratePattern(List<int> pattern, int? amplitude, bool repeat,)
Create vibration by given custom pattern, amplitude, and repeat.


Future<bool>
vibrationCancel()
Cancel any active repeated vibration and returns boolean status.



Developer #
Tegar Bangun Suganda
copied to clipboard
@canaryv8 (Twitter)
@suganda8 (Github)
License #
resonance

MIT License

Copyright (c) 2022 Tegar Bangun Suganda (OVERMIND)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.

Related Products

More From This Creator