Widget build()

in packages/diagrams/lib/src/radio_list_tile.dart [119:230]


  Widget build(BuildContext context) {
    switch (widget.name) {
      case 'radio_list_tile':
        return ConstrainedBox(
          key: UniqueKey(),
          constraints: BoxConstraints.tight(const Size(400.0, 140.0)),
          child: Container(
            alignment: FractionalOffset.center,
            padding: const EdgeInsets.all(5.0),
            color: Colors.white,
            child: Column(
              children: <Widget>[
                RadioListTile<SingingCharacter>(
                  title: const Text('Lafayette'),
                  value: SingingCharacter.lafayette,
                  groupValue: _character,
                  onChanged: (SingingCharacter? value) {
                    setState(() {
                      _character = value;
                    });
                  },
                ),
                RadioListTile<SingingCharacter>(
                  title: const Text('Thomas Jefferson'),
                  value: SingingCharacter.jefferson,
                  groupValue: _character,
                  onChanged: (SingingCharacter? value) {
                    setState(() {
                      _character = value;
                    });
                  },
                ),
              ],
            ),
          ),
        );
      case 'radio_list_tile_semantics':
        return ConstrainedBox(
          key: UniqueKey(),
          constraints: BoxConstraints.tight(const Size(400.0, 140.0)),
          child: Container(
            alignment: FractionalOffset.center,
            padding: const EdgeInsets.all(5.0),
            color: Colors.white,
            child: Column(
              children: <Widget>[
                LinkedLabelRadio(
                  label: 'First tappable label text',
                  padding: const EdgeInsets.symmetric(horizontal: 5.0),
                  value: true,
                  groupValue: _isRadioSelected,
                  onChanged: (bool? newValue) {
                    setState(() {
                      _isRadioSelected = newValue!;
                    });
                  },
                ),
                LinkedLabelRadio(
                  label: 'Second tappable label text',
                  padding: const EdgeInsets.symmetric(horizontal: 5.0),
                  value: false,
                  groupValue: _isRadioSelected,
                  onChanged: (bool? newValue) {
                    setState(() {
                      _isRadioSelected = newValue!;
                    });
                  },
                ),
              ],
            ),
          ),
        );
      case 'radio_list_tile_custom':
        return ConstrainedBox(
          key: UniqueKey(),
          constraints: BoxConstraints.tight(const Size(400.0, 140.0)),
          child: Container(
            alignment: FractionalOffset.center,
            padding: const EdgeInsets.all(5.0),
            color: Colors.white,
            child: Column(
              children: <Widget>[
                LabeledRadio(
                  label: 'This is the first label text',
                  padding: const EdgeInsets.symmetric(horizontal: 5.0),
                  value: true,
                  groupValue: _isRadioSelected,
                  onChanged: (bool? newValue) {
                    setState(() {
                      _isRadioSelected = newValue!;
                    });
                  },
                ),
                LabeledRadio(
                  label: 'This is the second label text',
                  padding: const EdgeInsets.symmetric(horizontal: 5.0),
                  value: false,
                  groupValue: _isRadioSelected,
                  onChanged: (bool? newValue) {
                    setState(() {
                      _isRadioSelected = newValue!;
                    });
                  },
                ),
              ],
            ),
          ),
        );
      default:
        return const Text('Error');
    }
  }