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

Spacing should be required

SalahAdDin opened this issue · comments

Using this package to build our questionary app we got the next bug:

======== Exception caught by widgets library =======================================================
The following _CastError was thrown building GroupButtonBody(dirty, dependencies: [_InheritedProviderScope<GroupButtonBloc>]):
Null check operator used on a null value

The relevant error-causing widget was: 
  GroupButton file:///home/luisalaguna/Projects/thesis_cancer/lib/features/survey/presentation/widgets/question_widget.dart:67:24
When the exception was thrown, this was the stack: 
#0      GroupButtonBody.build (package:group_button/src/group_button_body.dart:55:23)
#1      StatelessElement.build (package:flutter/src/widgets/framework.dart:4569:28)
#2      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4495:15)
#3      Element.rebuild (package:flutter/src/widgets/framework.dart:4189:5)
#4      ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4474:5)
...

Screenshot_player_20210420112444

My code is this one:

case QuestionType.BOOL:
        answerWidget = GroupButton(
          buttons: ['Yanlış', 'Doğru'],
          onSelected: (index, isSelected) => print('$index button is selected'),
          direction: Axis.vertical,
        );
        break;

Debugging superficially over this bug we found the next:
Screenshot_select-area_20210420113916

It seems in some cases the spacing parameter is required, but it is that in all, to build the widget correctly; adding it to my code make it works correctly.

Hence, We think this parameter would be required or would have a default value.

Thanks.

Hello @SalahAdDin ✋🏻
I solved this problem without applying required
You can check it in new package 2.1.1 release