-
Notifications
You must be signed in to change notification settings - Fork 73
Progress bar direction and invertion #86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| func (o ProgressBarOptions) Inverted(inverted bool) ProgressBarOpt { | ||
| return func(s *ProgressBar) { | ||
| s.inverted = inverted | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just noticed some other somewhat similar functions in the library that do not take an argument, e.g.
func (o DragAndDropOptions) DisableDrag() DragAndDropOpt {
return func(t *DragAndDrop) {
t.dragDisabled = true
}
}
Maybe this would be better if it were similar, i.e.
| func (o ProgressBarOptions) Inverted(inverted bool) ProgressBarOpt { | |
| return func(s *ProgressBar) { | |
| s.inverted = inverted | |
| } | |
| } | |
| func (o ProgressBarOptions) Invert() ProgressBarOpt { | |
| return func(s *ProgressBar) { | |
| s.inverted = true | |
| } | |
| } |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have examples of both in the codebase. I prefer the way you currently have it. There are times when its cleaner to pass a variable in rather than call the method or not.
8e9ae74 to
34b52b5
Compare
34b52b5 to
353e56c
Compare
mcarpenter622
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks great! I have one minor request. Could you update the progressbar example to show a vertical progressbar as well? and possibly add some comments to describe the two new functions.
| func (o ProgressBarOptions) Inverted(inverted bool) ProgressBarOpt { | ||
| return func(s *ProgressBar) { | ||
| s.inverted = inverted | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have examples of both in the codebase. I prefer the way you currently have it. There are times when its cleaner to pass a variable in rather than call the method or not.
353e56c to
8fa41d6
Compare
Done, both! For the example, feel free to suggest some simpler way to lace up the containers, as I had to add one to center the progress bars somewhat. Also I ended up changing most of the comments (my IDE keeps adding a space on the right of the comment start |
|
No worries about the comments formatting. Also the layering of containers is the proper way to handle layouts in this library. You did it right! =) |
|
Thank you for the PR. Nicely done!. I did make one minor tweak just for my own personal style choice: c4e3c27 |


This pull requests adds two features to the progress bar:
widget.ProgressBarOpts.Direction(widget.DirectionVertical), the default being horizontalwidget.ProgressBarOpts.Inverted(true), the default being obviously not invertedAs you can guess I had a need for a vertical progress bar filling from bottom to top 😄
I’m happy to add anything to the examples if deemed needed, or to try to come up with a
progressbar_test.gofile, even!