Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to define and use generic typed widget in xml? #15

Open
Jamesweng opened this issue Apr 26, 2021 · 0 comments
Open

How to define and use generic typed widget in xml? #15

Jamesweng opened this issue Apr 26, 2021 · 0 comments

Comments

@Jamesweng
Copy link
Contributor

Jamesweng commented Apr 26, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant