绘制:
import 'package:jade/utils/JadeColors.dart';
import 'package:flutter/material.dart';
import 'dart:math' as math;
import 'package:flutter_screenutil/flutter_screenutil.dart';
class ArcProgressBar extends StatefulWidget{
const ArcProgressBar({
Key key}) : super(key: key);
State<StatefulWidget> createState() {
// TODO: implement createState
return _ArcProgressBar();
}
}
class _ArcProgressBar extends State<ArcProgressBar> with TickerProviderStateMixin{
AnimationController controller;
void initState() {
// TODO: implement initState
super.initState();
controller = AnimationController(duration:const Duration(seconds: 1),lowerBound:0,upperBound:60,vsync: this);
controller.addListener(() {
setState(() {
// print(controller.value);
});
});
controller.forward();
}
void dispose() {
// TODO: implement dispose
controller.dispose();
super.dispose();
}
Widget build(BuildContext context) {
// TODO: implement build
return CustomPaint(
painter: TestArcPainter(
bgColor: JadeColors.lightGrey,
sweepColor: Color(0xffFFC10F),
strokeWidth: 45.0,
progress: controller.value / 100