Используйте Path.arcTo
или, проще говоря, Canvas.arcTo
со стилем stroke
Paint
import 'dart:math';
import 'package:flutter/material.dart';
class _ArcPainter extends CustomPainter {
_ArcPainter();
@override
bool shouldRepaint(_ArcPainter oldDelegate) {
return true;
}
@override
void paint(Canvas canvas, Size size) {
Rect rect = Rect.fromLTWH(0.0, 0.0, size.width, size.height);
Path path = Path()..arcTo(rect, 0.0, -pi / 2, true);
canvas.drawPath(
path,
Paint()
..color = Colors.orange
..strokeWidth = 3.0
..style = PaintingStyle.stroke);
canvas.drawArc(
rect,
0.0,
pi / 2,
false,
Paint()
..color = Colors.teal
..strokeWidth = 3.0
..style = PaintingStyle.stroke);
}
}
class ArcWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new SizedBox(
width: 250.0,
height: 250.0,
child: new CustomPaint(
painter: new _ArcPainter(),
),
);
}
}
class SegmentDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: AppBar(title: const Text('Arcs etc')),
body: ArcWidget(),
);
}
}
void main() {
runApp(
MaterialApp(
home: SegmentDemo(),
),
);
}