amin jamali
amin jamali

Reputation: 440

How to make single select chips in flutter

I needs a group chip like this:

https://i.sstatic.net/lBMIM.png

Also it should be single select.it means just one item can select and the others should stay deselect just like a radio group. Any idea will be greate.

Upvotes: 1

Views: 2355

Answers (2)

Shourya Shikhar
Shourya Shikhar

Reputation: 1524

You can use simple_chips_input package for this.

It has a library called select_chips_input. It would suit your requirements.

Upvotes: 1

Tasnuva Tavasum oshin
Tasnuva Tavasum oshin

Reputation: 4750

You can do it Like this :

import 'package:flutter/material.dart';

class JustTest extends StatelessWidget {
  List<String> chipList = ["hello", "hi", "How are you"];
  @override
  Widget build(BuildContext context) {
    return ListView.builder(
      itemCount: chipList.length,
      itemBuilder: (context, index) => InkWell(
          onTap: () {
            //do your work here
          },
          child: Chip(label: Text(chipList[index]))),
    );
  }
}

Upvotes: 0

Related Questions