Skip to content

Commit

Permalink
make manual mixer page scrollable
Browse files Browse the repository at this point in the history
  • Loading branch information
dreacot committed Sep 30, 2024
1 parent 0567986 commit 3e397b6
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 37 deletions.
80 changes: 46 additions & 34 deletions ui/page/privacy/manual_mixer_setup_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package privacy

import (
"gioui.org/layout"
"gioui.org/widget"

"github.com/crypto-power/cryptopower/app"
"github.com/crypto-power/cryptopower/libwallet/assets/dcr"
Expand Down Expand Up @@ -32,6 +33,8 @@ type ManualMixerSetupPage struct {
toPrivacySetup cryptomaterial.Button
backIcon *cryptomaterial.Icon

pageContainer *widget.List

dcrWallet *dcr.Asset
}

Expand All @@ -41,6 +44,9 @@ func NewManualMixerSetupPage(l *load.Load, dcrWallet *dcr.Asset) *ManualMixerSet
GenericPageModal: app.NewGenericPageModal(ManualMixerSetupPageID),
toPrivacySetup: l.Theme.Button(values.String(values.StrSetUp)),
dcrWallet: dcrWallet,
pageContainer: &widget.List{
List: layout.List{Axis: layout.Vertical},
},
}
pg.backClickable = pg.Theme.NewClickable(true)
pg.backIcon = cryptomaterial.NewIcon(pg.Theme.Icons.NavigationArrowBack)
Expand Down Expand Up @@ -132,42 +138,48 @@ func (pg *ManualMixerSetupPage) Layout(gtx C) D {
layout.Rigid(pg.backButtonAndPageHeading),
// 24px/16px space (mobile/desktop)
layout.Rigid(func(gtx C) D {
if pg.IsMobileView() {
return layout.Spacer{Height: values.MarginPadding24}.Layout(gtx)
}
return layout.Spacer{Height: values.MarginPadding16}.Layout(gtx)
}),
// "Mixed account" label, 4px space, mixed account dropdown
layout.Rigid(func(gtx C) D {
return layout.Inset{Bottom: values.MarginPadding16}.Layout(gtx, func(gtx C) D {
return pg.mixedAccountSelector.Layout(gtx, values.String(values.StrMixedAccount))
return pg.Theme.List(pg.pageContainer).Layout(gtx, 1, func(gtx C, _ int) D {
return layout.Flex{Axis: layout.Vertical, Alignment: layout.Start}.Layout(gtx,
layout.Rigid(func(gtx C) D {
if pg.IsMobileView() {
return layout.Spacer{Height: values.MarginPadding24}.Layout(gtx)
}
return layout.Spacer{Height: values.MarginPadding16}.Layout(gtx)
}),
// "Mixed account" label, 4px space, mixed account dropdown
layout.Rigid(func(gtx C) D {
return layout.Inset{Bottom: values.MarginPadding16}.Layout(gtx, func(gtx C) D {
return pg.mixedAccountSelector.Layout(gtx, values.String(values.StrMixedAccount))
})
}),

// 16px/12px space (mobile/desktop)
layout.Rigid(func(gtx C) D {
if pg.IsMobileView() {
return layout.Spacer{Height: values.MarginPadding16}.Layout(gtx)
}
return layout.Spacer{Height: values.MarginPadding12}.Layout(gtx)
}),
// "Unmixed account" label, 4px space, unmixed account dropdown
layout.Rigid(func(gtx C) D {
return layout.Inset{Bottom: values.MarginPadding16}.Layout(gtx, func(gtx C) D {
return pg.unmixedAccountSelector.Layout(gtx, values.String(values.StrUnmixedAccount))
})
}),
// 24px space, then warning/caution text
layout.Rigid(layout.Spacer{Height: values.MarginPadding24}.Layout),
layout.Rigid(pg.cautionCard),
// 40px/60px space (mobile/desktop), then "Set up" button.
layout.Rigid(func(gtx C) D {
if pg.IsMobileView() {
return layout.Spacer{Height: values.MarginPadding40}.Layout(gtx)
}
return layout.Spacer{Height: values.MarginPadding60}.Layout(gtx)
}),
layout.Rigid(pg.toPrivacySetup.Layout),
)
})
}),

// 16px/12px space (mobile/desktop)
layout.Rigid(func(gtx C) D {
if pg.IsMobileView() {
return layout.Spacer{Height: values.MarginPadding16}.Layout(gtx)
}
return layout.Spacer{Height: values.MarginPadding12}.Layout(gtx)
}),
// "Unmixed account" label, 4px space, unmixed account dropdown
layout.Rigid(func(gtx C) D {
return layout.Inset{Bottom: values.MarginPadding16}.Layout(gtx, func(gtx C) D {
return pg.unmixedAccountSelector.Layout(gtx, values.String(values.StrUnmixedAccount))
})
}),
// 24px space, then warning/caution text
layout.Rigid(layout.Spacer{Height: values.MarginPadding24}.Layout),
layout.Rigid(pg.cautionCard),
// 40px/60px space (mobile/desktop), then "Set up" button.
layout.Rigid(func(gtx C) D {
if pg.IsMobileView() {
return layout.Spacer{Height: values.MarginPadding40}.Layout(gtx)
}
return layout.Spacer{Height: values.MarginPadding60}.Layout(gtx)
}),
layout.Rigid(pg.toPrivacySetup.Layout),
)
})
})
Expand Down
2 changes: 1 addition & 1 deletion ui/page/security/sign_message_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (pg *SignMessagePage) Layout(gtx C) D {
pg.ParentNavigator().CloseCurrentPage()
},
Body: func(gtx C) D {
return pg.Theme.List(pg.pageContainer).Layout(gtx, 1, func(gtx C, i int) D {
return pg.Theme.List(pg.pageContainer).Layout(gtx, 1, func(gtx C, _ int) D {
return pg.Theme.Card().Layout(gtx, func(gtx C) D {
return layout.UniformInset(values.MarginPadding15).Layout(gtx, func(gtx C) D {
return layout.Flex{Axis: layout.Vertical}.Layout(gtx,
Expand Down
2 changes: 1 addition & 1 deletion ui/page/security/validate_address.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (pg *ValidateAddressPage) Layout(gtx C) D {
pg.ParentNavigator().CloseCurrentPage()
},
Body: func(gtx C) D {
return pg.Theme.List(pg.pageContainer).Layout(gtx, 1, func(gtx C, i int) D {
return pg.Theme.List(pg.pageContainer).Layout(gtx, 1, func(gtx C, _ int) D {
return layout.Inset{Top: values.MarginPadding5}.Layout(gtx, func(gtx C) D {
return layout.Flex{Spacing: layout.SpaceBetween}.Layout(gtx,
layout.Rigid(pg.addressSection()),
Expand Down
2 changes: 1 addition & 1 deletion ui/page/security/verify_message_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (pg *VerifyMessagePage) Layout(gtx C) D {
pg.ParentNavigator().CloseCurrentPage()
},
Body: func(gtx C) D {
return pg.Theme.List(pg.pageContainer).Layout(gtx, 1, func(gtx C, i int) D {
return pg.Theme.List(pg.pageContainer).Layout(gtx, 1, func(gtx C, _ int) D {
return pg.Theme.Card().Layout(gtx, func(gtx C) D {
return layout.UniformInset(values.MarginPadding15).Layout(gtx, func(gtx C) D {
return layout.Flex{Axis: layout.Vertical}.Layout(gtx,
Expand Down

0 comments on commit 3e397b6

Please sign in to comment.