siri_wave 1.0.0 siri_wave: ^1.0.0 copied to clipboard
Create beautiful waveforms like in Siri.
siri_wave #
Create beautiful waveforms like in Siri. It was inspired from the siriwave library.
Demo #
Check out the live demo here.
iOS 7 style waveform #
iOS 9 style waveform #
Getting Started #
Requirements #
Dart >= 3.0.0
Flutter >= 3.7.0
Usage #
Simply create a SiriWave
widget:
import 'package:siri_wave/siri_wave.dart';
class MyWidget extends StatelessWidget {
Widget build(BuildContext context) {
return SiriWave();
}
}
To customize the amplitude
, frequency
, speed
, and color
properties of
the waveform, create an instance of SiriWaveController
and pass it to the
SiriWave
widget as shown in the code snippet below:
import 'package:siri_wave/siri_wave.dart';
class MyWidget extends StatelessWidget {
Widget build(BuildContext context) {
// You can customize the default values of the waveform while creating the
// controller:
// final controller = SiriWaveController(
// amplitude: 0.5,
// color: Colors.red,
// frequency: 4,
// speed: 0.15,
// );
final controller = SiriWaveController();
return SiriWave(controller: controller);
}
}
Afterward, you can invoke any desired method from the controller to modify the waveform:
controller.setAmplitude(0.8);
controller.setSpeed(0.1);
// These are only available in the iOS 7 style waveform.
controller.setColor(Colors.yellow);
controller.setFrequency(4);
For a complete sample application, please checkout the example.
SiriWave #
Parameter | Type | Description | Default |
---|---|---|---|
controller |
SiriWaveController | The controller of the SiriWave. | SiriWaveController() |
options |
SiriWaveOptions | The configuration of the SiriWave. | SiriWaveOptions() |
style |
SiriWaveStyle | The wave style of the SiriWave. | SiriWaveStyle.ios_9 |
SiriWaveController #
Parameter | Type | Description | Default |
---|---|---|---|
amplitude |
double | The amplitude of the waveform. | 1.0 |
color |
Color | The color of the iOS 7 style waveform. | Colors.white |
frequency |
int | The frequency of the iOS 7 style waveform. | 6 |
speed |
double | The speed of the waveform. | 0.2 |
Function | Description |
---|---|
setAmplitude(double value) |
Sets the amplitude of the waveform. The value must be in the [0,1] range. |
setColor(Color color) |
Sets the color of the iOS 7 style waveform. |
setFrequency(double value) |
Sets the frequency of the iOS 7 style waveform. The value must be in the [-20,20] range. |
setSpeed(double value) |
Sets the speed of the waveform. The value must be in the [0,1] range. |
SiriWaveOptions #
Parameter | Type | Description | Default |
---|---|---|---|
height |
double | The height of the waveform. | 180 |
showSupportBar |
bool | Whether to show support bar on iOS 9 style waveform. | true |
width |
double | The width of the waveform. | 360 |
🤝 Contributing #
Contributions, issues and feature requests are welcome. Feel free to check issues page if you want to contribute.