Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
cca3975
docs: minor changes
cybex-dev Mar 4, 2025
fd81f3c
feat: added PopScope around AlertDialog child
cybex-dev Mar 4, 2025
531d7c0
doc: update CHANGELOG
cybex-dev Mar 4, 2025
140463d
feat!: provide dialog context in button tap*
cybex-dev Mar 4, 2025
0bbba9c
feat: update example
cybex-dev Mar 4, 2025
3aa647d
doc: update CHANGELOG
cybex-dev Mar 4, 2025
d7992d2
doc: update README
cybex-dev Mar 4, 2025
8d6fae1
feat: added title & text overflow and align options
cybex-dev Mar 4, 2025
96500b7
doc: update CHANGELOG
cybex-dev Mar 4, 2025
596c1f2
doc: update README
cybex-dev Mar 4, 2025
646bdaf
Merge branch 'feat_customize_title_body_text'
cybex-dev Mar 4, 2025
bb4449b
Merge branch 'feat_custom_popping'
cybex-dev Mar 4, 2025
6328c44
ci: add firebase integration & deploy with gh actions on 'cooler_alerts'
cybex-dev Mar 5, 2025
4c4e99d
ci: add gh issue & pr templates
cybex-dev Mar 5, 2025
302f8db
feat: update package details cooler_alerts
cybex-dev Mar 5, 2025
01764cb
fix: example lib dependency references
cybex-dev Mar 5, 2025
a86e4f1
refactor: separate enums to constants
cybex-dev Mar 5, 2025
25f381a
refactor: rename lib `cool_alert` to `cooler_alerts`
cybex-dev Mar 5, 2025
d175228
feat(example): update web index.html with bootstrapping*
cybex-dev Mar 5, 2025
f911acd
lint: fix print in production
cybex-dev Mar 5, 2025
cc8debd
feat: add firebase example app/homepage
cybex-dev Mar 5, 2025
7cd87a2
doc: update README with transition from `cool_alert` package
cybex-dev Mar 5, 2025
87dbb1f
doc: update pubspec repo & issue urls
cybex-dev Mar 5, 2025
a327cde
chore: version bump 2.1.1
cybex-dev Mar 5, 2025
244d7f0
Merge branch 'cooler_alerts'
cybex-dev Mar 5, 2025
a04223b
ci: update to prod on 'prod\
cybex-dev Mar 5, 2025
7b5c5cd
fix: animation resource strings
cybex-dev Mar 5, 2025
5161821
fix(deps): added win32 override*
cybex-dev Mar 5, 2025
fef93df
chore(example): update pubspec name & description
cybex-dev Mar 5, 2025
6750fbd
chore: fix pubspec repo, issue urls
cybex-dev Mar 5, 2025
eb7472b
fix(deps): flare_flutter `hashValues` with fork
cybex-dev Mar 5, 2025
155959c
chore(android): update example gradle
cybex-dev Mar 5, 2025
f4599e4
fix: update onPopInvokedWithResult transform
cybex-dev Mar 5, 2025
bd8c35d
ci: update gh flutter version 3.27.4
cybex-dev Mar 5, 2025
58dafcd
fix: package `cool_flare` imports
cybex-dev Mar 5, 2025
bb63cc5
feat(deps): use `cool_flare` as `flare_flutter` replacement
cybex-dev Mar 5, 2025
7f1c37e
fix: linter warnings
cybex-dev Mar 5, 2025
6d16c38
doc: update CHANGELOG
cybex-dev Mar 5, 2025
130d660
chore: version bump
cybex-dev Mar 5, 2025
39cc3ae
fix(example): web bootstrapping
cybex-dev Mar 5, 2025
3a085af
ci: disable flutter version cache in gh action
cybex-dev Mar 5, 2025
00bb7ee
fix: downgrade lottie from ^3.3.1 to ^3.3.0*
cybex-dev Mar 5, 2025
3eccef4
Revert "fix: downgrade lottie from ^3.3.1 to ^3.3.0*"
cybex-dev Mar 6, 2025
102c259
feat(example): update environment sdk to >=2.19.2 <4.0.0
cybex-dev Mar 6, 2025
d249fef
ci: github action using dart 3.4.0 on flutter 3.27.4, disabling caching
cybex-dev Mar 6, 2025
36b13ca
Revert "ci: github action using dart 3.4.0 on flutter 3.27.4, disabli…
cybex-dev Mar 6, 2025
4b0e4e7
ci: reenable flutter caching
cybex-dev Mar 6, 2025
c55c328
ci: update flutter build version in gh deploy job
cybex-dev Mar 6, 2025
26dd8e5
ci: update gh deploy workflow
cybex-dev Mar 6, 2025
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
5 changes: 5 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "cooler-alerts"
}
}
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/BUG_REPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: '🐞 Bug Report'
about: Create a report
title: ''
labels: ['type:Bug', 'status:Unconfirmed']
assignees: ''
---

<!--
Found a bug? Please fill out the sections below. 👍
-->

### Issue Summary

<!--
A summary of the issue.
-->

### Steps to Reproduce

1.

Any other relevant information. For example, why do you consider this a bug and what did you expect to happen instead?

40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/FEATURE_REQUEST.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: '🚀 Feature request'
about: Suggest an idea/concept/feature to enhance the project
title: ''
labels: 'type:Enhancement'
assignees: ''
---

### Is your proposal related to a problem?

<!--
Provide a clear and concise description of what the problem is.
-->

(Write your answer here.)

### Describe the solution you'd like

<!--
Provide a clear and concise description of what you want to happen.
-->

(Describe your proposed solution here.)

### Describe alternatives you've considered

<!--
Let us know about other solutions you've tried or researched.
-->

(Write your answer here.)

### Additional context

<!--
Is there anything else you can add about the proposal?
You might want to link to related issues here, if you haven't already.
-->

(Write your answer here.)
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: true
15 changes: 15 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Description

Please include a summary of the change(s) and which issue(s) are to be fixed/addressed or feature(s) to be added. Please also include relevant motivation and context. List any dependencies that are required for this change.


## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update

## Screenshots (if appropriate):
74 changes: 74 additions & 0 deletions .github/workflows/flutter-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Flutter analyze, test & deploy example web app

on:
push:
branches: [ "prod" ]

workflow_dispatch:

env:
FLUTTER_VERSION: 3.27.4

jobs:
build_and_test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: 'stable'
cache: true

- run: flutter --version

- name: Install dependencies
run: flutter pub get

- name: Analyze project source
run: flutter analyze

- name: Run tests
# run: flutter test --coverage
run: echo "Ignoring tests for now."

deploy-example-web:
runs-on: ubuntu-latest
needs: build_and_test

steps:
- uses: actions/checkout@v4

- name: Setup Flutter build environment
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: 'stable'
cache: true

- run: flutter config --enable-web
- run: cd ./example; flutter build web --release --target=lib/main.dart --output=build/web

- name: Archive Production Artifact
uses: actions/upload-artifact@master
with:
name: web-build
path: example/build/web

- name: Firebase Deploy
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_COOLER_ALERTS }}'
channelId: live
projectId: cooler-alerts

24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
## [2.1.2] - 04/03/2025

- Fix: resource animation strings
- Use `cool_flare` as `flare_flutter` dependency
- Update example app
- Update pubspec
- Update README

## [2.1.1] - 04/03/2025

- Update: example
- Update: README
- Fix: pubspec documentation

## [2.1.0] - 04/03/2025

- Added TextAlign & Overflow options for title & text (or body).
- **BREAKING CHANGES!**: added dialog context to `confirmBtnTap` and `cancelBtnTap` functions. Signatures now are:
```dart
void Function(BuildContext context);
```
- Added `PopScope` widget with `canPop` to prevent unwanted navigation while dialog is showing.
- Updated README

## [2.0.1] - 06/03/2023

- Updated README
Expand Down
112 changes: 78 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,103 @@
# cool_alert
# cooler_alerts

A Flutter package to display animated alert dialogs

