dart-polymer

breaking out of a switch within a foreach loop closure

萝らか妹 提交于 2021-01-28 14:30:21
问题 I have the following code void onSelectionChangedFiredSources( Event event, var detail, SelectCheckboxMenuComponent target) { // getItemModels returns a list of objects getItemModels( target.selectedItems ) ..forEach( (item) { switch( item.label ) { case 'Ear': toggleDialog( 'paper-dialog-transition-center', $['ear-side-dialog']); break; case 'Eye': toggleDialog( 'paper-dialog-transition-center', $['eye-side-dialog']); break; case 'Nostril': toggleDialog( 'paper-dialog-transition-center', $[

Programmatically create special Polymer-Element

泄露秘密 提交于 2020-02-02 07:14:05
问题 I have got a polymer-element with following html: <polymer-element name="tab-bar"> <template> <button>Hello</button> <template repeat="{{item in items}}"> <div>This element is {{ item }}</div> </template> </template> <script type="application/dart" src="tab_bar.dart"></script> </polymer-element> The underlying dart class looks as follows: import 'package:polymer/polymer.dart'; @CustomTag('tab-bar') class TabBar extends PolymerElement { List items; TabBar(List<String> items) { this.items =

Polymer + Dart2js Not Working

不想你离开。 提交于 2020-01-24 12:04:56
问题 When I create a new application using the Polymer library, it generates a sample project. The project works just fine in Dartium, but when I compile it (using pub build ), it doesn't work anymore. I get two 404's and an uncaught typeerror. Here is my console output in Chrome. GET file:///home/michael/Code/sample/build/web/packages/shadow_dom/shadow_dom.debug.js sample.html:1 GET file:///home/michael/Code/sample/build/web/packages/custom_element/custom-elements.debug.js sample.html:2 Uncaught

How to access shadow dow with jquery in a polymer.dart component

被刻印的时光 ゝ 提交于 2020-01-23 20:01:37
问题 In my polymer.dart component I want to access the shadow dom with jquery. In dart I can access f.e. an node´s id like this: $["testname"].attributes["id"] or shadowRoot.querySelector("#testname").attributes["id"] How is this done with jquery context.callMethod(r'$', ['#testname'])["id"] does not work obviously. 回答1: If you want to access shadow DOM from Dart using jquery, you can do this: String selector; JsObject jqueryObject = context.callMethod('\$', ['body /deep/ ${selector}']); Then you

How to access shadow dow with jquery in a polymer.dart component

旧街凉风 提交于 2020-01-23 20:00:05
问题 In my polymer.dart component I want to access the shadow dom with jquery. In dart I can access f.e. an node´s id like this: $["testname"].attributes["id"] or shadowRoot.querySelector("#testname").attributes["id"] How is this done with jquery context.callMethod(r'$', ['#testname'])["id"] does not work obviously. 回答1: If you want to access shadow DOM from Dart using jquery, you can do this: String selector; JsObject jqueryObject = context.callMethod('\$', ['body /deep/ ${selector}']); Then you

How to add attributes to a dynamically created component

大城市里の小女人 提交于 2020-01-23 17:50:25
问题 I would like to add a published attribute to a dynamically created component. The code for the component is shown below: <!DOCTYPE html> <link rel="import" href="name-form.html"> <link rel="import" href="../../shared/red-asterisk.html"> <polymer-element name='name-view'> <template> <div id='name-view' class='flex-row-container view'> <section id='row0' class='flex-row' > <button id='add-name-btn' class='button add-button' on-click='{{addName}}' autofocus>Add Name</button> <red-asterisk></red

polymer 1.0 - how to change font size programmatically?

假装没事ソ 提交于 2020-01-16 01:11:22
问题 I am using <paper-header-panel> with <paper-tabs> in a <paper-toolbar> . My app has two buttons for the user to increase and decrease font size. I do this: int originalSizePC=100; @Listen ("handleBigger") handleBigger(var event, var x) { originalSizePC=(originalSizePC*1.1).round(); document.body.style.fontSize=originalSizePC.toString()+'%'; } which works fine, except it doesn't affect the <paper-tabs> . I guess I need to do something like: PaperTabs pt=document.querySelector('#primaryTabs');

import polymer core-scaffold breaks google maps

两盒软妹~` 提交于 2020-01-15 12:57:25
问题 I have some working dart polymer code that shows a google map with some markers on it. It took me a while to get those to show up, as it seems the initialization routines are a bit wonky and it's as if sometimes there is not enough time to load the map div before it tries to render. Anyway, as I said I got that working. Now I wanted to put a core-scaffold around it, as they do on many demos. The minute I add this line... <link rel="import" href="packages/core_elements/core_scaffold.html"> ..