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

make unrounded caps steps same size as rounded caps #20

Closed
RickVM opened this issue Jan 14, 2021 · 3 comments · Fixed by #21
Closed

make unrounded caps steps same size as rounded caps #20

RickVM opened this issue Jan 14, 2021 · 3 comments · Fixed by #21
Labels
bug Something isn't working

Comments

@RickVM
Copy link

RickVM commented Jan 14, 2021

Hi again,

Rounded caps are of a bigger size than unrounded ones, it seems like the rounding is added on top of the regular step size.
image

Would you agree it is preferable that these are both the same length, and the rounding should start and end within the stepSize?

@RickVM
Copy link
Author

RickVM commented Jan 15, 2021

I have found another issue with using roundedcaps. When you apply roundedCap to every step, as in the inner cicle, a color will lose its opacity. Probably because these are partially drawn over the next step?

Screenshot_20210115-103039

Example code:

class ActiveMinutesProgressCircle extends StatelessWidget {
  final Widget child;
  final double stepSize;
  final currentStep = 42;
  final totalSteps = 100; // Percentage!

  ActiveMinutesProgressCircle({this.child, this.stepSize = 12.0});

  @override
  Widget build(BuildContext context) {
    return CircularStepProgressIndicator(
      customColor: (int i) {
        if(currentStep > (2*totalSteps) || (currentStep > totalSteps && (currentStep % totalSteps) > i)) {
          return kColors.darkGreyBlue;
        } else if (currentStep >= i) {
          return kColors.greyBlue;
        } else {
          return Colors.white.withOpacity(0.5); // Doesnt work, opacity lost with roundedcaps
          // return const Color(0xFFF9F0CA); // Does work (same color without opacity)
        }
      },
      roundedCap: (int i, bool isSelected) => true, // If we set to false, opacity will work. Furhtermore, if we partially select true/false the end cap doesnt round nicely
      totalSteps: 100,
      currentStep: currentStep,
      selectedStepSize: stepSize,
      unselectedStepSize: stepSize,
      padding: 0,
      child: child ?? SizedBox.shrink(),
    );
  }
}

@SandroMaglione
Copy link
Owner

Would you agree it is preferable that these are both the same length, and the rounding should start and end within the stepSize?

Yes, they should indeed be the same length. I will fix it 🔜

a color will lose its opacity

I am not sure why this happens. I will try to see what could be the problem 🤔

SandroMaglione added a commit that referenced this issue Jan 16, 2021
SandroMaglione added a commit that referenced this issue Jan 16, 2021
* fixes #20

* Update version to v0.2.6+9
@SandroMaglione SandroMaglione added the bug Something isn't working label Jan 16, 2021
@SandroMaglione
Copy link
Owner

@RickVM I fixed the issue of the rounded cap size, adding a removeRoundedCapExtraAngle option to make all the steps the same length.
Here an example with removeRoundedCapExtraAngle = true on the top and removeRoundedCapExtraAngle = false on the bottom.

Screenshot 2021-01-16 083430


I will take a look also at the opacity issue. Do you mind opening a separate issue for the opacity problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants