Search code examples
flutterprogress-barlinear-regressionprogress-indicatorlinearprogressindicator

How to use Linear Indicator dynamic stock values


I want linear indicator for dynamic values how to use condition in stock details and color values

enter image description here


Solution

  • You can try this.

    double stockValue = 0.5; // update stock value 
    LinearProgressIndicator(
       backgroundColor: const Color(0xFFB4B4B4),
       valueColor: AlwaysStoppedAnimation<Color>(stockValue == 1?Colors.red:Colors.green),
       value: stockValue,
    ),