如何检查按钮当前是否处于活动状态?

时间:2019-11-02 10:24:42

标签: android user-interface flutter mobile-development

如何检查按钮中当前是否处于活动状态?下面是我要创建的按钮的图像:

[Below is the image for the button I am trying to create:]

1 个答案:

答案 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
),