如何检查按钮中当前是否处于活动状态?下面是我要创建的按钮的图像:
[]
答案 0 :(得分:1)
v1.9.1中的Flutter add切换按钮,由一组按钮组成,这些按钮组成一个回调,返回选择的那个
您可以检查链接:https://api.flutter.dev/flutter/material/ToggleButtons-class.html
一个小例子
ToggleButtons(
children: <Widget>[
Icon(Icons.add),
Icon(Icons.car),
Icon(Icons.menu),
],
onPressed: (int index) {
//returned the selected index user chose
},
isSelected: isSelected,// which is a List<bool> that to define the selected button
),