Commit b1a17cb0 authored by Adam Barth's avatar Adam Barth

Fix remaining analyzer warnings

Constructor tear-offs aren't supported by the analyzer yet.
parent 7ea598d9
......@@ -77,11 +77,8 @@ class ExampleDragSource extends StatelessComponent {
Widget build(BuildContext context) {
double size = kDotSize;
DraggableConstructor<Color> constructor = new Draggable<Color>#;
if (heavy) {
if (heavy)
size *= kHeavyMultiplier;
constructor = new LongPressDraggable<Color>#;
}
Widget contents = new DefaultTextStyle(
style: Theme.of(context).text.body1.copyWith(textAlign: TextAlign.center),
......@@ -112,13 +109,23 @@ class ExampleDragSource extends StatelessComponent {
anchor = DragAnchor.child;
}
return constructor(
data: color,
child: contents,
feedback: feedback,
feedbackOffset: feedbackOffset,
dragAnchor: anchor
);
if (heavy) {
return new Draggable<Color>(
data: color,
child: contents,
feedback: feedback,
feedbackOffset: feedbackOffset,
dragAnchor: anchor
);
} else {
return new LongPressDraggable<Color>(
data: color,
child: contents,
feedback: feedback,
feedbackOffset: feedbackOffset,
dragAnchor: anchor
);
}
}
}
......
......@@ -19,15 +19,6 @@ typedef void DragTargetAccept<T>(T data);
typedef Widget DragTargetBuilder<T>(BuildContext context, List<T> candidateData, List<dynamic> rejectedData);
typedef void DragStartCallback(Point position, int pointer);
typedef DraggableBase<T> DraggableConstructor<T>({
Key key,
T data,
Widget child,
Widget feedback,
Offset feedbackOffset,
DragAnchor dragAnchor
});
enum DragAnchor {
/// Display the feedback anchored at the position of the original child. If
/// feedback is identical to the child, then this means the feedback will
......
// 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:test/test.dart';
import 'package:playfair/playfair.dart';
import 'test_painting_canvas.dart';
void main() {
test('test_chart', () {
ChartData data = new ChartData(
startX: 0.0,
startY: 0.0,
endX: 10.0,
endY: 1.0,
dataSet: [
const Point(0.0, 0.0),
const Point(2.0, 0.5),
const Point(5.0, 0.2),
const Point(10.0, 0.9),
]
);
StringBuffer buffer = new StringBuffer();
PaintingCanvas canvas = new TestPaintingCanvas(
new PictureRecorder(),
const Size(100.0, 100.0),
buffer.write
);
new ChartPainter(data).paint(canvas, new Rect.fromLTRB(0.0, 0.0, 100.0, 100.0));
// TODO(jackson): Update this to the correct value once Sky packages can test
// See https://github.com/domokit/sky_engine/issues/580
expect(buffer.toString(), equals(""));
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment