flutter_chips_input icon indicating copy to clipboard operation
flutter_chips_input copied to clipboard

When Press Any Key in keyboard then not working properly ,also Backspace key not working in some Device Like vivo, Samsung

Open vijayvaghela72 opened this issue 3 years ago • 6 comments

try with many samsung device and vivo device , in all samsung device it's not working , some vivo device it's working and in some it's not working .

my code like this ,

`RawKeyboardListener( focusNode: FocusNode(), autofocus: true, onKey: (RawKeyEvent event) { if (event.isKeyPressed(LogicalKeyboardKey.backspace)) { print("back space is pressed");

            print("${tempAttList}");
          }
        },
        child: ChipsInput(
          initialValue: initial,
          //  focusNode: FocusNode(),
          decoration: InputDecoration(
            filled: true,
            fillColor: lightWhite,
            hintText: 'Select Attributes Values',
            hintStyle: Theme.of(context).textTheme.caption,
            contentPadding:
                EdgeInsets.symmetric(horizontal: 10, vertical: 5),
            prefixIconConstraints:
                BoxConstraints(minWidth: 40, maxHeight: 20),
            focusedBorder: OutlineInputBorder(
              borderSide: BorderSide(color: fontColor),
              borderRadius: BorderRadius.circular(7.0),
            ),
            enabledBorder: UnderlineInputBorder(
              borderSide: BorderSide(color: lightWhite),
              borderRadius: BorderRadius.circular(8.0),
            ),
          ),
          findSuggestions: (String query) {
            print("query : $query ");
            // if (query.isNotEmpty) {
            //   print("query is emptly ");
            // }
            if (query.isNotEmpty) {
              print("query.length : ${query.length}");
              return attributesValueList.where((profile) {
                // print("values****$query***${profile.attributeId}****\n"
                //     "${profile.value}****${attrId[index]}***$index**$attrId");

                return (profile.value!.toLowerCase().contains(query) &&
                    (int.parse(profile.attributeId!) == attrId[index]));
              }).toList(growable: false);
            } else {
              return attributesValueList.where((profile) {
                return (int.parse(profile.attributeId!) == attrId[index]);
              }).toList(growable: false);
            }
          },
          onChanged: (List<AttributeValueModel> data) {
            //add remove
            for (int i = 0; i < data.length; i++) {
              if (!attrValId.contains(data[i].id)) {
                attrValId.add(int.parse(data[i].id!));
                attrVal.add(data[i].value!);
              }
            }
            if (!tempAttList.contains(data)) {
              //
              if (tempAttList.length >= index) {
                if (tempAttList.length > index) tempAttList.removeAt(index);
                tempAttList.insert(index, data);
              } else
                tempAttList[index] = data;
            }
          },
          chipBuilder: (BuildContext context,
              ChipsInputState<AttributeValueModel> state,
              AttributeValueModel profile) {
            return InputChip(
              key: ObjectKey(profile),
              label: Text(profile.value!),
              onDeleted: () => state.deleteChip(profile),
              // commnet by me     //   onSelected: (_) => _onChipTapped(profile),
              materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
            );
          },
          suggestionBuilder: (BuildContext context,
              ChipsInputState<AttributeValueModel> state,
              AttributeValueModel profile) {
            return ListTile(
              dense: true,
              key: ObjectKey(profile),
              title: Text(profile.value!),
              onTap: () => state.selectSuggestion(profile),
            );
          },
        ),
      ),`

Thank You...!

vijayvaghela72 avatar Dec 08 '21 07:12 vijayvaghela72

I can't get the example working. Wondering if this is no longer maintained?

Iphone 12 emulator keyboard is really glitchy. Can only type one character, then doesn't let me do anything.

jameslester2004 avatar Dec 09 '21 13:12 jameslester2004

yes @jameslester2004 sir

you are right.

getting same problem with android device but package team don't respond any more .

Hope they will solve soon ...!

vijayvaghela72 avatar Dec 10 '21 04:12 vijayvaghela72

Having the same problems. This package is otherwise awesome except that you can't easily type into the field.

Since that problem is at the core of this amazing package, that leads me to believe the package is now defunct?

Does anyone know of any good alternatives?

mark8044 avatar Jan 04 '22 23:01 mark8044

I'd suggest two approaches: build your own solution, or fork the package and make it work for you / share with community.

I was on a deadline, so just built my own in the end. It isn't quite as powerful as this package would have been, but does the job for me.

jameslester2004 avatar Jan 05 '22 00:01 jameslester2004

I created a solution for this and some other problems - see https://github.com/danvick/flutter_chips_input/issues/104

jozes avatar Jan 17 '22 08:01 jozes

@jozes can you make a PR into this repo?

novvia-dev avatar Sep 01 '22 18:09 novvia-dev