**Please note - the origin [author](https://github.com/emrade) of the [cool_alert](https://pub.dev/packages/cool_alert) hasn't provided updates for an extended period of time.** This package serves to support, and enhance the existing package.

## Usage

To use this package, add cool_alert as a dependency in your pubspec.yaml file.
And add this import to your file.
To use this package, add the package as dependency in your `pubspec.yaml` file.

```dart
cooler_alerts: ^2.1.2
```

Then, add this import to your dart file.

```dart
import 'package:cooler_alerts/cooler_alerts.dart';
```

import 'package:cool_alert/cool_alert.dart';
### Coming from the original `cool_alert` package?

The transition is simple:
1. change the package name in `pubspec.yaml` from `cool_alert` to `cooler_alerts`
2. replace all package references from
```dart
package:cool_alert/cool_alert.dart;
```
to
```dart
package:cooler_alerts/cooler_alerts.dart;
```

## Image
![Screenshot Gif](screenshots/gif.gif)

### Example

```
```dart
CoolAlert.show(
context: context,
type: CoolAlertType.success,
text: "Your transaction was successful!",
);
```


### CoolAlert Class

| Attribute | Data type | Description | Default Value |
|:---------------------|:------------------|:--------------------------------------------------------------------------------|:-------------------------------------------------------------------------:|
| context | BuildContext | @required | Null |
| type | CoolAlertType | @required - Type of alert dialog, ex: CoolAlertType.success for success dialogs | Null |
| title | String | Set a custom title for dialog | Based on the CoolAlertType selected |
| text | String | Set the description text of the dialog. | Null |
| widget | Widget | Set any you expect widget of the dialog. | Null |
| confirmBtnText | String | Text of confirm button | 'Ok' |
| confirmBtnTap | void Function(BuildContext)? | Function that handle click of confirm button, provides dialog context parameter. | (c) => Navigator.pop(c) |
| confirmBtnColor | Color | Color of confirm Button | Theme.of(context).primaryColor |
| cancelBtnText | String | Text of cancel button | 'Cancel' |
| cancelBtnTap | void Function(BuildContext)? | Function that handle click of cancel button, provides dialog context parameter. | (c) => Navigator.pop(c) |
| barrierDismissible | bool | Dismiss dialog on touch overlay | true |
| animType | CoolAlertAnimType | Type of dialogue enter animation | CoolAlertAnimType.scale |
| backgroundColor | Color | Background color of the animation | Color(0xFF515C6F) |
| confirmBtnTextStyle | TextStyle | Confirm button text theme | TextStyle(color: Colors.white, fontWeight:FontWeight.w600,fontSize: 18.0) |
| cancelBtnTextStyle | TextStyle | Cancel button text theme | TextStyle(color: Colors.grey, fontWeight:FontWeight.w600,fontSize: 18.0) |
| flareAsset | String | Custom flare asset | "animation.flr" |
| flareAnimationName | String | The name of the flare animation to play | "play" |
| lottieAsset | String | Custom lottie asset | "animation.json" |
| autoCloseDuration | Duration | Determines how long the dialog stays open for before closing | Null |
| width | double | Dialog width | MediaQuery.of(context).size.width |
| loopAnimation | boolean | Determines if the animation should loop or not | false |
| closeOnConfirmBtnTap | boolean | Detemines if dialog closes when the confirm button is tapped | true |
| reverseBtnOrder | boolean | Reverse the order of the buttons | false |
| titleTextAlign | TextAlign | Text alignment for title | TextAlign.center |
| titleOverflow | TextOverflow | Text overflow for title | Null |
| textTextAlign | TextAlign | Text alignment for text | TextAlign.center |
| textOverflow | TextOverflow | Text overflow for text | Null |
| canPop | boolean | Prevents undesired navigation unless explicitly desired. | true |
| onPopInvoked | void Function(bool)? | Notifies of whether the context was popped with `didPop` parameter | Null |

### Popping the dialog

To pop the dialog from one of the buttons, you have the following options.

1. Using `closeOnConfirmBtnTap: true` will automatically pop the dialog when the confirm button is tapped.
2. Using `confirmBtnTap` or `cancelBtnTap` functions to pop the dialog manually. This should be done with the context provided (see notes below)
```dart
CoolAlert.show(
context: context,
type: CoolAlertType.success,
text: "Your transaction was successful!",
confirmBtnTap: (dialogContext) {
Navigator.pop(dialogContext);
}
);
```
**Notes:**

| Attribute | Data type | Description | Default Value |
|:----------------------|:-------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------:|
| context| BuildContext | @required | Null |
| type | CoolAlertType | @required - Type of alert dialog, ex: CoolAlertType.success for success dialogs | Null
title| String | Set a custom title for dialog | Based on the CoolAlertType selected| |
| text| String | Set the description text of the dialog. | Null |
| widget| Widget | Set any you expect widget of the dialog. | Null |
| confirmBtnText | String | Text of confirm button | 'Ok' | |
| confirmBtnTap| Function | Function that handle click of confirm button | () => Navigator.pop(context)|
| confirmBtnColor| Color | Color of confirm Button | Theme.of(context).primaryColor | |
| cancelBtnText| String | Text of cancel button | 'Cancel' |
| cancelBtnTap| Function | Function that handle click of cancel button | () => Navigator.pop(context)
| barrierDismissible| bool | Dismiss dialog on touch overlay | true
| animType | CoolAlertAnimType| Type of dialogue enter animation | CoolAlertAnimType.scale|
| backgroundColor | Color| Background color of the animation | Color(0xFF515C6F)|
| confirmBtnTextStyle | TextStyle | Confirm button text theme | TextStyle(color: Colors.white, fontWeight:FontWeight.w600,fontSize: 18.0)|
| cancelBtnTextStyle | TextStyle | Cancel button text theme | TextStyle(color: Colors.grey, fontWeight:FontWeight.w600,fontSize: 18.0)|
| flareAsset | String | Custom flare asset | "animation.flr" |
| flareAnimationName | String | The name of the flare animation to play | "play" |
| lottieAsset | String | Custom lottie asset | "animation.json" |
|autoCloseDuration|Duration|Determines how long the dialog stays open for before closing|Null|
|width|double|Dialog width|MediaQuery.of(context).size.width|
|loopAnimation|boolean|Determines if the animation should loop or not|false|
|closeOnConfirmBtnTap|boolean|Detemines if dialog closes when the confirm button is tapped|true|
|reverseBtnOrder|boolean|Reverse the order of the buttons|false|



- if you have have `closeOnConfirmBtnTap: true` while calling `Navigator.pop(dialogContext)` in the above example, you'll pop twice and may run into some issues. Have either one or the other.
- If you have `autoCloseDuration` set, this is a wrapper for `Navigator.pop(coolAlertParentContext, rootNavigator: true)` after the duration is up. In the above example, if the user taps "confirm" and the dialog auto closes, it will pop twice and you may run into issues.



Expand Down
1 change: 1 addition & 0 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
namespace "com.example.example"
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion

Expand Down
6 changes: 3 additions & 3 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.7.10'
ext.kotlin_version = '1.9.0'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.2.0'
classpath 'com.android.tools.build:gradle:8.5.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand All @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
Loading