vscode-flutter.xml-layout icon indicating copy to clipboard operation
vscode-flutter.xml-layout copied to clipboard

How to define and use generic typed widget in xml?

Open Jamesweng opened this issue 4 years ago • 0 comments

Hi,

I would like to know if there's a way to use generic typed widget in xml? e.g., how to rewrite the following code in xml? where RadioListTile is a generic typed widget.

@override
  Widget build(BuildContext context) {
    return 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;
            });
          },
        ),
      ],
    );
  }

and moreover, is there a way to define new generic typed widget like RadioListTile in xml?

Appreciate for any info help. -James

Jamesweng avatar Apr 26 '21 10:04 Jamesweng