Skip to content

Commit

Permalink
fix: nes dialog has configurable generics now (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
erickzanardo authored Sep 7, 2023
1 parent 1f7cfcf commit 05d377e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# 0.9.0
- feat: add `NesIcons.expand`
- fix: `NesDialog` allows a generic to be informed.

# 0.8.0
- feat: add `NesIcons.leftHand`
Expand Down
2 changes: 1 addition & 1 deletion example/lib/gallery/sections/dialogs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class DialogsSection extends StatelessWidget {
type: NesButtonType.normal,
child: const Text('Plain'),
onPressed: () {
NesDialog.show(
NesDialog.show<void>(
context: context,
builder: (_) => const Text('Hello World'),
);
Expand Down
4 changes: 2 additions & 2 deletions lib/src/widgets/dialogs/nes_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ class NesDialog extends StatelessWidget {
final Widget child;

/// A shortcut method that can be used to show this dialog.
static Future<bool?> show({
static Future<T?> show<T>({
required BuildContext context,
required WidgetBuilder builder,
}) {
return showGeneralDialog<bool>(
return showGeneralDialog<T>(
context: context,
transitionBuilder: (context, animation, secondaryAnimation, child) {
return Transform.scale(
Expand Down
2 changes: 1 addition & 1 deletion test/src/widgets/dialogs/nes_dialog_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extension NesDialogTest on WidgetTester {
return NesButton(
type: NesButtonType.normal,
onPressed: () async {
final value = await NesDialog.show(
final value = await NesDialog.show<bool>(
context: context,
builder: (_) => const Text('Hello World'),
);
Expand Down

0 comments on commit 05d377e

Please sign in to comment.