diegoveloper / flutter_percent_indicator

Flutter percent indicator library
BSD 2-Clause "Simplified" License
691 stars 206 forks source link

Is there any way to create stroke / border in LinearPercentIndicator? #57

Closed IhwanID closed 4 years ago

IhwanID commented 4 years ago

Hi @diegoveloper . nice package, I really love it.

currently, I want to create LinearPercentIndicator like this:

Screen-Shot-2020-05-23-at-07-06-26.png

I try to implement that with this code:

Padding(
              padding: EdgeInsets.all(15.0),
              child: Container(
                decoration: BoxDecoration(
                    border: Border.all(color: Color(0xff317abb), width: 1),
                    borderRadius: BorderRadius.circular(15)),
                child: LinearPercentIndicator(
                  lineHeight: 15.0,
                  //percent: progress,
                  percent: 0.5,
                  linearStrokeCap: LinearStrokeCap.round,
                  backgroundColor: Colors.white,
                  progressColor: Colors.blue,
                ),
              ),
            ),

and this is what I get is like the border/stroke not aligned in the side:

Screen-Shot-2020-05-23-at-07-13-03.png

any suggestions how to handle it?

diegoveloper commented 4 years ago

Here you have :

Padding(
                padding: EdgeInsets.all(15.0),
                child: Container(
                  padding: const EdgeInsets.all(0.1),
                  decoration: BoxDecoration(
                    border: Border.all(color: Color(0xff317abb), width: 2),
                    borderRadius: BorderRadius.circular(15),
                    color: Color(0xff317ab),
                  ),
                  child: ClipRRect(
                    borderRadius: BorderRadius.circular(15),
                    child: LinearPercentIndicator(
                      lineHeight: 15.0,
                      //percent: progress,
                      percent: 0.5,
                      padding: EdgeInsets.zero,
                      linearStrokeCap: LinearStrokeCap.butt,
                      backgroundColor: Colors.white,
                      progressColor: Colors.blue,
                    ),
                  ),
                ),
              )
Screen Shot 2020-05-22 at 8 01 53 PM
IhwanID commented 4 years ago

Thanks man 👍