This commit is contained in:
toly
2023-12-16 12:40:32 +08:00
parent ab2778a22b
commit 01fdf966c5
593 changed files with 8995 additions and 27753 deletions

45
assets/draw/p03/s01.dart Normal file
View File

@@ -0,0 +1,45 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
/// create by 张风捷特烈 on 2020-03-19
/// contact me by email 1981462002@qq.com
/// 说明: 纸
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) {
var paint = Paint()
..style = PaintingStyle.fill
..color = Colors.blue;
// 画布起点移到屏幕中心
canvas.translate(size.width / 2, size.height / 2);
canvas.drawCircle(Offset(0, 0), 50, paint);
canvas.drawLine(
Offset(20, 20),
Offset(50, 50),
paint
..color = Colors.red
..strokeWidth = 5
..strokeCap = StrokeCap.round
..style = PaintingStyle.stroke);
}
@override
bool shouldRepaint(CustomPainter oldDelegate) => false;
}