/
dex_splash_page.go
71 lines (67 loc) · 2.64 KB
/
dex_splash_page.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package dcrdex
import (
"gioui.org/font"
"gioui.org/layout"
"gioui.org/text"
"github.com/crypto-power/cryptopower/ui/cryptomaterial"
"github.com/crypto-power/cryptopower/ui/modal"
"github.com/crypto-power/cryptopower/ui/values"
)
func (pg *DEXPage) splashPage(gtx C) D {
return cryptomaterial.LinearLayout{
Orientation: layout.Vertical,
Width: cryptomaterial.MatchParent,
Height: cryptomaterial.WrapContent,
Background: pg.Theme.Color.Surface,
Direction: layout.Center,
Alignment: layout.Middle,
Border: cryptomaterial.Border{Radius: cryptomaterial.Radius(14)},
Padding: layout.Inset{Top: values.MarginPadding30, Bottom: values.MarginPadding30, Right: values.MarginPadding24, Left: values.MarginPadding24},
}.Layout(gtx,
layout.Rigid(func(gtx C) D {
return layout.Inset{Bottom: values.MarginPadding50}.Layout(gtx, func(gtx C) D {
return layout.Stack{Alignment: layout.NE}.Layout(gtx,
layout.Expanded(func(gtx C) D {
return layout.Flex{Axis: layout.Vertical, Alignment: layout.Middle}.Layout(gtx,
layout.Rigid(func(gtx C) D {
return layout.Inset{Top: values.MarginPadding24}.Layout(gtx, func(gtx C) D {
return pg.Theme.Icons.DcrDex.LayoutSize(gtx, values.MarginPadding100)
})
}),
layout.Rigid(func(gtx C) D {
pgTitle := pg.Theme.Label(values.TextSize24, values.String(values.StrWhatIsDex))
pgTitle.Font.Weight = font.SemiBold
return layout.Inset{Top: values.MarginPadding30, Bottom: values.MarginPadding16}.Layout(gtx, pgTitle.Layout)
}),
layout.Rigid(func(gtx C) D {
pgContent := pg.Theme.Label(values.TextSize16, values.String(values.StrDexContent))
pgContent.Alignment = text.Middle
return layout.Inset{Top: values.MarginPadding10}.Layout(gtx, pgContent.Layout)
}),
)
}),
layout.Stacked(pg.splashPageInfoButton.Layout),
)
})
}),
layout.Rigid(func(gtx C) D {
return layout.Inset{Right: values.MarginPadding15, Left: values.MarginPadding15}.Layout(gtx, func(gtx C) D {
if pg.dexIsLoading {
return layout.Center.Layout(gtx, func(gtx C) D {
gtx.Constraints.Max.X = gtx.Dp(values.MarginPadding20)
gtx.Constraints.Min.X = gtx.Constraints.Max.X
return pg.materialLoader.Layout(gtx)
})
}
return layout.Flex{}.Layout(gtx, layout.Flexed(1, pg.startTradingBtn.Layout))
})
}),
)
}
func (pg *DEXPage) showInfoModal() {
info := modal.NewCustomModal(pg.Load).
Title(values.String(values.StrDecentralized)).
Body(values.String(values.StrTradeSettingsMsg)).
SetPositiveButtonText(values.String(values.StrGotIt))
pg.ParentWindow().ShowModal(info)
}