欢迎光临散文网 会员登陆 & 注册

Flutter ToggleButtons 一组切换按钮

2022-10-27 00:10 作者:早起的年轻人  | 我要投稿


A set of toggle buttons.

The list of children are laid out along direction. The state of each button is controlled by isSelected, which is a list of bools that determine if a button is in an unselected or selected state. They are both correlated by their index in the list. The length of isSelected has to match the length of the children list.

1 本文章效果

2 ToggleButtons 基本使用

ToggleButtons 是 一组切换按钮。

ToggleButtons中的children 属性配置的是一个数组,可以装填多个 widget,显示出来的按钮组是按顺序排列的。

每个按钮的状态由isSelected控制,这是一个bool列表,用于确定按钮是处于未选中状态还是已选中状态。

2.1 测试用例页面

2.2 ToggleButtons 的核心使用代码

2.3 constraints 属性配置

配置 BoxConstraints ,BoxConstraints 就是继承自 Constraints 然后有最小和最大的宽高,最小值都是0,最大值都是无限大。

完毕

Flutter ToggleButtons 一组切换按钮的评论 (共 条)

分享到微博请遵守国家法律