Skip to content

Commit 3c62233

Browse files
authored
Merge pull request #27 from emreesen27/develop
Develop
2 parents 9585a70 + bfb9b7a commit 3c62233

File tree

6 files changed

+41
-30
lines changed

6 files changed

+41
-30
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [1.1.2] - 22.01.2023
2+
* Auto hidden added.
3+
* Readme edited.
4+
15
## [1.1.1] - 21.01.2023
26
* Readme edited.
37

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Progress dialog package for flutter
77
You must add the library as a dependency to your project.
88
```yaml
99
dependencies:
10-
sn_progress_dialog: ^1.1.1
10+
sn_progress_dialog: ^1.1.2
1111
```
1212
1313
You should then run `flutter packages get`

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ packages:
9999
path: ".."
100100
relative: true
101101
source: path
102-
version: "1.1.1"
102+
version: "1.1.2"
103103
source_span:
104104
dependency: transitive
105105
description:

lib/options/cancel.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,15 @@ class Cancel {
1616
// (Default: black)
1717
final Color? cancelImageColor;
1818

19+
/// [autoHidden] It hides the cancel button when value and max are equal.
20+
// (Default: true)
21+
final bool autoHidden;
22+
1923
Cancel({
2024
this.cancelClicked,
2125
this.cancelImage,
2226
this.cancelImageSize = 15.0,
2327
this.cancelImageColor = Colors.black,
28+
this.autoHidden = true,
2429
});
2530
}

lib/progress_dialog.dart

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class ProgressDialog {
4646
if (_dialogIsOpen) {
4747
Navigator.pop(_context);
4848
_dialogIsOpen = false;
49-
setDialogStatus(DialogStatus.closed);
49+
_setDialogStatus(DialogStatus.closed);
5050
}
5151
});
5252
}
@@ -57,7 +57,7 @@ class ProgressDialog {
5757
}
5858

5959
///[setDialogStatus] Dialog window sets your new state.
60-
void setDialogStatus(DialogStatus status) {
60+
void _setDialogStatus(DialogStatus status) {
6161
if (_onStatusChanged != null) _onStatusChanged!(status);
6262
}
6363

@@ -139,7 +139,7 @@ class ProgressDialog {
139139
_dialogIsOpen = true;
140140
_msg.value = msg;
141141
_onStatusChanged = onStatusChanged;
142-
setDialogStatus(DialogStatus.opened);
142+
_setDialogStatus(DialogStatus.opened);
143143
return showDialog(
144144
barrierDismissible: barrierDismissible,
145145
barrierColor: barrierColor,
@@ -157,38 +157,40 @@ class ProgressDialog {
157157
valueListenable: _progress,
158158
builder: (BuildContext context, dynamic value, Widget? child) {
159159
if (value == max) {
160-
setDialogStatus(DialogStatus.completed);
160+
_setDialogStatus(DialogStatus.completed);
161161
completed == null
162162
? close(delay: closeWithDelay)
163163
: close(delay: completed.completionDelay);
164164
}
165165
return Column(
166166
mainAxisSize: MainAxisSize.min,
167167
children: [
168-
cancel != null
169-
? Align(
170-
alignment: Alignment.topRight,
171-
child: InkWell(
172-
highlightColor: Colors.transparent,
173-
splashColor: Colors.transparent,
174-
onTap: () {
175-
close();
176-
if (cancel.cancelClicked != null)
177-
cancel.cancelClicked!();
178-
},
179-
child: Image(
180-
width: cancel.cancelImageSize,
181-
height: cancel.cancelImageSize,
182-
color: cancel.cancelImageColor,
183-
image: cancel.cancelImage ??
184-
AssetImage(
185-
"images/cancel.png",
186-
package: "sn_progress_dialog",
187-
),
168+
if (cancel != null) ...[
169+
cancel.autoHidden && value == max
170+
? SizedBox.shrink()
171+
: Align(
172+
alignment: Alignment.topRight,
173+
child: InkWell(
174+
highlightColor: Colors.transparent,
175+
splashColor: Colors.transparent,
176+
onTap: () {
177+
close();
178+
if (cancel.cancelClicked != null)
179+
cancel.cancelClicked!();
180+
},
181+
child: Image(
182+
width: cancel.cancelImageSize,
183+
height: cancel.cancelImageSize,
184+
color: cancel.cancelImageColor,
185+
image: cancel.cancelImage ??
186+
AssetImage(
187+
"images/cancel.png",
188+
package: "sn_progress_dialog",
189+
),
190+
),
188191
),
189192
),
190-
)
191-
: Container(),
193+
],
192194
Row(
193195
children: [
194196
value == max && completed != null
@@ -261,7 +263,7 @@ class ProgressDialog {
261263
? Alignment.bottomRight
262264
: Alignment.bottomCenter,
263265
)
264-
: Container()
266+
: SizedBox.shrink()
265267
],
266268
);
267269
},

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: sn_progress_dialog
22
description: Customizable progress dialog package for Flutter.(Captures the progress value)
3-
version: 1.1.1
3+
version: 1.1.2
44
homepage: https://github.com/emreesen27/Flutter-Progress-Dialog.git
55

66
environment:

0 commit comments

Comments
 (0)