MarginView constructor with margin parameters
This commit is contained in:
parent
01dd57a665
commit
7a1a6503e8
@ -86,8 +86,7 @@ func TestFlowLayout(t *testing.T) {
|
||||
textView := views.NewTextView("hello world!")
|
||||
textView.SetStyle(tui.StyleDefault.Background(tcell.ColorRed).Foreground(tcell.ColorBlack))
|
||||
|
||||
marginView := views.NewMarginView(textView)
|
||||
marginView.SetMargin(3, 1, 1, 0)
|
||||
marginView := views.NewMarginView(textView, 3, 1, 1, 0)
|
||||
|
||||
//borderView := views.NewBorderView(textView)
|
||||
|
||||
|
@ -10,10 +10,10 @@ type MarginView struct {
|
||||
|
||||
var _ tui.Wrapper = &MarginView{}
|
||||
|
||||
func NewMarginView(view tui.View) *MarginView {
|
||||
func NewMarginView(view tui.View, top, right, bottom, left int) *MarginView {
|
||||
v := new(MarginView)
|
||||
v.SetView(view)
|
||||
v.SetMargin(0, 0, 0, 0)
|
||||
v.SetMargin(top, right, bottom, left)
|
||||
return v
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user