Im trying to create a map that remembers its values when the page is recalled. I declared it outside the function so it would remain the same but the map still initializes to the defauly=t values when the page is recalled. How can i get it to remeber its values?
var rememberExpand = make(map[int]bool{})
func (c *CollapsibleWithOption) Layout(gtx layout.Context, header, body func(C) D, more func(C), wallet_ID int) layout.Dimensions {
fmt.Println(rememberExpand)
for c.button.Clicked() {
c.isExpanded = !c.isExpanded
}
rememberExpand[wallet_ID] = c.isExpanded
fmt.Println(rememberExpand)
icon := c.collapsedIcon
if c.isExpanded {
icon = c.expandedIcon
}
)
})
}),
layout.Rigid(func(gtx C) D {
if rememberExpand[wallet_ID] {
return body(gtx)
}
return D{}
}),
)
})
}