Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI

on:
pull_request:
push:
branches:
- master
- develop

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6

- uses: subosito/flutter-action@v2
with:
flutter-version: "3.7.12"
channel: stable
cache: true

- run: flutter pub get
- run: flutter analyze
- run: flutter test
13 changes: 13 additions & 0 deletions .pubignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.dart_tool/
.fvm/
.fvmrc
.github/
.idea/
.vscode/

build/
docs/
wrangler.jsonc
*.iml

PULL_REQUEST_TEMPLATE.md
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# CHANGELOG

## 0.2.3-dev.1

* Add runtime validation for custom gradient and layer configuration.
* Add default rendering support for `SingleConfig` and `RandomConfig`.
* Improve animation lifecycle handling in `WaveWidget`.
* Add CI coverage for analyze and tests on Flutter 3.7.

## 0.2.2

Update banner.
Expand Down
48 changes: 44 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ A Flutter package for displaying waves.

## Demo

| Platform | Branch | URL |
| -: | -: | -: |
| Web | `master` | [wave.glorylab.xyz](https://wave.glorylab.xyz "The demo page of the wave package.") |
| Web | `develop` | [dev.wave.glorylab.xyz](https://dev.wave.glorylab.xyz "The demo page of the wave package's develop branch.") |
| Platform | URL |
| -: | -: |
| Web | [wave.glorylab.xyz](https://wave.glorylab.xyz "The demo page of the wave package.") |

## Deployment

Expand Down Expand Up @@ -55,3 +54,44 @@ WaveWidget(
waveAmplitude: 0,
),
```

## Config modes

`CustomConfig` is the most explicit mode. Use it when you want full control over
each wave layer's colors or gradients, duration, and height.

``` Dart
WaveWidget(
config: CustomConfig(
gradients: [
[Color(0xFF00BBF9), Color(0xFF9B5DE5)],
[Color(0xFFFEE440), Color(0xFFF15BB5)],
],
durations: [5000, 4000],
heightPercentages: [0.65, 0.66],
),
size: Size(double.infinity, double.infinity),
)
```

`SingleConfig` creates layered waves from one color. `RandomConfig` creates
layer colors for you, with an optional `seed` when deterministic output is
useful for tests or demos.

``` Dart
WaveWidget(
config: SingleConfig(
color: Color(0xFF00BBF9),
layers: 3,
),
size: Size(double.infinity, double.infinity),
)

WaveWidget(
config: RandomConfig(
seed: 7,
layers: 4,
),
size: Size(double.infinity, double.infinity),
)
```
11 changes: 5 additions & 6 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ A Flutter package for displaying waves.

## Demo

| Platform | Branch | URL |
| -: | -: | -: |
| Web | `master` | [wave.glorylab.xyz](https://wave.glorylab.xyz "The demo page of the wave package.") |
| Web | `develop` | [dev.wave.glorylab.xyz](https://dev.wave.glorylab.xyz "The demo page of the wave package's develop branch.") |
| Platform | URL |
| -: | -: |
| Web | [wave.glorylab.xyz](https://wave.glorylab.xyz "The demo page of the wave package.") |



Expand All @@ -42,12 +41,12 @@ static const _heightPercentages = [

WaveWidget(
config: CustomConfig(
colors: colors,
colors: _colors,
durations: _durations,
heightPercentages: _heightPercentages,
),
backgroundColor: _backgroundColor,
size: Size(double.infinity, double.infinity),
waveAmplitude: 0,
),
```
```
46 changes: 24 additions & 22 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import 'package:google_fonts/google_fonts.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:wave/wave.dart';

void main() => runApp(WaveDemoApp());
void main() => runApp(const WaveDemoApp());

final String appName = 'Demo WAVE';
final String repoURL = 'https://github.com/glorylab/wave';
const String appName = 'Demo WAVE';
const String repoURL = 'https://github.com/glorylab/wave';

class WaveDemoApp extends StatelessWidget {
const WaveDemoApp({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return MaterialApp(
Expand All @@ -17,18 +19,18 @@ class WaveDemoApp extends StatelessWidget {
primarySwatch: Colors.indigo,
useMaterial3: true,
),
home: WaveDemoHomePage(title: appName),
home: const WaveDemoHomePage(title: appName),
);
}
}

class WaveDemoHomePage extends StatefulWidget {
WaveDemoHomePage({Key? key, this.title}) : super(key: key);
const WaveDemoHomePage({Key? key, this.title}) : super(key: key);

final String? title;

@override
_WaveDemoHomePageState createState() => _WaveDemoHomePageState();
State<WaveDemoHomePage> createState() => _WaveDemoHomePageState();
}

class _WaveDemoHomePageState extends State<WaveDemoHomePage> {
Expand All @@ -38,21 +40,21 @@ class _WaveDemoHomePageState extends State<WaveDemoHomePage> {
DecorationImage? backgroundImage,
double height = 152.0,
}) {
return Container(
return SizedBox(
height: height,
width: double.infinity,
child: Card(
elevation: 12.0,
margin: EdgeInsets.only(
right: marginHorizontal, left: marginHorizontal, bottom: 16.0),
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(16.0))),
child: WaveWidget(
config: config,
backgroundColor: backgroundColor,
backgroundImage: backgroundImage,
size: Size(double.infinity, double.infinity),
size: const Size(double.infinity, double.infinity),
waveAmplitude: 0,
),
),
Expand Down Expand Up @@ -94,15 +96,15 @@ class _WaveDemoHomePageState extends State<WaveDemoHomePage> {
Expanded(
child: ListView(
children: <Widget>[
SizedBox(height: 16.0),
const SizedBox(height: 16.0),
_buildCard(
backgroundColor: Colors.purpleAccent,
config: CustomConfig(
gradients: [
[Colors.red, Color(0xEEF44336)],
[Colors.red[800]!, Color(0x77E57373)],
[Colors.orange, Color(0x66FF9800)],
[Colors.yellow, Color(0x55FFEB3B)]
[Colors.red, const Color(0xEEF44336)],
[Colors.red[800]!, const Color(0x77E57373)],
[Colors.orange, const Color(0x66FF9800)],
[Colors.yellow, const Color(0x55FFEB3B)]
],
durations: [35000, 19440, 10800, 6000],
heightPercentages: [0.20, 0.23, 0.25, 0.30],
Expand All @@ -112,7 +114,7 @@ class _WaveDemoHomePageState extends State<WaveDemoHomePage> {
),
_buildCard(
height: 256.0,
backgroundImage: DecorationImage(
backgroundImage: const DecorationImage(
image: NetworkImage(
'https://images.unsplash.com/photo-1554779147-a2a22d816042?crop=entropy&cs=tinysrgb&fm=jpg&ixlib=rb-1.2.1&q=80&raw_url=true&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=3540',
),
Expand Down Expand Up @@ -148,7 +150,7 @@ class _WaveDemoHomePageState extends State<WaveDemoHomePage> {
height: 128,
width: 128,
decoration:
BoxDecoration(shape: BoxShape.circle, boxShadow: [
const BoxDecoration(shape: BoxShape.circle, boxShadow: [
BoxShadow(
color: Color(0xFF9B5DE5),
blurRadius: 2.0,
Expand All @@ -160,8 +162,8 @@ class _WaveDemoHomePageState extends State<WaveDemoHomePage> {
child: WaveWidget(
config: CustomConfig(
colors: [
Color(0xFFFEE440),
Color(0xFF00BBF9),
const Color(0xFFFEE440),
const Color(0xFF00BBF9),
],
durations: [
5000,
Expand All @@ -172,8 +174,8 @@ class _WaveDemoHomePageState extends State<WaveDemoHomePage> {
0.66,
],
),
backgroundColor: Color(0xFFF15BB5),
size: Size(double.infinity, double.infinity),
backgroundColor: const Color(0xFFF15BB5),
size: const Size(double.infinity, double.infinity),
waveAmplitude: 0,
),
),
Expand Down Expand Up @@ -202,7 +204,7 @@ class _WaveDemoHomePageState extends State<WaveDemoHomePage> {
)
],
)),
Container(
SizedBox(
height: 48,
child: WaveWidget(
config: CustomConfig(
Expand All @@ -215,7 +217,7 @@ class _WaveDemoHomePageState extends State<WaveDemoHomePage> {
durations: [18000, 8000, 5000, 12000],
heightPercentages: [0.65, 0.66, 0.68, 0.70],
),
size: Size(double.infinity, double.infinity),
size: const Size(double.infinity, double.infinity),
waveAmplitude: 0,
),
),
Expand Down
3 changes: 2 additions & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: wave_example
description: An example application for Wave.
homepage: https://github.com/i-protoss/wave/tree/master/example
homepage: https://github.com/glorylab/wave/tree/master/example
publish_to: none

# The following defines the version and build number for your application.
Expand All @@ -27,6 +27,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0


# For information on the generic Dart part of this file, see the
Expand Down
Loading