【发布时间】:2019-08-18 21:28:10
【问题描述】:
假设以下代码
ChipTheme(
data: theme.chipTheme.copyWith(
//labelStyle: TextStyle(color: Colors.black),
secondaryLabelStyle: TextStyle(color: Colors.black),
//selectedColor: Colors.black,
secondarySelectedColor: Colors.grey[300],
//brightness: Brightness.light
),
child:
Row(
children: <Widget>[
Chip(
//selected: currentLevel >= 1,
label: new Text("Level 1"),
avatar: new CircleAvatar(
backgroundColor: Colors.green,
child: Text("1")
),
),
ChoiceChip(
selected: currentLevel >= 2,
label: new Text("Level 2"),
avatar: new CircleAvatar(
backgroundColor: Colors.green,
child: Text("2")
),
),
ChoiceChip(
selected: currentLevel >= 3,
label: new Text("Level 3"),
avatar: new CircleAvatar(
backgroundColor: Colors.green,
child: Text("3")
),
),
],
),
),
此结果如下所示:
第一个是一个简单的芯片小部件。这就是我想要的“选择”ChoiceChip。但是正如你所看到的,第二个芯片与第一个相比看起来不同。这是为什么?我对第三个未选择的 ChoiceChip 感到满意。无论我做什么,我都无法让第二个看起来像第一个,因为 ChoiceChip 似乎使所有东西都变暗(绿色头像和背景颜色)。
所选的 ChoiceChip 甚至看起来不像已选中或处于活动状态。它看起来几乎和未选中的一样(第三个)。
感谢您提供如何正确设置样式的任何提示。
【问题讨论】:
-
你要单选还是多选?