option_select_item.dart 634 B

1234567891011121314151617181920212223242526
  1. import 'package:json_annotation/json_annotation.dart';
  2. part 'option_select_item.g.dart';
  3. /// 选项选择实体类
  4. @JsonSerializable()
  5. class OptionSelectItem {
  6. // 名称,只用来渲染
  7. @JsonKey(name: 'name')
  8. String name;
  9. // 数据,用来提交给服务端的数据
  10. @JsonKey(name: 'value')
  11. String value;
  12. // 是否选中
  13. @JsonKey(name: 'selected')
  14. bool selected;
  15. OptionSelectItem(this.name, this.value, {this.selected = false});
  16. factory OptionSelectItem.fromJson(Map<String, dynamic> json) =>
  17. _$OptionSelectItemFromJson(json);
  18. Map<String, dynamic> toJson() => _$OptionSelectItemToJson(this);
  19. }