From 435d0390f398efedb540c90656783b750a08f2c5 Mon Sep 17 00:00:00 2001 From: Osho Klinsmann Date: Mon, 6 Jan 2020 06:52:45 +0100 Subject: [PATCH] fix balance spacing and transactions alignment --- fyne/pages/handler/overview.go | 10 +++++----- fyne/pages/handler/values/dimensions.go | 2 ++ fyne/pages/overview.go | 10 +++++----- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/fyne/pages/handler/overview.go b/fyne/pages/handler/overview.go index 65d01d296..a69a8cd71 100644 --- a/fyne/pages/handler/overview.go +++ b/fyne/pages/handler/overview.go @@ -372,11 +372,11 @@ func newTransactionRow(transactionType, amount, fee, direction, status, date str icon := canvas.NewImageFromResource(icons[transactionType]) icon.SetMinSize(fyne.NewSize(5, 20)) iconBox := widget.NewVBox(widgets.NewVSpacer(4), icon) - amountLabel := widget.NewLabel(amount) - feeLabel := widget.NewLabel(fee) - dateLabel := widget.NewLabel(date) - statusLabel := widget.NewLabel(status) - directionLabel := widget.NewLabel(direction) + amountLabel := widget.NewLabelWithStyle(amount, fyne.TextAlignTrailing, fyne.TextStyle{}) + feeLabel := widget.NewLabelWithStyle(fee, fyne.TextAlignCenter, fyne.TextStyle{}) + dateLabel := widget.NewLabelWithStyle(date, fyne.TextAlignCenter, fyne.TextStyle{}) + statusLabel := widget.NewLabelWithStyle(status, fyne.TextAlignCenter, fyne.TextStyle{}) + directionLabel := widget.NewLabelWithStyle(direction, fyne.TextAlignCenter, fyne.TextStyle{}) column := widget.NewHBox(iconBox, amountLabel, feeLabel, directionLabel, statusLabel, dateLabel) return column } diff --git a/fyne/pages/handler/values/dimensions.go b/fyne/pages/handler/values/dimensions.go index e3578f61b..322337d00 100644 --- a/fyne/pages/handler/values/dimensions.go +++ b/fyne/pages/handler/values/dimensions.go @@ -6,9 +6,11 @@ const ( TextSize10 = 10 TextSize12 = 12 + TextSize15 = 15 TextSize16 = 16 TextSize14 = 14 TextSize24 = 24 + TextSize25 = 25 TextSize20 = 20 TextSize32 = 32 ConfirmationButtonTextSize = 18 diff --git a/fyne/pages/overview.go b/fyne/pages/overview.go index 22a956a97..d7e3786f0 100644 --- a/fyne/pages/overview.go +++ b/fyne/pages/overview.go @@ -6,6 +6,7 @@ import ( "fyne.io/fyne/layout" "fyne.io/fyne/widget" "github.com/raedahgroup/dcrlibwallet" + "github.com/raedahgroup/godcr/fyne/layouts" "github.com/raedahgroup/godcr/fyne/pages/handler" "github.com/raedahgroup/godcr/fyne/pages/handler/values" "github.com/raedahgroup/godcr/fyne/widgets" @@ -72,7 +73,7 @@ func (ov *overview) recentTransactionBox() fyne.CanvasObject { table.NewTable(overviewHandler.TableHeader) overviewHandler.Table = table overviewHandler.UpdateTransactions(ov.multiWallet, handler.TransactionUpdate{}) - transactionsContainer := fyne.NewContainerWithLayout(layout.NewFixedGridLayout(fyne.NewSize(515, 200)), table.Container) + transactionsContainer := fyne.NewContainerWithLayout(layout.NewFixedGridLayout(fyne.NewSize(518, 200)), table.Container) overviewHandler.TransactionsContainer = transactionsContainer return widget.NewVBox( @@ -177,13 +178,12 @@ func title() fyne.CanvasObject { } func balance() fyne.CanvasObject { - dcrBalance := widgets.NewLargeText("0.00", color.Black) - dcrDecimals := widgets.NewSmallText("00000 DCR", color.Black) + dcrBalance := widgets.NewTextWithStyle("0.00", color.Black, fyne.TextStyle{}, fyne.TextAlignLeading, values.TextSize25) + dcrDecimals := widgets.NewTextWithStyle("00000 DCR", color.Black, fyne.TextStyle{}, fyne.TextAlignLeading, values.TextSize15) overviewHandler.Balance = make([]*canvas.Text, 2) overviewHandler.Balance[0] = dcrBalance overviewHandler.Balance[1] = dcrDecimals - decimalsBox := fyne.NewContainerWithLayout(layout.NewVBoxLayout(), widgets.NewVSpacer(6), dcrDecimals) - return widget.NewHBox(widgets.NewVSpacer(10), dcrBalance, decimalsBox) + return fyne.NewContainerWithLayout(layouts.NewHBox(0, true), dcrBalance, dcrDecimals) } func transactionRowHeader() *widget.Box {