siri_wave 0.2.2 siri_wave: ^0.2.2 copied to clipboard
A Flutter package to create beautiful waveforms like in Siri.
SiriWave #
A Flutter package to create beautiful waveforms like in Siri. It was inspired from the siriwave library.
Demo #
Check out the live demo here.
iOS 7 style #
iOS 9 style #
Getting Started #
Requirements #
Dart >= 2.14.0
Flutter >= 2.0.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 be able to change the amplitude
, frequency
, speed
and color
of the waveform, create a SiriWaveController
and pass it to the SiriWave
widget:
// You can change the default values while creating the controller.
// final controller = SiriWaveController(
// amplitude: 0.5,
// color: Colors.red,
// frequency: 4,
// speed: 0.15,
// );
final controller = SiriWaveController();
SiriWave(controller: controller);
And then call any method you want from the controller.
controller.setAmplitude(0.8);
controller.setSpeed(0.1);
// Only available in iOS 7 style waveform.
controller.setColor(Colors.yellow);
controller.setFrequency(4);
See the example directory for a complete sample app.
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 |
---|---|---|---|
backgroundColor |
Color | The background color of the waveform. | Colors.black |
height |
double | The height of the waveform. | 180 |
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.