Skip to content

Commit

Permalink
fix: on changed for each field
Browse files Browse the repository at this point in the history
  • Loading branch information
nank1ro committed Jan 30, 2025
1 parent e8f8240 commit 487c856
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/src/components/time_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -711,9 +711,9 @@ class _ShadTimePickerState extends State<ShadTimePicker> {
decoration: effectiveFieldDecoration,
enabled: widget.enabled,
onChanged: (v) {
if (v.length == 2) {
if (v.isNotEmpty) {
controller.setHour(int.tryParse(v));
if (effectiveJumpToNextField) {
if (v.length == 2 && effectiveJumpToNextField) {
focusNodes[1].requestFocus();
}
}
Expand All @@ -732,9 +732,9 @@ class _ShadTimePickerState extends State<ShadTimePicker> {
decoration: effectiveFieldDecoration,
enabled: widget.enabled,
onChanged: (v) {
if (v.length == 2) {
if (v.isNotEmpty) {
controller.setMinute(int.tryParse(v));
if (effectiveJumpToNextField) {
if (v.length == 2 && effectiveJumpToNextField) {
focusNodes[2].requestFocus();
}
}
Expand All @@ -753,9 +753,10 @@ class _ShadTimePickerState extends State<ShadTimePicker> {
decoration: effectiveFieldDecoration,
enabled: widget.enabled,
onChanged: (v) {
if (v.length == 2) {
if (v.isNotEmpty) {
controller.setSecond(int.tryParse(v));
if (effectiveJumpToNextField &&
if (v.length == 2 &&
effectiveJumpToNextField &&
widget.variant == ShadTimePickerVariant.period) {
periodFocusNode.requestFocus();
}
Expand Down

0 comments on commit 487c856

Please sign in to comment.