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

Dropdown Knobs crash the storybook if an invalid value is typed. #1151

Closed
bramp opened this issue Mar 1, 2024 · 0 comments · Fixed by #1152
Closed

Dropdown Knobs crash the storybook if an invalid value is typed. #1151

bramp opened this issue Mar 1, 2024 · 0 comments · Fixed by #1152
Labels
m: knobs p: core Related to `widgetbook` package t: bug Something isn't working

Comments

@bramp
Copy link
Contributor

bramp commented Mar 1, 2024

Description

Dropdown Knobs crash the storybook if an invalid value is typed.

Steps To Reproduce

  1. Add a list knob to your story, (The TextScale is used as an example)
Screenshot 2024-03-01 at 8 28 54 am
  1. Type into the box any invalid value.
Screenshot 2024-03-01 at 8 30 21 am
  1. Press enter

  2. Bang

════════ Exception caught by widgets ═══════════════════════════════════════════
The following _TypeError was thrown while calling onEditingComplete for TextInputAction.done:
Null check operator used on a null value

When the exception was thrown, this was the stack:
#0 ListField.toWidget. (package:widgetbook/src/fields/list_field.dart:41:63)
list_field.dart:41
#1 _DropdownMenuState.build.. (package:flutter/src/material/dropdown_menu.dart:695:36)
dropdown_menu.dart:695
#2 EditableTextState._finalizeEditing (package:flutter/src/widgets/editable_text.dart:3277:34)
editable_text.dart:3277
#3 EditableTextState.performAction (package:flutter/src/widgets/editable_text.dart:3140:9)
editable_text.dart:31

Expected Behavior

The app does not crash, and instead rejects the input in some way.

bramp added a commit to bramp/widgetbook that referenced this issue Mar 1, 2024
The DropdownMenu has search enabled, which allows users to type any input. If the user types something that doesn't match an existing item, value is null, leading to a null pointer issue.

Fixes widgetbook#1151
@YoussefRaafatNasry YoussefRaafatNasry added t: bug Something isn't working p: core Related to `widgetbook` package m: knobs labels Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
m: knobs p: core Related to `widgetbook` package t: bug Something isn't working
Projects
None yet
2 participants