Skip to content

Commit

Permalink
fix: input read-only (#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
nank1ro authored Feb 10, 2025
1 parent bec1b21 commit a8a44c2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.19.0

- **FIX**: `ShadInput` `readOnly` not updating.

## 0.18.7

- **FIX**: `ShadApp` dark theme behavior now is the same as Material. The dark theme is applied only if you provide a `darkTheme` and the user theme mode is dark
Expand Down
8 changes: 3 additions & 5 deletions lib/src/components/input.dart
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,9 @@ class ShadInputState extends State<ShadInput>
}

if (widget.readOnly != oldWidget.readOnly) {
_focusNode?.canRequestFocus = widget.readOnly;
}

if (effectiveFocusNode.hasFocus && widget.readOnly != oldWidget.readOnly) {
if (effectiveController.selection.isCollapsed) {
effectiveFocusNode.canRequestFocus = !widget.readOnly;
if (effectiveFocusNode.hasFocus &&
effectiveController.selection.isCollapsed) {
_showSelectionHandles = !widget.readOnly;
}
}
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: shadcn_ui
description: shadcn-ui ported in Flutter. Awesome UI components for Flutter, fully customizable.
version: 0.18.7
version: 0.19.0
homepage: https://flutter-shadcn-ui.mariuti.com
repository: https://github.com/nank1ro/flutter-shadcn-ui
documentation: https://flutter-shadcn-ui.mariuti.com
Expand Down

0 comments on commit a8a44c2

Please sign in to comment.