Skip to content

Commit

Permalink
Prepare to publish v2 (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
halildurmus authored Sep 9, 2023
1 parent 59b5cde commit 3e53231
Show file tree
Hide file tree
Showing 24 changed files with 1,036 additions and 700 deletions.
38 changes: 38 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
## 2.0.0

### Major Changes

- **BREAKING**: Renamed the `SiriWave` widget to `SiriWaveform`.

`SiriWaveform` widget no longer has a default constructor. Instead, it
provides two factory constructors:
- `SiriWaveform.ios7()`: Creates an *iOS 7 Siri-style* waveform.
- `SiriWaveform.ios9()`: Creates an *iOS 9 Siri-style* waveform.

- **BREAKING**: Renamed the `SiriWaveController` class to
`SiriWaveformController`.

`SiriWaveformController` is now a `sealed` class and includes two concrete
subclasses:
- `IOS7SiriWaveformController`: For managing *iOS 7 Siri-style* waveforms.
- `IOS9SiriWaveformController`: For managing *iOS 9 Siri-style* waveforms.

The controller classes no longer have methods to change the properties of the
waveform (e.g., `controller.setAmplitude(0.2);`). Instead, you can directly
modify the properties of the controller (e.g., `controller.amplitude = 0.2;`).

- **BREAKING**: Renamed the `SiriWaveOptions` class to `SiriWaveformOptions`.

`SiriWaveformOptions` is now a `sealed` class and includes two concrete
subclasses:
- `IOS7SiriWaveformOptions`: Options for *iOS 7 Siri-style* waveforms.
- `IOS9SiriWaveformOptions`: Options for *iOS 9 Siri-style* waveforms.

- **BREAKING**: Renamed the `SiriWaveStyle` enum to `SiriWaveformStyle`.

### Other Changes

- Refactored the example app.
- Improved documentation.
- Changed the library license to the `BSD 3-Clause License`.

## 1.0.2

- Exposed internally used widgets and custom painters.
Expand Down
11 changes: 8 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing

_See also: [siri_wave's code of conduct](https://github.com/halildurmus/siri_wave/blob/main/CODE_OF_CONDUCT.md)_
_See also: [siri_wave's code of conduct][code_of_conduct_link]_

First off, thanks for taking the time to contribute!

Expand All @@ -23,8 +23,10 @@ environment:

### File an issue first!

If the work you intend to do is non-trivial, **it is necessary to [file an issue](https://github.com/halildurmus/siri_wave/issues/new/choose) before starting writing your code**.
This helps us and the community to discuss the issue and choose what is deemed to be the best solution.
If the work you intend to do is non-trivial, **it is necessary to
[file an issue][file_an_issue_link] before starting writing your code**. This
helps us and the community to discuss the issue and choose what is deemed
to be the best solution.

### Checking your code's quality

Expand All @@ -48,3 +50,6 @@ These are the steps you should follow when creating a PR:

After you follow the above steps, your PR will hopefully be merged.
Thanks for contributing!

[code_of_conduct_link]: https://github.com/halildurmus/siri_wave/blob/main/CODE_OF_CONDUCT.md
[file_an_issue_link]: https://github.com/halildurmus/siri_wave/issues/new
120 changes: 64 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,107 +12,115 @@ It was inspired from the [siriwave][siriwave_link] library.

Check out the live demo [here][demo_link].

## iOS 7 style waveform
## iOS 7 Siri-style waveform

[![iOS 7 style waveform](https://raw.githubusercontent.com/halildurmus/siri_wave/main/gifs/ios_7.gif)](https://halildurmus.github.io/siri_wave)
[![iOS 7 Siri-style waveform][ios_7_gif_link]][demo_link]

## iOS 9 style waveform
## iOS 9 Siri-style waveform

[![iOS 9 style waveform](https://raw.githubusercontent.com/halildurmus/siri_wave/main/gifs/ios_9.gif)](https://halildurmus.github.io/siri_wave)
[![iOS 9 Siri-style waveform][ios_9_gif_link]][demo_link]

## Usage

Simply create a `SiriWave` widget:
### iOS 7 Siri-style waveform

To create an *iOS 7 Siri-style* waveform, use the `SiriWaveform.ios7()`
constructor:

```dart
import 'package:siri_wave/siri_wave.dart';
class MyWidget extends StatelessWidget {
Widget build(BuildContext context) {
return SiriWave();
return SiriWaveform.ios7();
}
}
```

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:
You can customize the waveform by passing a `controller` and/or `options`:

```dart
import 'package:siri_wave/siri_wave.dart';
class MyWidget extends StatelessWidget {
@override
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);
final controller = IOS7SiriWaveformController(
amplitude: 0.5,
color: Colors.red,
frequency: 4,
speed: 0.15,
);
return SiriWaveform.ios7(
controller: controller,
options: IOS7SiriWaveformOptions(
height: 180,
width: 360,
),
);
}
}
```

Afterwards, you can invoke any desired method from the controller to modify the
waveform:
You can also change the properties of the waveform later:

```dart
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);
controller.amplitude = 0.3;
controller.color = Colors.white;
```

For a complete sample application, please checkout the [example](https://github.com/halildurmus/siri_wave/blob/main/example/lib/main.dart).

## SiriWave
### iOS 9 Siri-style waveform

| 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 |
To create an *iOS 9 Siri-style* waveform, use the `SiriWaveform.ios9()`
constructor:

```dart
import 'package:siri_wave/siri_wave.dart';
## SiriWaveController
class MyWidget extends StatelessWidget {
Widget build(BuildContext context) {
return SiriWaveform.ios9();
}
}
```

| 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 |
As with the *iOS 7 Siri-style* waveform, you can customize the waveform by
passing a `controller` and/or `options`:

| 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. |
```dart
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
final controller = IOS9SiriWaveformController(
amplitude: 0.5,
speed: 0.15,
);
return SiriWaveform.ios9(
controller: controller,
options: IOS9SiriWaveformOptions(
height: 180,
width: 360,
),
);
}
}
```

## SiriWaveOptions
For a complete sample application, please checkout the [example][example_link].

| 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 |
To learn more, see the [API Documentation][api_documentation_link].

## 🤝 Contributing

Contributions, issues and feature requests are welcome.
Feel free to check the [issue tracker][issue_tracker_link] if you want to
contribute.

[api_documentation_link]: https://pub.dev/documentation/nuget/latest/
[ci_badge]: https://img.shields.io/cirrus/github/halildurmus/siri_wave
[ci_link]: https://cirrus-ci.com/halildurmus/siri_wave
[demo_link]: https://halildurmus.github.io/siri_wave
[example_link]: https://github.com/halildurmus/siri_wave/blob/main/example/lib/main.dart
[ios_7_gif_link]: https://raw.githubusercontent.com/halildurmus/siri_wave/main/gifs/ios_7.gif
[ios_9_gif_link]: https://raw.githubusercontent.com/halildurmus/siri_wave/main/gifs/ios_9.gif
[issue_tracker_link]: https://github.com/halildurmus/siri_wave/issues
[language_badge]: https://img.shields.io/badge/language-Dart-blue.svg
[language_link]: https://dart.dev
Expand Down
39 changes: 1 addition & 38 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,38 +1 @@
include: package:flutter_lints/flutter.yaml

analyzer:
language:
strict-casts: true
strict-inference: true
strict-raw-types: true

linter:
rules:
- always_declare_return_types
- avoid_type_to_string
- cascade_invocations
- comment_references
- directives_ordering
- discarded_futures
- implicit_reopen
- invalid_case_patterns
- leading_newlines_in_multiline_strings
- literal_only_boolean_expressions
- no_default_cases
- omit_local_variable_types
- prefer_const_constructors
- prefer_const_literals_to_create_immutables
- prefer_final_in_for_each
- prefer_final_locals
- prefer_relative_imports
- sort_child_properties_last
- sort_unnamed_constructors_first
- test_types_in_equals
- type_literal_in_constant_pattern
- unawaited_futures
- unnecessary_breaks
- unnecessary_lambdas
- unnecessary_null_checks
- unnecessary_parenthesis
- unnecessary_statements
- use_super_parameters
include: package:dartwindows_lints/analysis_options.yaml
Loading

0 comments on commit 3e53231

Please sign in to comment.