Polymer 1.0 - 如何以编程方式设置图标位置

时间:2015-10-22 15:27:40

标签: dart dart-polymer

使用Polymer 1.0和Dart,我有:

  PaperButton paperButtonForget = new PaperButton();
  IronIcon iconClear = new IronIcon();
  paperButtonForget.innerHtml = "Forget";
  paperButtonForget.children.add(iconClear);
  paperButtonForget.raised=true;

按钮生成显示 “忘记X”

我有两个问题:

1)我怎样才能让它显示出来 “X FORGET” 如在 https://elements.polymer-project.org/elements/paper-button?view=demo:demo/index.html&active=paper-button

2)paperButtonForget.raised = true; “不起作用” - 但也许我需要做别的事情......?

欢呼声 史蒂夫

1 个答案:

答案 0 :(得分:1)

这样你就可以看到左边的图标,按钮显示为凸起:

import 'dart:html' as dom;
import 'package:polymer/polymer.dart';
import 'app_element.dart';
import 'package:polymer_elements/paper_button.dart';
import 'package:polymer_elements/iron_icon.dart';
import 'package:polymer_elements/communication_icons.dart';

/// [AppElement]
main() async {
  await initPolymer();
  PaperButton paperButtonForget = new PaperButton();
  IronIcon iconClear = new IronIcon()..icon = 'communication:email';
  paperButtonForget.append(iconClear);
  paperButtonForget.append(new dom.Text("Forget"));
  paperButtonForget.attributes['raised']='true';
  dom.document.body.append(paperButtonForget);
}