Flutter DropdownButtonのアイコンの有効時の色を設定するサンプル
環境
Windows11 pro 64bit
Flutter 3.3.7
構文
DropdownButton( iconEnabledColor: /*アイコンの有効時の色*/, value: _text,
DropdownButtonの引数「iconEnabledColor」にアイコンの有効時の色を指定します。
使用例
class Sample extends StatefulWidget {
@override
_SampleState createState() => _SampleState();
}
class _SampleState extends State<Sample> {
var _text = 'study';
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: DropdownButton(
iconEnabledColor: Colors.pink,
value: _text,
items: [
DropdownMenuItem(
child: Text('study'),
value: 'study',
),
DropdownMenuItem(
child: Text('12345'),
value: '12345',
),
],
onChanged: (String? value) {
setState(() {
_text = value ?? 'study';
});
},
),
),
);
}
}