Skip to content

Commit

Permalink
feat: Removing deprecations from flutter 3.18 (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
erickzanardo authored Feb 22, 2024
1 parent d99a065 commit c3e5d80
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 25 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# 0.16.0
- feat: add `NesIcons.camera`
- chore: Removing usage from deprecated members from Flutter 3.18.

# 0.15.0
- feat: add `NesIcons.audioMuted`
Expand Down
18 changes: 10 additions & 8 deletions example/lib/gallery/sections/dialogs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,20 @@ class DialogsSection extends StatelessWidget {
type: NesButtonType.normal,
child: const Text('Input'),
onPressed: () async {
void showSnack(String? inputData) {
if (inputData != null) {
NesSnackbar.show(
context,
text: inputData,
);
}
}

final inputData = await NesInputDialog.show(
context: context,
message: 'What is the coolest NES game?',
);

if (inputData != null) {
// ignore: use_build_context_synchronously
NesSnackbar.show(
context,
text: inputData,
);
}
showSnack(inputData);
},
),
],
Expand Down
18 changes: 5 additions & 13 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,18 @@ packages:
dependency: transitive
description:
name: material_color_utilities
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
url: "https://pub.dev"
source: hosted
version: "0.5.0"
version: "0.8.0"
meta:
dependency: transitive
description:
name: meta
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
url: "https://pub.dev"
source: hosted
version: "1.10.0"
version: "1.11.0"
mini_sprite:
dependency: transitive
description:
Expand Down Expand Up @@ -282,14 +282,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.1.0"
web:
dependency: transitive
description:
name: web
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
url: "https://pub.dev"
source: hosted
version: "0.3.0"
win32:
dependency: transitive
description:
Expand All @@ -307,5 +299,5 @@ packages:
source: hosted
version: "1.0.3"
sdks:
dart: ">=3.2.0-194.0.dev <4.0.0"
dart: ">=3.2.0-0 <4.0.0"
flutter: ">=3.10.0"
6 changes: 3 additions & 3 deletions lib/src/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ class NesKeyboardInputAdapter extends NesInputAdapter {

final Map<FocusNode, Map<NesInputEvent, List<VoidCallback>>> _events = {};

KeyEventResult _handle(FocusNode node, RawKeyEvent event) {
KeyEventResult _handle(FocusNode node, KeyEvent event) {
final events = _events[node];
if (events != null) {
if (event is RawKeyUpEvent) {
if (event is KeyUpEvent) {
if (!node.hasPrimaryFocus) {
return KeyEventResult.handled;
}
Expand Down Expand Up @@ -191,7 +191,7 @@ class NesInputController {
}

/// Process keyboard inputs events.
KeyEventResult processKeyBoardInput(FocusNode node, RawKeyEvent event) {
KeyEventResult processKeyBoardInput(FocusNode node, KeyEvent event) {
final keyboardAdapters = adapters.whereType<NesKeyboardInputAdapter>();
for (final adapter in keyboardAdapters) {
return adapter._handle(node, event);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/widgets/nes_controller_focus.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class _NesControllerFocusState extends State<NesControllerFocus> {
@override
Widget build(BuildContext context) {
return Focus(
onKey: _nesInputController.processKeyBoardInput,
onKeyEvent: _nesInputController.processKeyBoardInput,
focusNode: _focusNode,
child: widget.child,
);
Expand Down

0 comments on commit c3e5d80

Please sign in to comment.