File list

As Shiny does not define a list widget, we will construct one using another vertical flow container. Each item within this list will be a custom cell widget that displays an icon on the left with the filename text left-aligned in the remaining space. First, we will update our makeList() function to add some dummy data. Each item is a new cell, created using makeCell() (which is defined later). The items are laid out as a list using widget.NewFlow() on the vertical axis:

func makeList(dir string) node.Node {   parent := makeCell(dir, nil)   cell1 := makeCell("Filename 1", loadImage("shiny-hall.jpg"))   cell2 := makeCell("Filename 2", loadImage("shiny-hall.jpg"))   cell3 := makeCell("Filename 3", loadImage("shiny-hall.jpg")) return widget.NewFlow(widget. ...

Get Hands-On GUI Application Development in Go now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.