创建此函数时出现错误... b1.getLineTo1(p1)
和b2.getLineTo2(p2)
的第50行和第53行的错误...是Flutter,我想在两个或多个对象之间建立连线。
感谢前进
import 'package:flutter_test/flutter_test.dart';
enum Place { left, top, right, bottom }
class Bound {
double x;
double y;
Place place;
Bound({this.x, this.y, this.place});
List<Line> getLineTo1(Bound to) {
return [Line(b1: Bound(), p1: Point())];
}
List<Line> getLineTo2(Bound to) {
return [Line(b2: Bound(), p2: Point())];
}
}
class Point {
double x;
double y;
Point({this.x, this.y});
List<Line> checkPoint(Point space) {
return [Line(p1: Point(), p2: Point())];
}
}
class Line {
Bound b1;
Bound b2;
Point p1;
Point p2;
Line({this.b1, this.b2, this.p1, this.p2});
}
void main1() {
test("Left to Top", () {
Bound b1 = Bound(place: Place.left, x: 0, y: 0);
Bound b2 = Bound(place: Place.top, x: -20, y: 20);
Point p1 = Point(x: b2.x + 5, y: b1.y);
Point p2 = Point(x: b2.x, y: b1.y + 5);
double radius;
radius = 2 * 22 / 7 * 5 / 4;
List<Line> lines1 = b1.getLineTo1(p1);
expect(lines1?.length, 2);
List<Line> lines2 = b2.getLineTo2(p2);
expect(lines2?.length, 2);
List<Line> linesRadius = p1.checkPoint(p2);
expect(linesRadius?.length, radius);
});
}
答案 0 :(得分:0)
具有以下两个功能:
void DesignerWindow::updateScale(double _scale)
{
scale = static_cast<int>(_scale);
scaleLbl->setText(QString("%1%").arg(scale));
}
采用类型scaleLbl = new QLabel(this);
scaleLbl->setFrameStyle(QFrame::Sunken | QFrame::Panel);
scaleLbl->setMinimumWidth(50);
statusBar()->addPermanentWidget(scaleLbl);
的参数,但在代码中位于此处:
val listOfIds = List("a", "b")
val strings = listOfIds.mkString("[\"", "\",\"", "\"]")
val query = s"""{"query":{"filtered":{"query":{"match_all":{}},"filter":
{"terms":{"genres":${strings}}}}}"""
您要为其提供类型为 List<Line> getLineTo1(Bound to) {
return [Line(b1: Bound(), p1: Point())];
}
List<Line> getLineTo2(Bound to) {
return [Line(b2: Bound(), p2: Point())];
}
而不是Bound
的参数,因此请根据需要更改参数或参数。