【问题标题】:How to check if a button is currently active in flutter?如何检查按钮当前是否在颤动中处于活动状态?
【发布时间】:2020-02-28 09:32:11
【问题描述】:

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

[]

【问题讨论】:

标签: android user-interface flutter mobile-development


【解决方案1】:

Flutter 在 v1.9.1 中添加了切换按钮,它由一组按钮组成,回调返回哪个被选中

您可以查看链接: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
),

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-11
    • 1970-01-01
    • 2020-01-11
    • 2019-12-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多