diff --git a/CHANGELOG.md b/CHANGELOG.md index d5851026..aea3b37d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.0.51 + +- [DSDialogService] Fixed hasDialogOpen method. Created isDialogOpen property instead. + ## 0.0.50 - [DSDialogService] Create hasDialogOpen method. diff --git a/lib/src/services/ds_dialog.service.dart b/lib/src/services/ds_dialog.service.dart index d202f7cd..fe4a2fa7 100644 --- a/lib/src/services/ds_dialog.service.dart +++ b/lib/src/services/ds_dialog.service.dart @@ -11,24 +11,25 @@ import '../widgets/texts/ds_headline_small_text.widget.dart'; /// A Design System's [Dialog] used to display a dialog box. class DSDialogService { - final String title; - final String text; - final Widget? primaryButton; - final Widget? secondaryButton; - final BuildContext? context; - - DSDialogType type = DSDialogType.system; - /// Creates a new Design System's [Dialog] DSDialogService({ - this.context, required this.title, required this.text, this.primaryButton, this.secondaryButton, - }); + final BuildContext? context, + }) : context = context ?? Get.overlayContext ?? Get.context!; - static bool hasDialogOpen({BuildContext? context}) => Get.isDialogOpen ?? false; + final String title; + final String text; + final Widget? primaryButton; + final Widget? secondaryButton; + final BuildContext context; + + DSDialogType type = DSDialogType.system; + + bool _isDialogOpen = false; + bool get isDialogOpen => _isDialogOpen; /// Shows a [DSDialogType.warning] dialog box type Future showWarning() => _show( @@ -50,12 +51,18 @@ class DSDialogService { }) { this.type = type; + _isDialogOpen = true; + return showDialog( - context: context ?? Get.context!, + context: context, barrierDismissible: false, useSafeArea: true, builder: (_) => _buildDialog(type), - ); + ).then((value) { + _isDialogOpen = false; + + return value; + }); } Widget _buildDialog(final DSDialogType type) { diff --git a/pubspec.yaml b/pubspec.yaml index 593be09a..2dbfe077 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: blip_ds description: Blip Design System for Flutter. -version: 0.0.50 +version: 0.0.51 homepage: https://github.com/takenet/blip-ds-flutter#readme repository: https://github.com/takenet/blip-ds-flutter diff --git a/sample/pubspec.lock b/sample/pubspec.lock index a81ca50c..23301564 100644 --- a/sample/pubspec.lock +++ b/sample/pubspec.lock @@ -23,7 +23,7 @@ packages: path: ".." relative: true source: path - version: "0.0.50" + version: "0.0.51" boolean_selector: dependency: transitive description: