resizeable_dialog.html
<link rel="import" href="../../packages/polymer/polymer.html">
<link rel="import" href="../../packages/paper_elements/paper_dialog.html">
<link rel="import" href="../../packages/paper_elements/paper_button.html">
<link rel="import" href="../../packages/paper_elements/paper_tabs.html">
<link rel="import" href="../../packages/paper_elements/paper_tab.html">
<link rel="import" href="../../packages/paper_elements/paper_icon_button.html">
<link rel="import" href="../../packages/core_elements/core_toolbar.html">
<link rel="import" href="../../packages/core_elements/core_pages.html">
<polymer-element name="resizeable-dialog">
<template>
<style>
:host {
display: block;
}
</style>
<paper-button on-click="{{open}}">Open Dialog</paper-button>
<paper-dialog id="dialog" transition="core-transition-bottom" backdrop>
<paper-tabs selected="{{selected}}">
<paper-tab>Page 1</paper-tab>
<paper-tab>Page 2</paper-tab>
</paper-tabs>
<section>
<core-pages selected="{{selected}}">
<div style="width: 100px; height: 100px;">
<div>Page 1: 100x100</div>
<paper-button on-click="{{notifyResize}}">Call 'notifyResize'</paper-button>
</div>
<div style="width: 400px; height: 400px;">
<div>Page 2: 400x400</div>
<paper-button on-click="{{notifyResize}}">Call 'notifyResize'</paper-button>
</div>
</core-pages>
</section>
</paper-dialog>
</template>
<script type="application/dart" src="resizeable_dialog.dart"></script>
</polymer-element>
resizeable_dialog.dart
library resizable_dialog;
import 'package:polymer/polymer.dart';
import 'package:paper_elements/paper_dialog.dart';
@CustomTag('resizeable-dialog')
class ResizeableDialog extends PolymerElement {
ResizeableDialog.created() : super.created();
@observable int selected = 0;
notifyResize() {
$['dialog'] as PaperDialog..notifyResize();
print('"notifyResize" called.');
}
open() {
$['dialog'] as PaperDialog..open();
}
}
这是我的对话,我觉得你得到使用TabBar的想法。 我的问题是, <paper-dialog>
在某些点计算其尺寸被上映之前。 但是,由于我<core-pages>
可以有不同的宽度和高度,我必须调整每当用户选择一个选项卡以确保该对话框中,当前选择的页的全部内容是可见的。
该方法<paper-dialog>.notifyResize()
中不达特某种原因存在。 它规定在这里 ,中paper-elements
文档,但我不能调用它,因为它不DART中。
我怎样才能做到这一点? 我怎么能要求的对话框重新测量它的尺寸?