()
| 27 | func (lb *ListButton) WidgetValue() any { return &lb.Slice } |
| 28 | |
| 29 | func (lb *ListButton) Init() { |
| 30 | lb.Button.Init() |
| 31 | lb.SetType(ButtonTonal).SetIcon(icons.Edit) |
| 32 | lb.Updater(func() { |
| 33 | lb.SetText(labels.FriendlySliceLabel(reflect.ValueOf(lb.Slice))) |
| 34 | }) |
| 35 | InitValueButton(lb, true, func(d *Body) { |
| 36 | up := reflectx.Underlying(reflect.ValueOf(lb.Slice)) |
| 37 | if up.Type().Kind() != reflect.Array && reflectx.NonPointerType(reflectx.SliceElementType(lb.Slice)).Kind() == reflect.Struct { |
| 38 | tb := NewTable(d).SetSlice(lb.Slice) |
| 39 | tb.SetValueTitle(lb.ValueTitle).SetReadOnly(lb.IsReadOnly()) |
| 40 | d.AddAppBar(tb.MakeToolbar) |
| 41 | } else { |
| 42 | sv := NewList(d).SetSlice(lb.Slice) |
| 43 | sv.SetValueTitle(lb.ValueTitle).SetReadOnly(lb.IsReadOnly()) |
| 44 | d.AddAppBar(sv.MakeToolbar) |
| 45 | } |
| 46 | }) |
| 47 | } |
| 48 | |
| 49 | // FormButton represents a struct value with a button that opens a [Form]. |
| 50 | type FormButton struct { |
nothing calls this directly
no test coverage detected