From 63cb47968d8f0d5b779702cf574303f071681c01 Mon Sep 17 00:00:00 2001 From: Alexandru Mariuti Date: Mon, 2 Dec 2024 10:57:12 +0100 Subject: [PATCH] feat: add parameters to focusable --- CHANGELOG.md | 4 ++++ lib/src/raw_components/focusable.dart | 18 ++++++++++++++++++ pubspec.yaml | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f2439f0..05641855 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.16.1 + +- **FEAT**: Add parameters to `ShadFocusable`. + ## 0.16.0 - **FEAT**: New `ShadTimePicker` and `ShadTimePickerFormField` components. diff --git a/lib/src/raw_components/focusable.dart b/lib/src/raw_components/focusable.dart index fe111830..146fd20d 100644 --- a/lib/src/raw_components/focusable.dart +++ b/lib/src/raw_components/focusable.dart @@ -15,6 +15,12 @@ class ShadFocusable extends StatefulWidget { this.autofocus = false, this.child, this.onFocusChange, + this.onKeyEvent, + this.skipTraversal, + this.descendantsAreFocusable, + this.descendantsAreTraversable, + this.includeSemantics = true, + this.debugLabel, }); final bool canRequestFocus; @@ -23,6 +29,12 @@ class ShadFocusable extends StatefulWidget { final FocusWidgetBuilder builder; final Widget? child; final ValueChanged? onFocusChange; + final FocusOnKeyEventCallback? onKeyEvent; + final bool? skipTraversal; + final bool? descendantsAreFocusable; + final bool? descendantsAreTraversable; + final bool includeSemantics; + final String? debugLabel; @override State createState() => _ShadFocusableState(); @@ -63,6 +75,12 @@ class _ShadFocusableState extends State { canRequestFocus: widget.canRequestFocus, onFocusChange: (value) => isFocused.value = value, focusNode: focusNode, + onKeyEvent: widget.onKeyEvent, + skipTraversal: widget.skipTraversal, + descendantsAreFocusable: widget.descendantsAreFocusable, + descendantsAreTraversable: widget.descendantsAreTraversable, + includeSemantics: widget.includeSemantics, + debugLabel: widget.debugLabel, child: ValueListenableBuilder( valueListenable: isFocused, builder: (context, value, child) => diff --git a/pubspec.yaml b/pubspec.yaml index 3ca65490..ce663393 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: shadcn_ui description: shadcn-ui ported in Flutter. Awesome UI components for Flutter, fully customizable. -version: 0.16.0 +version: 0.16.1 homepage: https://flutter-shadcn-ui.mariuti.com repository: https://github.com/nank1ro/flutter-shadcn-ui documentation: https://flutter-shadcn-ui.mariuti.com