Skip to content

Commit

Permalink
Merge pull request #141 from takenet/develop
Browse files Browse the repository at this point in the history
Release v0.0.51
  • Loading branch information
leonardogbr authored May 15, 2023
2 parents 0a4e71e + adf6ee7 commit fc1d17e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.0.51

- [DSDialogService] Fixed hasDialogOpen method. Created isDialogOpen property instead.

## 0.0.50

- [DSDialogService] Create hasDialogOpen method.
Expand Down
33 changes: 20 additions & 13 deletions lib/src/services/ds_dialog.service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<T?> showWarning<T>() => _show<T>(
Expand All @@ -50,12 +51,18 @@ class DSDialogService {
}) {
this.type = type;

_isDialogOpen = true;

return showDialog<T>(
context: context ?? Get.context!,
context: context,
barrierDismissible: false,
useSafeArea: true,
builder: (_) => _buildDialog(type),
);
).then((value) {
_isDialogOpen = false;

return value;
});
}

Widget _buildDialog(final DSDialogType type) {
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: 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

Expand Down
2 changes: 1 addition & 1 deletion sample/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.0.50"
version: "0.0.51"
boolean_selector:
dependency: transitive
description:
Expand Down

0 comments on commit fc1d17e

Please sign in to comment.