2

I have 10 field on a form and I want have a status tracker similar to the image below..

Basically , I will pass the percent and the widget should be updated

So if 4 items are completed then it will be 40% complete,, Can you give me some hints on how to create this widget

enter image description here

user2570135
  • 2,669
  • 6
  • 50
  • 80

2 Answers2

0

I think this is somehow weird but may help!

you need a validator

You could make a function called checkProgress() and assign it to the onChanged of the textformfield:

void checkProgress() {
   if(textformfieldcontroller.isValid) {
      setstate(() {
         progressbar = progressbar + 10;
      });
   } else if (textformfieldcontroller.isNotValid) {
      setstate(() {});
   }
}

It may work, but if not the concept is using if statements with setstate.

Yazeed AlKhalaf
  • 313
  • 4
  • 14
0

You can use the library percent_indicator

 LinearPercentIndicator(animation: true,
 lineHeight: 15,
 animationDuration: 5000,
 percent: 0.4,
 backgroundColor: Colors.blue,
 progressColor: Colors.orange,
 center: Text(
  'Text',
  style: TextStyle(
  color: Theme.of(context).primaryColorDark,
  fontSize: 15,
  fontWeight: FontWeight.w500),
),
linearStrokeCap: LinearStrokeCap.roundAll,
),

the parameter "percent" shows the progress in the indicator

Nikolay
  • 603
  • 1
  • 6
  • 13