聚合物主题的动态选择

时间:2016-03-09 09:59:15

标签: dart polymer dart-polymer

我正在使用polymer style-modules来实现主题。为此,我将所有样式打包在dom-module中,如下所示:

<dom-module id='my-theme'>
 <template>
  <style>
    :root {
      --primary-text-color: yellow;

      ... more styles ..

    }

    ...

    paper-button.important {
      --paper-button-color: red;

      ... more styles ..

    }
  </style>
 </template>     
</dom-module>

还在.dart中导入了index.dart个包:

@HtmlImport("my-style.html")
library my_style.lib;

import 'package:web_components/web_components.dart' show HtmlImport;

然后在index.html中,我将以这种方式使用它:

<link type='import' href='packages/my-style.html'>
<style is='custom-style' include='my-theme'></style>

一切正常(上面的例子中不关心可能的拼写错误),即使我必须使用html导入导入模块,而不是通常使用包导入的dart方式来使其工作。

问题:这是使用固定主题。有没有办法动态切换主题?即做的事情:

<style is='custom-style' include='[[selectedTheme]]'></style>

0 个答案:

没有答案
相关问题