// Copyright 2014 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import 'package:flutter/material.dart'; /// Flutter code sample for [RadioListTile]. void main() => runApp(const RadioListTileApp()); class RadioListTileApp extends StatelessWidget { const RadioListTileApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( theme: ThemeData(useMaterial3: true), home: Scaffold( appBar: AppBar(title: const Text('RadioListTile Sample')), body: const RadioListTileExample(), ), ); } } enum SingingCharacter { lafayette, jefferson } class RadioListTileExample extends StatefulWidget { const RadioListTileExample({super.key}); @override State createState() => _RadioListTileExampleState(); } class _RadioListTileExampleState extends State { SingingCharacter? _character = SingingCharacter.lafayette; @override Widget build(BuildContext context) { return Column( children: [ RadioListTile( title: const Text('Lafayette'), value: SingingCharacter.lafayette, groupValue: _character, onChanged: (SingingCharacter? value) { setState(() { _character = value; }); }, ), RadioListTile( title: const Text('Thomas Jefferson'), value: SingingCharacter.jefferson, groupValue: _character, onChanged: (SingingCharacter? value) { setState(() { _character = value; }); }, ), ], ); } }