Frezyx / group_button

:sweat_drops: Flutter custom widget to make a group buttons. Included Radio and CheckBox buttons.

Home Page:https://pub.dev/packages/group_button

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

_GroupButtonBodyState.initState() minor bug

slavap opened this issue · comments

class _GroupButtonBodyState extends State<GroupButtonBody> {
  @override
  void initState() {
    super.initState();

    if (!widget.isRadio) {
      widget.controller.toggleIndexes(widget.selectedButtons ?? []); // <<< has to be selectIndexes
    }

Because the following code is not working properly:

GroupButton(
  selectedButtons: selected,
  controller: GroupButtonController()..selectIndexes(selected),

It's oversimplified example, the point is that you cannot set properly synchronized selectedButtons and controller.