Flutter ToggleButtons 一組切換按鈕

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 屬性配置的是一個(gè)數(shù)組,可以裝填多個(gè) widget,顯示出來的按鈕組是按順序排列的。
每個(gè)按鈕的狀態(tài)由isSelected控制,這是一個(gè)bool列表,用于確定按鈕是處于未選中狀態(tài)還是已選中狀態(tài)。
2.1 測試用例頁面
2.2 ToggleButtons 的核心使用代碼
2.3 constraints 屬性配置
配置 BoxConstraints ,BoxConstraints 就是繼承自 Constraints 然后有最小和最大的寬高,最小值都是0,最大值都是無限大。

完畢
標(biāo)簽: