- snippet.dart
Future<bool> _selectWinner( BuildContext context, List<User> playerList) async { return showDialog( context: context, builder: (context) { return StatefulBuilder(builder: (context, setState) { List<Widget> playerSelect = []; playerList.forEach((User player) { Widget listTile = Row( children: <Widget>[ Radio( value: player.deviceId, groupValue: winnerId, onChanged: (String id) { winnerId = id; setState(() {}); }, ), Text(player.name) ], ); playerSelect.add(listTile); }); return AlertDialog( title: new Text('Select Winner !'), content: Column( mainAxisSize: MainAxisSize.min, children: playerSelect, ), actions: <Widget>[ new FlatButton( onPressed: () => Navigator.of(context).pop(false), child: new Text('No'), ), new FlatButton( onPressed: () => Navigator.of(context).pop(true), child: new Text('Yes'), ), ], ); }); }, ) ?? false; }
관련 문서
Plugin Backlinks: 아무 것도 없습니다.