AbdulRahmanAlHamali / flutter_typeahead

A TypeAhead widget for Flutter, where you can show suggestions to users as they type

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] TextInputAction.next throw RenderAbstractViewport.of()

Poloten opened this issue · comments

Steps to reproduce

When click next on keyboard get exeption.

Expected results

move to next TextFormField / TextField

Actual results

════════ Exception caught by services library ══════════════════════════════════
RenderAbstractViewport.of() was called with a render object that was not a descendant of a RenderAbstractViewport.
════════════════════════════════════════════════════════════════════════════════

Package Version

5.2.0

Platform

Android

Code sample

    return TypeAheadField<ContactDesc>(
      decorationBuilder: (context, child) {
        bool darkEnabled = MediaQuery.of(context).platformBrightness == Brightness.dark;

        return Material(
          type: MaterialType.card,
          color: darkEnabled
              ? const Color.fromRGBO(31, 31, 31, 1)
              : const Color.fromRGBO(250, 250, 250, 1),
          elevation: 4,
          borderRadius: BorderRadius.circular(8),
          child: child,
        );
      },
      controller: widget.cntrl,
      hideOnEmpty: true,
      suggestionsCallback: (search) => list(search),
      builder: (context, controller, focusNode) {
        return TextField(
          controller: controller,
          focusNode: focusNode,
          autofocus: true,
          decoration: InputDecoration(
            labelText: widget.label,
            helperText: widget.hintText,
          ),
          textInputAction: TextInputAction.next,
        );
      },
      itemBuilder: (context, item) {
        return ListTile(
          title: Text(item.nick),
          leading: AvatarWidget(wmid: item.wmid),
        );
      },
      onSelected: (item) {
        widget.cntrl.text = item.name;
        widget.onChange(item.name);
      },
      itemSeparatorBuilder: (context, index) {
        return const Divider(
          indent: 60,
          endIndent: 10,
          height: 1,
          thickness: 0.5,
        );
      },
    );
  }

Logs

No response

Screenshots or Video

No response

Duplicate of #552