Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1829)

Unified Diff: sky/framework/sky-radio.sky

Issue 951823002: Update Sky widgets to have more material design (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/framework/sky-input.sky ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/framework/sky-radio.sky
diff --git a/sky/framework/sky-radio.sky b/sky/framework/sky-radio.sky
index f85b3652f4f3d951a4031150363b257b7b1b547e..7aa84b7d3a29405033fccd54548e13fbf83b44be 100644
--- a/sky/framework/sky-radio.sky
+++ b/sky/framework/sky-radio.sky
@@ -3,31 +3,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-->
-<import src="sky-button.sky" />
<import src="sky-element.sky" />
+<import src="sky-icon.sky" />
-<sky-element attributes="selected:boolean, group:string, highlight:boolean">
+<sky-element attributes="selected:boolean, group:string">
<template>
<style>
:host {
display: inline-block;
-webkit-user-select: none;
- width: 14px;
- height: 14px;
- border-radius: 7px;
- border: 1px solid blue;
- margin: 0 5px;
- }
- dot {
- -webkit-user-select: none;
- width: 10px;
- height: 10px;
- border-radius: 5px;
- background-color: black;
- margin: 2px;
+ margin: 8px 16px;
}
</style>
- <dot />
+ <sky-icon size="18" />
</template>
<script>
import "dart:sky";
@@ -73,18 +61,21 @@ class _RadioGroupController {
}
}
+const String _kOnIcon = 'toggle/radio_button_on_black';
+const String _kOffIcon = 'toggle/radio_button_off_black';
+
@Tagname('sky-radio')
-class SkyRadio extends SkyButton {
+class SkyRadio extends SkyElement {
_RadioGroupController _controller;
- Element _dot;
+ SkyIcon _icon;
SkyRadio() {
addEventListener('click', _handleClick);
}
void shadowRootReady() {
- _dot = shadowRoot.querySelector('dot');
- _dot.style['display'] = selected ? 'block' : 'none';
+ _icon = shadowRoot.querySelector('sky-icon');
+ _icon.type = selected ? _kOnIcon : _kOffIcon;
}
void attached() {
@@ -100,8 +91,8 @@ class SkyRadio extends SkyButton {
}
void selectedChanged(bool oldValue, bool newValue) {
- if (_dot != null)
- _dot.style['display'] = newValue ? 'block' : 'none';
+ if (_icon != null)
+ _icon.type = newValue ? _kOnIcon : _kOffIcon;
if (newValue && _controller != null)
_controller.takeSelectionFromGroup(this);
}
« no previous file with comments | « sky/framework/sky-input.sky ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698