skip to Main Content

I’m developing a Flutter app and I’m trying to find what this is called:

Thing I'm trying to find

Essentially, it’s a checklist that only allows one input and is two dimensional.

Selection showed

In this image, the top left box is selected.

I’d appreciate any help in trying to find what this element is called.

2

Answers


  1. From what i know in flutter, i don’t think flutter has that widget yet. So this is what i do to get around.

    I create separate listTiles or boxes or any widget of choice. And in the onpressed/onclicked property, i compared the number assigned to that widget with my global variable and if it’s true, set isSelected to true

    Works everytime

    int globalNum=3;
    //somewhere in your widget tree
    ListTile(
    selected:globalNum==1?true:false,
    selectedTileColor:Colors.red,
    onTap:()=>globalNum=1,
    ),
    ListTile(
    selected:globalNum==2?true:false,
    selectedTileColor:Colors.red,
    onTap:()=>globalNum=2,
    ),
    

    You can wrap your scaffold in a theme so that you don’t set the individual selectedTileColor. But for demostration this is how you’ll do it.

    Login or Signup to reply.
  2. If the control permits only one item at a time, it’s a Radio. See the docs for details.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search