Skip to content

Commit

Permalink
fix layout for single wallet main page
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeBoy committed Dec 20, 2023
1 parent 4cb267f commit 5086421
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
8 changes: 4 additions & 4 deletions ui/page/root/receive_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func (pg *ReceivePage) Layout(gtx C) D {
}),
layout.Rigid(func(gtx C) D {
gtx.Constraints.Min.X = gtx.Constraints.Max.X
return layout.Center.Layout(gtx, func(gtx layout.Context) layout.Dimensions {
return layout.Center.Layout(gtx, func(gtx C) D {
return layout.Flex{Axis: layout.Vertical, Alignment: layout.Middle}.Layout(gtx,
layout.Rigid(func(gtx C) D {
txt := pg.Theme.Body2(values.String(values.StrMyAddress))
Expand Down Expand Up @@ -225,7 +225,7 @@ func (pg *ReceivePage) Layout(gtx C) D {

func (pg *ReceivePage) copyAndNewAddressLayout(gtx C) D {
gtx.Constraints.Min.X = gtx.Constraints.Max.X
return layout.Center.Layout(gtx, func(gtx layout.Context) layout.Dimensions {
return layout.Center.Layout(gtx, func(gtx C) D {
return layout.Flex{}.Layout(gtx,
layout.Rigid(func(gtx C) D {
return pg.buttonIconLayout(gtx, pg.Theme.Icons.CopyIcon, values.String(values.StrCopy), pg.copy)
Expand Down Expand Up @@ -278,7 +278,7 @@ func (pg *ReceivePage) pageBackdropLayout(gtx C) {
}

func (pg *ReceivePage) headerLayout(gtx C) D {
return layout.Flex{}.Layout(gtx,
return layout.Flex{Alignment: layout.Middle}.Layout(gtx,
layout.Rigid(func(gtx C) D {
lbl := pg.Theme.H6(values.String(values.StrReceive))
lbl.TextSize = values.TextSizeTransform(pg.IsMobileView(), values.TextSize20)
Expand All @@ -298,7 +298,7 @@ func (pg *ReceivePage) addressLayout(gtx C) D {
}
gtx.Constraints.Min.X = gtx.Constraints.Max.X
return border.Layout(gtx, func(gtx C) D {
return components.VerticalInset(values.MarginPadding12).Layout(gtx, func(gtx layout.Context) layout.Dimensions {
return components.VerticalInset(values.MarginPadding12).Layout(gtx, func(gtx C) D {
lbl := pg.Theme.Label(values.TextSizeTransform(pg.IsMobileView(), values.TextSize16), "")
if pg.currentAddress != "" && pg.selectedWallet.IsSynced() {
lbl.Text = pg.currentAddress
Expand Down
14 changes: 4 additions & 10 deletions ui/page/root/single_wallet_main_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,14 +396,6 @@ func (swmp *SingleWalletMasterPage) OnNavigatedFrom() {
// to be eventually drawn on screen.
// Part of the load.Page interface.
func (swmp *SingleWalletMasterPage) Layout(gtx C) D {
// TODO: mobile layout
// if swmp.Load.IsMobileView() {
// return swmp.layoutMobile(gtx)
// }
return swmp.layoutDesktop(gtx)
}

func (swmp *SingleWalletMasterPage) layoutDesktop(gtx C) D {
return layout.Stack{}.Layout(gtx,
layout.Expanded(func(gtx C) D {
alignment := layout.Middle
Expand All @@ -422,8 +414,10 @@ func (swmp *SingleWalletMasterPage) layoutDesktop(gtx C) D {
Top: values.MarginPadding24,
Bottom: values.MarginPadding16,
}.Layout(gtx, func(gtx C) D {
// design states the entire UI dimension should be 600px
gtx.Constraints.Max.X = gtx.Dp(values.MarginPadding600)
if !swmp.IsMobileView() {
// design states the entire UI dimension should be 600px
gtx.Constraints.Max.X = gtx.Dp(values.MarginPadding600)
}
return swmp.pageNavigationTab.Layout(gtx, func(gtx C) D {
if swmp.CurrentPage() == nil {
return D{}
Expand Down
2 changes: 1 addition & 1 deletion ui/window.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ type WriteClipboard struct {
func CreateWindow(mw *libwallet.AssetsManager, version string, buildDate time.Time) (*Window, error) {
appTitle := giouiApp.Title(values.String(values.StrAppName))
// appSize overwrites gioui's default app size of 'Size(800, 600)'
appSize := giouiApp.Size(values.AppWidth, values.AppHeight)
appSize := giouiApp.Size(values.MobileAppWidth, values.MobileAppHeight)
// appMinSize is the minimum size the app.
appMinSize := giouiApp.MinSize(values.MobileAppWidth, values.MobileAppHeight)
// Display network on the app title if its not on mainnet.
Expand Down

0 comments on commit 5086421

Please sign in to comment.