1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| static var fontSizeList = List.generate(37, (i) => 14 + i);
final List<DropdownMenuItem<String>> _dropDownMenuItem = fontSizeList.map( (int fontSize) { return new DropdownMenuItem<String>( value: fontSize.toString(), child: Text(fontSize.toString()), ); }, ).toList();
Widget build(BuildContext context) { return Scaffold( child: Column( children: <Widget>[ Flexible( child: ListView( children: <Widget>[ ListTile( leading: Icon(Icons.format_size), title: Text("フォントサイズを選ぶ: "), trailing: DropdownButton<String>( value: _selectedFontSize, onChanged: (String newValue) { setState(() { this._selectedFontSize = newValue; }); }, items: this._dropDownMenuItem, ), ), ], ), ), ], ), ); }
|