Skip to content

Commit

Permalink
Merge pull request #1 from GangemiLorenzo/feat/gh_actions_update
Browse files Browse the repository at this point in the history
feat: Update the GH action workflows
  • Loading branch information
GangemiLorenzo authored Oct 14, 2023
2 parents 33fe713 + 418984e commit 40da204
Show file tree
Hide file tree
Showing 8 changed files with 236 additions and 5 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ on:
branches:
- main
pull_request:
branches:
- main
types:
- opened
- synchronize

jobs:
semantic_pull_request:
Expand All @@ -22,6 +23,10 @@ jobs:
includes: "**/*.md"
modified_files_only: false

pana:
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/pana.yml@v1


build:
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/dart_package.yml@v1
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/flutter_package.yml@v1

12 changes: 12 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Pub Publish Workflow

on:
push:
tags:
- 'v*.*.*'

jobs:
build:
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/flutter_pub_publish.yml@v1
with:
pub_credentials: secrets.PUB_CREDENTIALS
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
build/
pubspec.lock
.vscode
.git
.git
coverage/
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Aura Box

[![style: very good analysis][very_good_analysis_badge]][very_good_analysis_link]
[![patrol_finders on pub.dev][patrol_finders_badge]][patrol_finders_link]
[![License: MIT][license_badge]][license_link]


Flutter widget that combines multiple radial gradients and blur effect.

![Aura box banner image](https://github.com/GangemiLorenzo/aura_box/assets/26723808/16a43670-17df-4515-8a57-29f17b94607b)
Expand All @@ -12,6 +14,8 @@ Flutter widget that combines multiple radial gradients and blur effect.
[license_link]: https://opensource.org/licenses/MIT
[very_good_analysis_badge]: https://img.shields.io/badge/style-very_good_analysis-B22C89.svg
[very_good_analysis_link]: https://pub.dev/packages/very_good_analysis
[patrol_finders_badge]: https://img.shields.io/badge/test-patrol_finders-yellow
[patrol_finders_link]: https://pub.dev/packages/patrol_finders


## Installation
Expand Down
1 change: 1 addition & 0 deletions lib/src/aura_spot.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class AuraSpot extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ShaderMask(
key: key,
shaderCallback: (Rect bounds) {
final gradient = RadialGradient(
center: alignment,
Expand Down
23 changes: 23 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
THIS_FILE := $(lastword $(MAKEFILE_LIST))

help:
@make -pRrq -f $(THIS_FILE) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'

unit:
@flutter test

cov:
@flutter test --coverage && lcov --remove coverage/lcov.info '**/*.g.dart' -o coverage/lcov.info && genhtml coverage/lcov.info --output=coverage && open coverage/index.html

clean:
@rm -rf pubspec.lock
@flutter clean

format:
@dart format .

lint:
@dart analyze .

clean-pod:
cd ios && pod deintegrate && pod update && cd ..
5 changes: 4 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: aura_box
description: Flutter Widget that combines multiple radial gradients and blur effect.
version: 1.0.1
version: 1.0.2
homepage: https://github.com/GangemiLorenzo/aura_box

environment:
Expand All @@ -11,4 +11,7 @@ dependencies:
sdk: flutter

dev_dependencies:
flutter_test:
sdk: flutter
patrol_finders: ^1.0.0
very_good_analysis: ^5.1.0
182 changes: 182 additions & 0 deletions test/aura_box_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
import 'package:aura_box/aura_box.dart'; // Import your AuraBox class
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:patrol_finders/patrol_finders.dart';

void main() {
group('AuraBox', () {
testWidgets('renders AuraSpot and ShaderMasks',
(WidgetTester tester) async {
final $ = PatrolTester(
tester: tester,
config: const PatrolTesterConfig(),
);

await $.pumpWidget(
MaterialApp(
home: AuraBox(
spots: [
AuraSpot(
color: Colors.blue,
radius: 50,
alignment: Alignment.center,
blurRadius: 5,
),
AuraSpot(
color: Colors.red,
radius: 50,
alignment: Alignment.bottomLeft,
blurRadius: 5,
),
],
child: Container(),
),
),
);

expect($(AuraBox), findsOneWidget);
expect($(AuraBox).$(AuraSpot), findsNWidgets(2));
expect($(AuraBox).$(AuraSpot).$(ShaderMask), findsNWidgets(2));
});

testWidgets('applies decoration over the main container',
(WidgetTester tester) async {
final $ = PatrolTester(
tester: tester,
config: const PatrolTesterConfig(),
);

await $.pumpWidget(
MaterialApp(
home: AuraBox(
spots: const [],
decoration: BoxDecoration(
color: Colors.red,
borderRadius: BorderRadius.circular(10),
),
child: Container(),
),
),
);

// Verify that the decoration is applied correctly
final container =
$(AuraBox).$(Container).first.evaluate().single.widget as Container;
final decoration = container.decoration! as BoxDecoration;
expect(decoration.color, equals(Colors.red));
expect(decoration.shape, equals(BoxShape.rectangle));
expect(decoration.borderRadius, equals(BorderRadius.circular(10)));
});

testWidgets('given decoration with border radius, applies ClipRRect',
(WidgetTester tester) async {
final $ = PatrolTester(
tester: tester,
config: const PatrolTesterConfig(),
);

await $.pumpWidget(
MaterialApp(
home: AuraBox(
spots: [
AuraSpot(
color: Colors.blue,
radius: 50,
alignment: Alignment.center,
blurRadius: 5,
stops: const [0.0, 0.5],
),
AuraSpot(
color: Colors.red,
radius: 50,
alignment: Alignment.bottomLeft,
blurRadius: 5,
),
],
decoration: BoxDecoration(
color: Colors.red,
borderRadius: BorderRadius.circular(10),
),
child: Container(),
),
),
);

expect($(AuraBox).$(ClipRRect), findsNWidgets(2));
final clipRRect =
$(AuraBox).$(ClipRRect).first.evaluate().single.widget as ClipRRect;
expect(clipRRect.borderRadius, equals(BorderRadius.circular(10)));
});

testWidgets('given decoration with BoxShape.circle, applies ClipOval',
(WidgetTester tester) async {
final $ = PatrolTester(
tester: tester,
config: const PatrolTesterConfig(),
);

await $.pumpWidget(
MaterialApp(
home: AuraBox(
spots: [
AuraSpot(
color: Colors.blue,
radius: 50,
alignment: Alignment.center,
blurRadius: 5,
stops: const [0.0, 0.5],
),
AuraSpot(
color: Colors.red,
radius: 50,
alignment: Alignment.bottomLeft,
blurRadius: 5,
),
],
decoration: const BoxDecoration(
color: Colors.red,
shape: BoxShape.circle,
),
child: Container(),
),
),
);

expect($(AuraBox).$(ClipOval), findsNWidgets(2));
});

testWidgets('composes child and spots in a Stack',
(WidgetTester tester) async {
final $ = PatrolTester(
tester: tester,
config: const PatrolTesterConfig(),
);
await $.pumpWidget(
MaterialApp(
home: AuraBox(
spots: [
AuraSpot(
color: Colors.blue,
radius: 50,
alignment: Alignment.center,
blurRadius: 5,
stops: const [0.0, 0.5],
),
AuraSpot(
color: Colors.red,
radius: 50,
alignment: Alignment.bottomLeft,
blurRadius: 5,
),
],
child: Container(),
),
),
);

expect($(Stack), findsOneWidget);
final stack = $(Stack).evaluate().single.widget as Stack;
expect(stack.children.length, equals(3));
});
});
}

0 comments on commit 40da204

Please sign in to comment.