Skip to content

Commit

Permalink
Merge pull request #26 from emreesen27/develop-112
Browse files Browse the repository at this point in the history
v112 done.
  • Loading branch information
emreesen27 authored Jan 22, 2023
2 parents 40372dd + a4ca32e commit 47031a3
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 30 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [1.1.2] - 22-01-2023
* Auto hidden added.
* Readme edited.

## [1.1.1] - 21.01.2023
* Readme Edited.

## [1.1.0] - 20.05.2022
* Bug Fix.
* Cancel option added.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Progress dialog package for flutter
You must add the library as a dependency to your project.
```yaml
dependencies:
sn_progress_dialog: ^1.1.0
sn_progress_dialog: ^1.1.2
```
You should then run `flutter packages get`
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ packages:
path: ".."
relative: true
source: path
version: "1.1.0"
version: "1.1.2"
source_span:
dependency: transitive
description:
Expand Down
5 changes: 5 additions & 0 deletions lib/options/cancel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,15 @@ class Cancel {
// (Default: black)
final Color? cancelImageColor;

/// [autoHidden] It hides the cancel button when value and max are equal.
// (Default: true)
final bool autoHidden;

Cancel({
this.cancelClicked,
this.cancelImage,
this.cancelImageSize = 15.0,
this.cancelImageColor = Colors.black,
this.autoHidden = true,
});
}
56 changes: 29 additions & 27 deletions lib/progress_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ProgressDialog {
if (_dialogIsOpen) {
Navigator.pop(_context);
_dialogIsOpen = false;
setDialogStatus(DialogStatus.closed);
_setDialogStatus(DialogStatus.closed);
}
});
}
Expand All @@ -57,7 +57,7 @@ class ProgressDialog {
}

///[setDialogStatus] Dialog window sets your new state.
void setDialogStatus(DialogStatus status) {
void _setDialogStatus(DialogStatus status) {
if (_onStatusChanged != null) _onStatusChanged!(status);
}

Expand Down Expand Up @@ -139,7 +139,7 @@ class ProgressDialog {
_dialogIsOpen = true;
_msg.value = msg;
_onStatusChanged = onStatusChanged;
setDialogStatus(DialogStatus.opened);
_setDialogStatus(DialogStatus.opened);
return showDialog(
barrierDismissible: barrierDismissible,
barrierColor: barrierColor,
Expand All @@ -157,38 +157,40 @@ class ProgressDialog {
valueListenable: _progress,
builder: (BuildContext context, dynamic value, Widget? child) {
if (value == max) {
setDialogStatus(DialogStatus.completed);
_setDialogStatus(DialogStatus.completed);
completed == null
? close(delay: closeWithDelay)
: close(delay: completed.completionDelay);
}
return Column(
mainAxisSize: MainAxisSize.min,
children: [
cancel != null
? Align(
alignment: Alignment.topRight,
child: InkWell(
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
onTap: () {
close();
if (cancel.cancelClicked != null)
cancel.cancelClicked!();
},
child: Image(
width: cancel.cancelImageSize,
height: cancel.cancelImageSize,
color: cancel.cancelImageColor,
image: cancel.cancelImage ??
AssetImage(
"images/cancel.png",
package: "sn_progress_dialog",
),
if (cancel != null) ...[
cancel.autoHidden && value == max
? SizedBox.shrink()
: Align(
alignment: Alignment.topRight,
child: InkWell(
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
onTap: () {
close();
if (cancel.cancelClicked != null)
cancel.cancelClicked!();
},
child: Image(
width: cancel.cancelImageSize,
height: cancel.cancelImageSize,
color: cancel.cancelImageColor,
image: cancel.cancelImage ??
AssetImage(
"images/cancel.png",
package: "sn_progress_dialog",
),
),
),
),
)
: Container(),
],
Row(
children: [
value == max && completed != null
Expand Down Expand Up @@ -261,7 +263,7 @@ class ProgressDialog {
? Alignment.bottomRight
: Alignment.bottomCenter,
)
: Container()
: SizedBox.shrink()
],
);
},
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: sn_progress_dialog
description: Customizable progress dialog package for Flutter.(Captures the progress value)
version: 1.1.0
version: 1.1.2
homepage: https://github.com/emreesen27/Flutter-Progress-Dialog.git

environment:
Expand Down

0 comments on commit 47031a3

Please sign in to comment.