Closed imran-razak closed 5 years ago
Could you add a minimum sample code to reproduce the issue?
On Sat, Jan 26, 2019, 8:09 AM imran-razak <notifications@github.com wrote:
There is a problem when the percent is at 1.0. When the screen is loaded, it's fine. But then, after scrolling through the list and coming back it becomes like in the screenshot. [image: screenshot_20190126-150420 1] https://user-images.githubusercontent.com/32387676/51787555-4c395d80-217c-11e9-8fc9-a6e9e7fc3055.png For some reason it's not filling the circle.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/diegoveloper/flutter_percent_indicator/issues/14, or mute the thread https://github.com/notifications/unsubscribe-auth/AEq90ESUBCCeUqDBY9ZEbvoY410CbrdNks5vHFN8gaJpZM4aUKRw .
I know you wanted a sample only, but my layout is a bit complex, so I will try to explain it:
THIS IS THE CONTAINER THAT HAS ALL THE CONTENT OF THIS SCREEN
Container(
child: FutureBuilder<List<PlanCategory>>(
future: PlanCategoryAPI.planCategories(widget.beneficiary),
builder: (BuildContext context, AsyncSnapshot<List<PlanCategory>> snapshot){
switch (snapshot.connectionState) {
case ConnectionState.none:
case ConnectionState.active:
case ConnectionState.waiting:
return Text("Carregando...");
case ConnectionState.done:
if(snapshot.data.isNotEmpty){
snapshot.data.add(null);
return PlanCategoryList(widget.beneficiary, snapshot.data);
}else{
return FutureBuilder<List<PlanCoverage>>(
future: PlanCoverageAPI.planCoveragesWithoutCategory(widget.beneficiary),
builder: (BuildContext context, AsyncSnapshot<List<PlanCoverage>> snapshot){
switch (snapshot.connectionState) {
case ConnectionState.none:
case ConnectionState.active:
case ConnectionState.waiting:
case ConnectionState.done:
if(snapshot.data.isNotEmpty){
return PlanCoverageList(snapshot.data);
}else{
return Text("Sem Sumário");
}
}
},
);
}
}
},
)
)
PAY ATTENTION TO PlanCategoryList
THIS IS WHAT PlanCategoryList
RETURNS
return Container(
child: ListView.builder(
itemBuilder: (BuildContext context, int index){
return PlanCategoryListItem(beneficiary, planCategories[index]);
},
itemCount: planCategories.length,
)
);
INSIDE PlanCategoryListItem
I have a Column
with 2 Widgets and one of the things this Column
has is this PlanCoverageList
Container(
margin: EdgeInsets.only(top: 5.0, bottom: 5.0),
padding: EdgeInsets.only(left: 15.0, right: 15.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
categoryDataContainer(),
FutureBuilder<List<PlanCoverage>>(
future: PlanCoverageAPI.planCoveragesByCategory(beneficiary, planCategory.id.category.id.name),
builder: (BuildContext context, AsyncSnapshot<List<PlanCoverage>> snapshot){
switch (snapshot.connectionState) {
case ConnectionState.none:
case ConnectionState.active:
case ConnectionState.waiting:
return Text("Carregando...");
case ConnectionState.done:
if(snapshot.data.isNotEmpty){
return PlanCoverageList(snapshot.data);
}else{
return Container(
margin: EdgeInsets.only(bottom: 5.0),
child: Text("Sem Coberturas", style: Styles.T2)
);
}
}
},
)
],
),
);
INSIDE PlanCoverageList
THIS IS WHAT I RETURN
ListView.builder(
shrinkWrap: true,
physics: ScrollPhysics(),
itemBuilder: (BuildContext context, int index){
return PlanCoverageListItem(planCoverages[index]);
},
itemCount: planCoverages.length,
);
AND FINALLY INSIDE PlanCoverageListItem
THIS IS WHERE THE CircularPercentIndicator
IS
THIS IS THE CODE THAT RETURNS THE CircularPercentIndicator
Widget circularPercentIndicator(){
double totalInPercentage = 0.0;
if(planCoverage.limitValue > 0){
totalInPercentage = planCoverage.total/planCoverage.limitValue;
print("DATA-" + totalInPercentage.toString());
if(totalInPercentage > 1.0){
totalInPercentage = 1.0;
}
totalInPercentage.truncateToDouble();
}
String totalInPercentageText = (totalInPercentage * 100).toStringAsFixed(1) + "%";
return Container(
margin: EdgeInsets.only(bottom: 5.0),
child: Center(
child:
CircularPercentIndicator(
radius: 120.0,
lineWidth: 13.0,
percent: totalInPercentage,
center: new Text(
totalInPercentageText,
style: Styles.T7
),
footer: new Text(
planCoverage.total.toString(),
style: Styles.T7
),
circularStrokeCap: CircularStrokeCap.round,
progressColor: Color(MyColors.COLOR_ACCENT),
)
)
);
}
I closed it by accident
You can make a minimum sample code to reproduce the issue.
On Sat, Jan 26, 2019, 9:56 AM imran-razak <notifications@github.com wrote:
I closed it by accident
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/diegoveloper/flutter_percent_indicator/issues/14#issuecomment-457837460, or mute the thread https://github.com/notifications/unsubscribe-auth/AEq90JI20y9dpI4gYmQCgi7yEQ9iIzajks5vHGyHgaJpZM4aUKRw .
There is a problem when the percent is at 1.0. When the screen is loaded, it's fine. But then, after scrolling through the list and coming back it becomes like in the screenshot. For some reason it's not filling the circle.