From 3e397b6019173f675e6d03cf02a57fd7a73a3fdc Mon Sep 17 00:00:00 2001 From: dreacot Date: Tue, 1 Oct 2024 00:31:31 +0100 Subject: [PATCH] make manual mixer page scrollable --- ui/page/privacy/manual_mixer_setup_page.go | 80 +++++++++++++--------- ui/page/security/sign_message_page.go | 2 +- ui/page/security/validate_address.go | 2 +- ui/page/security/verify_message_page.go | 2 +- 4 files changed, 49 insertions(+), 37 deletions(-) diff --git a/ui/page/privacy/manual_mixer_setup_page.go b/ui/page/privacy/manual_mixer_setup_page.go index 5801d4bd8..a8225e1fe 100644 --- a/ui/page/privacy/manual_mixer_setup_page.go +++ b/ui/page/privacy/manual_mixer_setup_page.go @@ -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" @@ -32,6 +33,8 @@ type ManualMixerSetupPage struct { toPrivacySetup cryptomaterial.Button backIcon *cryptomaterial.Icon + pageContainer *widget.List + dcrWallet *dcr.Asset } @@ -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) @@ -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), ) }) }) diff --git a/ui/page/security/sign_message_page.go b/ui/page/security/sign_message_page.go index a73d27204..a482712f1 100644 --- a/ui/page/security/sign_message_page.go +++ b/ui/page/security/sign_message_page.go @@ -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, diff --git a/ui/page/security/validate_address.go b/ui/page/security/validate_address.go index b481edb38..6ac2429be 100644 --- a/ui/page/security/validate_address.go +++ b/ui/page/security/validate_address.go @@ -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()), diff --git a/ui/page/security/verify_message_page.go b/ui/page/security/verify_message_page.go index 08f1e7223..0f94e2e3e 100644 --- a/ui/page/security/verify_message_page.go +++ b/ui/page/security/verify_message_page.go @@ -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,