|
@@ -143,33 +143,38 @@ class _FWhiteBoardState extends State<FWhiteBoard> {
|
|
|
for (int i = 0; i < myPen.activeLine.points.length; i++) {
|
|
|
pointsList.add(myPen.activeLine.points[i].toList());
|
|
|
}
|
|
|
+ print(widget.patientColor.value.toString());
|
|
|
widget.sendData(jsonEncode({
|
|
|
"u_Id": widget.userId, // 用户id
|
|
|
"l_Id": "", // 线id
|
|
|
- "color": widget.patientColor.toString(), // 线的颜色
|
|
|
+ "color": widget.patientColor.value.toString(), // 线的颜色
|
|
|
"points": PointsUtil.compressPointsList(pointsList),
|
|
|
}));
|
|
|
}
|
|
|
|
|
|
- Color parseColor(String colorString) {
|
|
|
- if (colorString == null || !colorString.startsWith('Color(')) {
|
|
|
- return Colors.black54;
|
|
|
- }
|
|
|
- final String valueString = colorString.substring(6, colorString.length - 1);
|
|
|
- List<String> parts = valueString.split(',');
|
|
|
- if (parts.length != 4) {
|
|
|
- return Colors.black54;
|
|
|
- }
|
|
|
- try {
|
|
|
- int alpha = int.parse(parts[0]);
|
|
|
- int red = int.parse(parts[1]);
|
|
|
- int green = int.parse(parts[2]);
|
|
|
- int blue = int.parse(parts[3]);
|
|
|
- return Color.fromARGB(alpha, red, green, blue);
|
|
|
- } catch (e) {
|
|
|
- return Colors.black54;
|
|
|
- }
|
|
|
- }
|
|
|
+ // Color parseColor(String colorString) {
|
|
|
+ // if (colorString == null || !colorString.startsWith('Color(')) {
|
|
|
+ // print('第一处');
|
|
|
+ // return Colors.black54;
|
|
|
+ // }
|
|
|
+ // final String valueString = colorString.substring(6, colorString.length - 1);
|
|
|
+ // List<String> parts = valueString.split(',');
|
|
|
+ // if (parts.length != 4) {
|
|
|
+ // print('第二处');
|
|
|
+ // return Colors.black54;
|
|
|
+ // }
|
|
|
+ // try {
|
|
|
+ // int alpha = int.parse(parts[0]);
|
|
|
+ // int red = int.parse(parts[1]);
|
|
|
+ // int green = int.parse(parts[2]);
|
|
|
+ // int blue = int.parse(parts[3]);
|
|
|
+ // return Color.fromARGB(alpha, red, green, blue);
|
|
|
+ // } catch (e) {
|
|
|
+ // print(e);
|
|
|
+ // print('第三处');
|
|
|
+ // return Colors.black54;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
/// 接收绘制数据【如果存在数据正在绘制,其他的加入绘制队列,等待当前绘制完成继续绘制】
|
|
|
void _onReceiveDrawData(String jsonData) async {
|
|
@@ -181,7 +186,7 @@ class _FWhiteBoardState extends State<FWhiteBoard> {
|
|
|
var data = jsonDecode(jsonData);
|
|
|
List<dynamic> pointsList = PointsUtil.decompressPointsList(data["points"]);
|
|
|
Line line = Line(
|
|
|
- color: parseColor(data["color"]),
|
|
|
+ color: Color(int.parse(data["color"])),
|
|
|
strokeWidth: strokeWidth,
|
|
|
userId: data["u_Id"],
|
|
|
);
|