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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.