我正在尝试在选择特定单选按钮时更改图标。
但是,即使交换机被触发,.dart代码中的switch语句也不会更改图标。
感谢您的帮助。
class Gender extends Object with Observable {
@observable
String sex = '';
}
@observable String ikon = 'alarm';
void onChangeRadioGroupHandler(dom.CustomEvent e) {
gender.sex = (e.target as PaperRadioButton).label;
switch(gender.sex)
{
case 'Male':
ikon = 'done';
break;
case 'Female':
ikon = 'cached';
break;
}
<div layout vertical center>
<div layout horizontal self-center>
<paper-icon-button icon='{{ikon}}' on-click='{{toggle}}'></paper-icon-button>
</div>
</div>
<core-collapse id='core--collapse'>
<div layout vertical'>
<label id='genderLbl'></label>
<paper-radio-group id='gender-group' on-change='{{onChangeRadioGroupHandler}}'>
<paper-radio-button name='Male' label='Male'></paper-radio-button><br>
<paper-radio-button name='Female' label='Female'></paper-radio-button>
</paper-radio-group>
</div>
</core-collapse>
</div>