|
@@ -52,6 +52,9 @@ class _FWhiteBoardState extends State<FWhiteBoard> {
|
|
|
/// 当前用户的画笔
|
|
|
WhiteBoardPen myPen = WhiteBoardPen();
|
|
|
|
|
|
+ /// 其他人的画笔
|
|
|
+ WhiteBoardPen otherPen = WhiteBoardPen();
|
|
|
+
|
|
|
/// 当前用户的画笔颜色
|
|
|
Color get myPenColor => widget.patientColor;
|
|
|
|
|
@@ -87,20 +90,31 @@ class _FWhiteBoardState extends State<FWhiteBoard> {
|
|
|
return MouseRegion(
|
|
|
cursor: SystemMouseCursors.click,
|
|
|
child: GestureDetector(
|
|
|
- onPanDown: _onPanDown,
|
|
|
- onPanUpdate: _onPanUpdate,
|
|
|
- onPanEnd: _onPanEnd,
|
|
|
- onPanCancel: _onPanCancel,
|
|
|
- onDoubleTap: myPen.clear,
|
|
|
- child: CustomPaint(
|
|
|
- size: MediaQuery.of(context).size,
|
|
|
- painter: WhiteBoardPainter(
|
|
|
- pen: myPen,
|
|
|
- width: canvasWidth,
|
|
|
- height: canvasHeight,
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
+ onPanDown: _onPanDown,
|
|
|
+ onPanUpdate: _onPanUpdate,
|
|
|
+ onPanEnd: _onPanEnd,
|
|
|
+ onPanCancel: _onPanCancel,
|
|
|
+ onDoubleTap: myPen.clear,
|
|
|
+ child: Stack(
|
|
|
+ children: [
|
|
|
+ CustomPaint(
|
|
|
+ size: MediaQuery.of(context).size,
|
|
|
+ painter: WhiteBoardPainter(
|
|
|
+ pen: myPen,
|
|
|
+ width: canvasWidth,
|
|
|
+ height: canvasHeight,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ CustomPaint(
|
|
|
+ size: MediaQuery.of(context).size,
|
|
|
+ painter: WhiteBoardPainter(
|
|
|
+ pen: otherPen,
|
|
|
+ width: canvasWidth,
|
|
|
+ height: canvasHeight,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ )),
|
|
|
);
|
|
|
}
|
|
|
|
|
@@ -175,15 +189,15 @@ class _FWhiteBoardState extends State<FWhiteBoard> {
|
|
|
userId: data["u_Id"],
|
|
|
);
|
|
|
|
|
|
- myPen.pushLine(line);
|
|
|
+ otherPen.pushLine(line);
|
|
|
|
|
|
for (int i = 0; i < pointsList.length; i++) {
|
|
|
- myPen.pushPoint(Point.fromList(
|
|
|
+ otherPen.pushPoint(Point.fromList(
|
|
|
pointsList[i],
|
|
|
));
|
|
|
await Future.delayed(const Duration(milliseconds: 2));
|
|
|
}
|
|
|
- myPen.doneLine();
|
|
|
+ otherPen.doneLine();
|
|
|
_asyncDrawLock = false;
|
|
|
|
|
|
/// 判断如果队列存在数据,继续绘制
|
|
@@ -197,19 +211,19 @@ class _FWhiteBoardState extends State<FWhiteBoard> {
|
|
|
var data = jsonDecode(jsonData);
|
|
|
List<dynamic> pointsList = PointsUtil.decompressPointsList(data["points"]);
|
|
|
Line line = Line(
|
|
|
- color: ColorUtil.generateColor(data["u_Id"]),
|
|
|
+ color: Color(int.parse(data["color"])),
|
|
|
strokeWidth: strokeWidth,
|
|
|
userId: data["u_Id"],
|
|
|
);
|
|
|
|
|
|
- myPen.pushLine(line);
|
|
|
+ otherPen.pushLine(line);
|
|
|
|
|
|
for (int i = 0; i < pointsList.length; i++) {
|
|
|
- myPen.pushPoint(Point.fromList(
|
|
|
+ otherPen.pushPoint(Point.fromList(
|
|
|
pointsList[i],
|
|
|
));
|
|
|
}
|
|
|
- myPen.doneLine();
|
|
|
+ otherPen.doneLine();
|
|
|
}
|
|
|
|
|
|
void _clearUserLines(String userId) {
|