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

Unified Diff: sky/sdk/lib/framework/components2/checkbox.dart

Issue 1177243002: Refactor fn2.dart, since it breached our 1000-line threshold. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 6 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/sdk/lib/framework/components2/button_base.dart ('k') | sky/sdk/lib/framework/components2/drawer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/framework/components2/checkbox.dart
diff --git a/sky/sdk/lib/framework/components2/checkbox.dart b/sky/sdk/lib/framework/components2/checkbox.dart
deleted file mode 100644
index 36fd278dbdbe9bfe133dc2d80b550616bc1a35c7..0000000000000000000000000000000000000000
--- a/sky/sdk/lib/framework/components2/checkbox.dart
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-import 'package:sky/framework/theme2/colors.dart' as colors;
-
-import 'dart:sky' as sky;
-import '../fn2.dart';
-import '../rendering/box.dart';
-import '../rendering/object.dart';
-import 'button_base.dart';
-
-typedef void ValueChanged(value);
-
-class Checkbox extends ButtonBase {
-
- Checkbox({ Object key, this.onChanged, this.checked }) : super(key: key);
-
- bool checked;
- ValueChanged onChanged;
-
- void syncFields(Checkbox source) {
- checked = source.checked;
- onChanged = source.onChanged;
- super.syncFields(source);
- }
-
- void _handleClick(sky.Event e) {
- onChanged(!checked);
- }
-
- UINode buildContent() {
- // TODO(jackson): This should change colors with the theme
- sky.Color color = highlight ? colors.Purple[500] : const sky.Color(0x8A000000);
- const double kEdgeSize = 20.0;
- const double kEdgeRadius = 1.0;
- return new EventListenerNode(
- new Container(
- margin: const EdgeDims.symmetric(horizontal: 5.0),
- width: kEdgeSize + 2.0,
- height: kEdgeSize + 2.0,
- child: new CustomPaint(
- callback: (sky.Canvas canvas, Size size) {
-
- sky.Paint paint = new sky.Paint()..color = color
- ..strokeWidth = 2.0;
-
- // Draw the outer rrect
- paint.setStyle(checked ? sky.PaintingStyle.strokeAndFill : sky.PaintingStyle.stroke);
- sky.Rect rect = new sky.Rect.fromLTRB(0.0, 0.0, kEdgeSize, kEdgeSize);
- sky.RRect rrect = new sky.RRect()..setRectXY(rect, kEdgeRadius, kEdgeRadius);
- canvas.drawRRect(rrect, paint);
-
- // Draw the inner check
- if (checked) {
- // TODO(jackson): Use the theme color
- paint.color = const sky.Color(0xFFFFFFFF);
- paint.setStyle(sky.PaintingStyle.stroke);
- sky.Path path = new sky.Path();
- path.moveTo(kEdgeSize * 0.2, kEdgeSize * 0.5);
- path.lineTo(kEdgeSize * 0.4, kEdgeSize * 0.7);
- path.lineTo(kEdgeSize * 0.8, kEdgeSize * 0.3);
- canvas.drawPath(path, paint);
- }
- }
- )
- ),
- onGestureTap: _handleClick
- );
- }
-
-}
« no previous file with comments | « sky/sdk/lib/framework/components2/button_base.dart ('k') | sky/sdk/lib/framework/components2/drawer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698