Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with CircularPercentIndicator.animation #193

Open
FMorschel opened this issue Mar 3, 2023 · 0 comments
Open

Bug with CircularPercentIndicator.animation #193

FMorschel opened this issue Mar 3, 2023 · 0 comments

Comments

@FMorschel
Copy link
Contributor

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.

Screenshot

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,
                    ),
                  ),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant