| 159 | } |
| 160 | |
| 161 | func (widget *Widget) buildProgressBar(percent string) *progress.Model { |
| 162 | pOpts := []progress.Option{ |
| 163 | progress.WithWidth(widget.calcBarWidth(percent)), |
| 164 | progress.WithoutPercentage(), |
| 165 | } |
| 166 | |
| 167 | if widget.settings.solid != "" { |
| 168 | pOpts = append(pOpts, progress.WithSolidFill(widget.settings.solid)) |
| 169 | } else { |
| 170 | pOpts = append(pOpts, progress.WithGradient( |
| 171 | widget.settings.gradientA, |
| 172 | widget.settings.gradientB, |
| 173 | )) |
| 174 | } |
| 175 | |
| 176 | pb := progress.New(pOpts...) |
| 177 | return &pb |
| 178 | } |
| 179 | |
| 180 | func (widget *Widget) calcPercent() { |
| 181 | if widget.maximum == 0 { |