Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: nes dialog has configurable generics now #75

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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