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

Feature Request: Multiple overlapping percent strokes. #68

Open
vedantrathore opened this issue Jul 23, 2020 · 7 comments
Open

Feature Request: Multiple overlapping percent strokes. #68

vedantrathore opened this issue Jul 23, 2020 · 7 comments

Comments

@vedantrathore
Copy link

Hello @diegoveloper , Thanks for this amazing package. I was wondering if there is any support for multiple percent strokes, preferably overlapping. Something like this
image

If not, then I'd like to work on this feature and send out a PR. Just want to know your thoughts on how should we proceed in implementing this.

@diegoveloper
Copy link
Owner

diegoveloper commented Jul 23, 2020 via email

@Lorenzohidalgo
Copy link

@vedantrathore did you end up developing this feature? I'm currently searching for the same feature but for the LinearPercentIndicator...

@om-ha
Copy link

om-ha commented Sep 12, 2021

Hey @diegoveloper and @vedantrathore , is this feature supported?

@vedantrathore
Copy link
Author

Hey @Lorenzohidalgo and @om-ha Unfortunately I did not end up working on this as the design requirements for this feature changed and this was not needed anymore.

Feel free to pick this up if needed.

@om-ha
Copy link

om-ha commented Oct 21, 2021

Hey @vedantrathore and @diegoveloper

I just tested this, it's easily achievable with a Stack widget!

Enjoy:

import 'package:flutter/material.dart';
import 'package:percent_indicator/percent_indicator.dart';

class MultiLevelPercentIndicatorExample extends StatelessWidget {
  const MultiLevelPercentIndicatorExample({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.symmetric(horizontal: 20),
      child: Column(
        children: const [
          SizedBox(height: 36),
          _MultiLevelPercentIndicatorWidget(),
          Spacer(),
        ],
      ),
    );
  }
}

class _MultiLevelPercentIndicatorWidget extends StatelessWidget {
  const _MultiLevelPercentIndicatorWidget({
    Key? key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    // Background
    return Container(
      height: 8,
      padding: const EdgeInsets.all(2),
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(4.0),
        color: Colors.redAccent.shade100,
      ),
      child: Stack(
        children: [
          // low-intensity color (bottom)
          LinearPercentIndicator(
            padding: const EdgeInsets.symmetric(horizontal: 2), // for some reason we need to re-apply padding for horizontal
            percent: 0.8,
            backgroundColor: Colors.transparent,
            progressColor: Colors.redAccent.shade100,
          ),
          // high-intensity color (top)
          LinearPercentIndicator(
            padding: const EdgeInsets.symmetric(horizontal: 2), // for some reason we need to re-apply padding for horizontal
            percent: 0.4,
            backgroundColor: Colors.transparent,
            progressColor: Colors.redAccent.shade400,
          ),
        ],
      ),
    );
  }
}

@ghost
Copy link

ghost commented Nov 17, 2021

This Worked for me, but this only works if one has fixed amount of metrics

 Stack(
                      children: [
                        new CircularPercentIndicator(
                          radius: 130.0,
                          animation: true,
                          animationDuration: 1200,
                          lineWidth: 15.0,
                          percent: 0.60,
                          center: new Text(
                            "60 %",
                            style: new TextStyle(
                                fontWeight: FontWeight.bold, fontSize: 20.0),
                          ),
                          circularStrokeCap: CircularStrokeCap.round,
                          backgroundColor: Colors.orange,
                          progressColor: colorPrimary,
                        ),
                        new CircularPercentIndicator(
                          radius: 130.0,
                          animation: true,
                          animationDuration: 1200,
                          lineWidth: 15.0,
                          percent: 0.45,
                          center: new Text(
                 
           "60 %",
                            style: new TextStyle(
                                fontWeight: FontWeight.bold, fontSize: 20.0),
                          ),
                          circularStrokeCap: CircularStrokeCap.round,
                          backgroundColor: colorTransparent,
                          progressColor: colorRed,
                        ),
                      ],
                    ),

Screen Shot 2021-11-17 at 6 18 40 PM

@ymerdrengene
Copy link

Will this be picked up?

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

5 participants