-
Notifications
You must be signed in to change notification settings - Fork 47
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
Improve tab implementation #88
Improve tab implementation #88
Conversation
* remove Button from TabItem struct * display empty tab when no label defined * bug fix on adaptive tab size for bottom and right positions
ui/decredmaterial/tabs.go
Outdated
t.Flex.Spacing = layout.SpaceBetween | ||
t.Flex.Layout(gtx, widgets...) | ||
for i := range t.btns { | ||
t.changed = false |
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.
This should be outside the for. I'm not sure why it worked before
ui/decredmaterial/tabs.go
Outdated
} | ||
|
||
widgets := t.contentTabPosition(gtx, body) | ||
t.Flex.Spacing = layout.SpaceBetween |
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.
Unexport the Flex
and set the spacing during the Tabs
creation
ui/decredmaterial/tabs.go
Outdated
// contentTabPosition depending on the specified tab position determines the order of the tab and | ||
// the page content. |
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.
Could you reword this?
ui/decredmaterial/tabs.go
Outdated
) | ||
} | ||
|
||
// Tabs lays out a Flexed(Size) List with Selected as the first element and Item as the rest. |
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.
Change this.
ui/decredmaterial/tabs.go
Outdated
// tabAlignment determines the alignment of the active tab indicator relative to the tab item | ||
// content. It is determined by the position of the tab. | ||
func indicatorDirection(tabPosition Position) layout.Direction { |
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.
Wrong comment.
ui/decredmaterial/tabs.go
Outdated
} | ||
} | ||
|
||
// indicator defines how the active tab indicator is drawn |
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.
Wrong comment.
50d8eca
to
8bee469
Compare
f4cfd0c
to
473fa76
Compare
473fa76
to
5e6a63a
Compare
5e6a63a
to
271a91a
Compare
// scrollButton lays out the right and left scroll buttons of the tab when Position is Horizontal. | ||
func (t *Tabs) scrollButton(gtx *layout.Context, right bool, button *widget.Button) layout.FlexChild { | ||
show := false | ||
icon := mustIcon(NewIcon(icons.NavigationChevronLeft)) |
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.
Decoding the icon should be done before the icon needs to be laid out and done only once.
// Position determines what side of the page the tab would be laid out | ||
type Position int | ||
|
||
// TabItem displays a single child of a tab. Label and Icon in TabItem are optional. |
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.
If both Label
and Icon
are optional, what does it display when neither is present.
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.
Just tab items with the minimum width of the active indicator is displayed.
* add active indicator * add alignment option with no icon * add decred icons as bytes * add tab to wallet pages * make tab width and height adaptive * display empty tab when no label defined * add separator line to vertical tab * add navigation arrows for horizontal tab * add radius as optional to button widget
Resolves
Issue #73
What's new
This PR improves the current tab implementation by
Relevant screenshots or logs