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: input read-only #290

Merged
merged 3 commits into from
Feb 10, 2025
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
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