29 lines
606 B
Dart
29 lines
606 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
|
|
class Paper extends StatelessWidget {
|
|
const Paper({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
color: Colors.white,
|
|
child: CustomPaint( // 使用CustomPaint
|
|
painter: PaperPainter(),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class PaperPainter extends CustomPainter {
|
|
@override
|
|
void paint(Canvas canvas, Size size) {
|
|
// 创建画笔
|
|
final Paint paint = Paint();
|
|
// 绘制圆
|
|
canvas.drawCircle(Offset(100, 100), 10, paint);
|
|
}
|
|
|
|
@override
|
|
bool shouldRepaint(CustomPainter oldDelegate) => false;
|
|
} |