Skip to content

Migrate RadioButton to use Flutter's RawRadio. #1273

@bdlukaa

Description

@bdlukaa

Update RadioButton to use Flutter's RawRadio under the hood. We already implement RawScrollbar and the goal is to implement most of the flutter ˜Raw˜ widgets available.

Currently, RadioButton is used like this to create a radio group:

int? selected;

Column(
  children: List.generate(3, (index) {
    return RadioButton(
      checked: selected == index,
      onChanged: (checked) {
        if (checked) {
          setState(() => selected = index);
        }
      }
    );
  }),
)

The API should be changed to the following:

int? index;

RadioGroup<int>(
  groupValue: index,
  onChanged: (v) => setState(() => index = v),
  child: Column(children: [
    RadioButton<int>(value: 0),
    RadioButton<int>(value: 1),
    RadioButton<int>(value: 2),
  ]),
)

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions