February 2019
Intermediate to advanced
450 pages
11h 59m
English
To create the navigation bar in our design, a horizontal flow layout is the right tool for the job. We can use widget.Spacer to create the gaps between the buttons and the label and to ensure the filename is centered within the space available. A helper method, expandSpace(), is added to create a new spacer that will expand along the flow layout axis. We also define the previousImage() and nextImage() functions, which will execute when the buttons are pressed:
func previousImage() {}func nextImage() {}func expandSpace() node.Node { return widget.WithLayoutData(widget.NewSpace(), widget.FlowLayoutData{ExpandAlong: true, ExpandAcross: true, AlongWeight:1})}
With those functions defined, we can lay out the navigation bar. We define ...
Read now
Unlock full access