basic.SizedBox{Width:320,Height:180,Child:collection.List{ItemCount:10000,ItemExtent:36,ItemBuilder:func(iint)core.Widget{returnbasic.Padding{Insets:geom.Symmetric(theme.Space12,theme.Space8),Child:basic.Text{Content:"Row "+strconv.Itoa(i+1)+" of 10,000",}}},}}
A grid of tiles of any number that builds only the rows near the view. The width decides the columns, and a TableController holds the selection and the focus, which stay on the same items when they move given an ItemKey. The arrows move between tiles and Enter opens one.
A List whose items move by drag or with Ctrl+Shift and an arrow. It does not own the items: OnReorder asks for the move. A screen reader hears the new place.
basic.SizedBox{Width:300,Height:220,Child:collection.ReorderableList{ItemCount:len(todos),ItemExtent:44,Label:"To do",LabelOf:func(iint)string{returntodos[i]},// Move the item in your data, then build again.OnReorder:func(_,_int){},ItemBuilder:func(iint)core.Widget{returnbasic.Padding{Insets:geom.Symmetric(theme.Space12,0),Child:basic.Row{Cross:layout.CrossCenter,Children:[]core.Widget{basic.Expanded{Child:basic.Text{Content:todos[i]}},basic.Text{Content:"≡"},}}}},}}
A table with sorting, filters, range selection, cell editing and frozen columns. Cells show text, badges, dots, bars or check boxes. With RowKey the selection stays on the same rows when they are sorted or deleted. The header of the sorted column tells a screen reader its order. Rows that live elsewhere, as the lines of a file, come through RowCount and Row without a slice of them.
rows:=[]task{{"Design review","Aiko","Done",1},{"Release notes","Ben","In progress",0.6},{"Fix the build","Chiara","Blocked",0.2},{"Translate docs","Daichi","In progress",0.4},{"Plan the sprint","Aiko","Done",1},}tone:=func(ttask)collection.CellTone{switcht.status{case"Done":returncollection.CellToneSuccesscase"Blocked":returncollection.CellToneDanger}returncollection.CellToneAccent}returnbasic.SizedBox{Width:520,Height:220,Child:collection.Table[task]{Label:"Tasks",Rows:rows,Sort:collection.TableSort{Column:0,Order:collection.SortAscending},OnSort:func(collection.TableSort){},Columns:[]collection.TableColumn[task]{{Title:"Task",Width:160,Text:func(ttask)string{returnt.name},Sortable:true},{Title:"Owner",Width:100,Text:func(ttask)string{returnt.owner},Sortable:true},{Title:"Status",Width:120,Text:func(ttask)string{returnt.status},Kind:collection.CellBadge,Tone:tone},{Title:"Done",Width:120,Kind:collection.CellProgress,Value:func(ttask)float32{returnt.done}},},}}
typefitintreturnbasic.SizedBox{Width:340,Child:collection.PropertyGrid{Label:"Inspector",Categories:[]collection.PropertyCategory{{Name:"General",Properties:[]collection.Property{{Name:"Name",Description:"The name of the layer.",Editor:collection.PropertyText{Value:"Header",OnChange:func(string){}}},{Name:"Visible",Editor:collection.PropertyBool{Value:true,OnChange:func(bool){}}},{Name:"Fit",Editor:collection.PropertyChoice[fit]{Value:1,OnChange:func(fit){},Options:[]field.DropdownOption[fit]{{Value:0,Label:"Fill"},{Value:1,Label:"Contain"},}}},}},{Name:"Layout",Properties:[]collection.Property{{Name:"Width",Editor:collection.PropertyInt{Value:320,Max:4096,OnChange:func(int){}}},{Name:"Opacity",Editor:collection.PropertyNumber{Value:0.85,Max:1,OnChange:func(float64){}}},{Name:"Tint",Editor:collection.PropertyColor{Value:geom.Hex(0x2f5fd0),OnPress:func(){}}},}},{Name:"Advanced",Collapsed:true,Properties:[]collection.Property{{Name:"Cache",Editor:collection.PropertyBool{OnChange:func(bool){}}},}},}}}
basic.SizedBox{Width:420,Child:collection.Group{Title:"Playback",Children:[]core.Widget{collection.GroupRow{Label:"Shuffle",Child:control.Switch{Value:true,OnChange:func(bool){}}},collection.GroupRow{Label:"Repeat",Child:control.SegmentedControl{Options:[]string{"Off","All","One"},Selected:1,OnChange:func(int){},}},collection.GroupRow{Label:"Crossfade",Detail:"Seconds between songs",Child:control.NumberStepper{Value:4,Max:12,OnChange:func(int){},}},}}}