地区选择和罗盘十字
This commit is contained in:
35
lib/components/cross_paint.dart
Normal file
35
lib/components/cross_paint.dart
Normal file
@ -0,0 +1,35 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CrossPaint extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.transparent,
|
||||
alignment: Alignment.center,
|
||||
child: CustomPaint(
|
||||
// 使用CustomPaint 背景画板
|
||||
painter: MyPainter(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MyPainter extends CustomPainter {
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
// 创建画笔
|
||||
final Paint paintLine = Paint()
|
||||
..color = Colors.grey
|
||||
..strokeWidth = 2;
|
||||
// 绘制线
|
||||
canvas.drawLine(Offset(-400, 0), Offset(400, 0), paintLine);
|
||||
canvas.drawLine(Offset(0, 500), Offset(0, -440), paintLine);
|
||||
// 创建画笔
|
||||
// final Paint paintPoint = Paint()..color = Colors.red;
|
||||
// 绘制圆点
|
||||
// canvas.drawCircle(Offset(0, 0), 10, paintPoint);
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldRepaint(CustomPainter oldDelegate) => false;
|
||||
}
|
Reference in New Issue
Block a user