创建一个变量
int totalScreen= 14;
并创建一个计算当前进度的方法:
double calculateProgress() {
int currentScreen= 13;
return currentScreen/ totalScreen;
}
然后根据您的代码使用它,对于我的场景,我使用了
LinearProgressIndicator
并将我的方法传递给 value
字段。
LinearProgressIndicator(
value: calculateProgress(),
valueColor: const AlwaysStoppedAnimation<Color>(Majorella),
backgroundColor: Colors.grey.withOpacity(0.3),
),