图标未更改

时间:2015-07-11 02:05:24

标签: dart dart-polymer

我正在尝试在选择特定单选按钮时更改图标。

但是,即使交换机被触发,.dart代码中的switch语句也不会更改图标。

感谢您的帮助。

.dart

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;
  }

html的

  

<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>

0 个答案:

没有答案