Bug with `CircularPercentIndicator.animation`
FMorschel opened this issue · 0 comments
FMorschel commented
Hi, I found these errors with CircularPercentIndicator
when I have animation
set to true
.
First; when animating and having arcType: ArcType.HALF
, if I set percent
to 0, it gives an error.
Second; when not animating and having arcType: null
, the widgetIndicator
just vanishes. Also, it seems a bit odd that when you set arcType
it changes the default colours.
PS:
Third: sadly when I tested this arcType
with null
, also found an error with the positioning of the widgetIndicator
not considering startAngle
.
import 'package:flutter/material.dart';
import 'package:percent_indicator/percent_indicator.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Flexible(
child: FittedBox(
child: CircularPercentIndicator(
percent: 0.7,
startAngle: 270,
arcType: ArcType.HALF,
radius: 100,
lineWidth: 20,
animation: true,
circularStrokeCap: CircularStrokeCap.round,
progressColor: theme.colorScheme.primary,
widgetIndicator: const Center(
child: CircleAvatar(
radius: 12,
backgroundColor: Colors.white,
),
),
),
),
),
Flexible(
child: FittedBox(
child: CircularPercentIndicator(
percent: 0,
startAngle: 270,
arcType: ArcType.HALF,
radius: 100,
lineWidth: 20,
circularStrokeCap: CircularStrokeCap.round,
progressColor: theme.colorScheme.primary,
widgetIndicator: const Center(
child: CircleAvatar(
radius: 12,
backgroundColor: Colors.white,
),
),
),
),
),
Flexible(
child: FittedBox(
child: CircularPercentIndicator(
percent: 0,
startAngle: 270,
arcType: ArcType.HALF,
radius: 100,
lineWidth: 20,
animation: true,
circularStrokeCap: CircularStrokeCap.round,
progressColor: theme.colorScheme.primary,
widgetIndicator: const Center(
child: CircleAvatar(
radius: 12,
backgroundColor: Colors.white,
),
),
),
),
),
Flexible(
child: FittedBox(
child: CircularPercentIndicator(
percent: 0,
startAngle: 270,
radius: 100,
lineWidth: 20,
animation: true,
circularStrokeCap: CircularStrokeCap.round,
progressColor: theme.colorScheme.primary,
widgetIndicator: const Center(
child: CircleAvatar(
radius: 12,
backgroundColor: Colors.white,
),
),
),
),
),
Flexible(
child: FittedBox(
child: CircularPercentIndicator(
percent: 0.1,
startAngle: 270,
radius: 100,
lineWidth: 20,
animation: true,
circularStrokeCap: CircularStrokeCap.round,
progressColor: theme.colorScheme.primary,
widgetIndicator: const Center(
child: CircleAvatar(
radius: 12,
backgroundColor: Colors.white,
),
),
),
),
),
],
),
),
);
}
}