SiriWave

pub package Platform GitHub top language CirrusCI CodeFactor Visits

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 7

iOS 9 style

iOS 9

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

ParameterTypeDescriptionDefault
controllerSiriWaveControllerThe controller of the SiriWave.SiriWaveController()
optionsSiriWaveOptionsThe configuration of the SiriWave.SiriWaveOptions()
styleSiriWaveStyleThe wave style of the SiriWave.SiriWaveStyle.ios_9

SiriWaveController

ParameterTypeDescriptionDefault
amplitudedoubleThe amplitude of the waveform.1.0
colorColorThe color of the iOS 7 style waveform.Colors.white
frequencyintThe frequency of the iOS 7 style waveform.6
speeddoubleThe speed of the waveform.0.2
FunctionDescription
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

ParameterTypeDescriptionDefault
backgroundColorColorThe background color of the waveform.Colors.black
heightdoubleThe height of the waveform.180
widthdoubleThe width of the waveform.360

🤝 Contributing

Contributions, issues and feature requests are welcome. Feel free to check issues page if you want to contribute.

Libraries

siri_wave