Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
432 views
in Technique[技术] by (71.8m points)

flutter - How do I set the animation color of a LinearProgressIndicator?

The LinearProgressIndicator documentation helpfully displays the existence of a valueColor property and even mentions "To specify a constant color use: new AlwaysStoppedAnimation(color).", but if I try to set the color I get an error that LinearProgressIndicator has no instance setter for valueColor and the constructor for the class only accepts a key and a numerical value for the progress amount.

If I want a LinearProgressIndicator with a custom color do I need to create my own class? Is there really no way to specify this?

question from:https://stackoverflow.com/questions/41068599/how-do-i-set-the-animation-color-of-a-linearprogressindicator

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If you want to set a constant color you can use :

CircularProgressIndicator(
  valueColor: AlwaysStoppedAnimation<Color>(Colors.white),
)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...