Skip to content

Commit

Permalink
fix dropdown and scroll issue
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeBoy committed Sep 7, 2024
1 parent 1341418 commit 0d95d17
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
1 change: 1 addition & 0 deletions ui/cryptomaterial/dropdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ func (d *DropDown) collapsedAndExpandedLayout(gtx C) D {
// expandedLayout computes dropdown layout when dropdown is opened.
func (d *DropDown) expandedLayout(gtx C) D {
m := op.Record(gtx.Ops)
gtx.Constraints.Max.Y = inf
d.layout(gtx, d.ExpandedLayoutInset, d.listItemLayout)
op.Defer(gtx.Ops, m.Stop())
return D{}
Expand Down
30 changes: 11 additions & 19 deletions ui/page/dcrdex/market.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func NewDEXMarketPage(l *load.Load, selectServer string) *DEXMarketPage {
openOrdersAndOrderHistoryContainer: &widget.List{List: layout.List{Axis: vertical, Alignment: layout.Middle}},
addServerBtn: th.NewClickable(false),
toggleBuyAndSellBtn: th.SegmentedControl(buyAndSellBtnStrings, cryptomaterial.SegmentTypeGroup),
orderTypesDropdown: th.NewCommonDropDown(orderTypes, nil, values.MarginPadding120, values.DEXOrderTypes, true),
orderTypesDropdown: th.NewCommonDropDown(orderTypes, nil, values.MarginPadding100, values.DEXOrderTypes, false),
priceEditor: newTextEditor(l.Theme, values.String(values.StrPrice), "", false),
switchLotsOrAmount: l.Theme.Switch(),
lotsOrAmountEditor: newTextEditor(l.Theme, values.String(values.StrLots), "", false),
Expand Down Expand Up @@ -540,10 +540,11 @@ func (pg *DEXMarketPage) Layout(gtx C) D {
return D{}
}

pageContent := []func(gtx C) D{
pg.priceAndVolumeDetail,
pg.orderFormAndOrderBook,
pg.openOrdersAndHistory,
pageContent := []layout.FlexChild{
layout.Rigid(pg.serverAndCurrencySelection),
layout.Rigid(pg.priceAndVolumeDetail),
layout.Rigid(pg.orderFormAndOrderBook),
layout.Rigid(pg.openOrdersAndHistory),
}

return cryptomaterial.LinearLayout{
Expand All @@ -557,17 +558,7 @@ func (pg *DEXMarketPage) Layout(gtx C) D {
Direction: layout.Center,
}.Layout2(gtx, func(gtx C) D {
return pg.Theme.List(pg.scrollContainer).Layout(gtx, 1, func(gtx C, _ int) D {
return layout.Stack{}.Layout(gtx,
layout.Expanded(func(gtx C) D {
return layout.Inset{Top: 110}.Layout(gtx, func(gtx C) D {
l := &layout.List{Axis: vertical}
return l.Layout(gtx, len(pageContent), func(gtx C, i int) D {
return pageContent[i](gtx)
})
})
}),
layout.Stacked(pg.serverAndCurrencySelection),
)
return layout.Flex{Axis: layout.Vertical}.Layout(gtx, pageContent...)
})
})
}
Expand All @@ -576,6 +567,7 @@ func (pg *DEXMarketPage) serverAndCurrencySelection(gtx C) D {
return cryptomaterial.LinearLayout{
Width: cryptomaterial.MatchParent,
Height: gtx.Dp(100),
Margin: layout.Inset{Top: dp5, Bottom: dp5},
Background: pg.Theme.Color.Surface,
Padding: layout.UniformInset(dp16),
Border: cryptomaterial.Border{
Expand Down Expand Up @@ -929,8 +921,8 @@ func (pg *DEXMarketPage) orderForm(gtx C) D {
return pg.toggleBuyAndSellBtn.GroupTileLayout(gtx)
}),
layout.Flexed(1, func(gtx C) D {
pg.orderTypesDropdown.Background = &pg.Theme.Color.Surface
return layout.Inset{Bottom: dp5, Top: dp5}.Layout(gtx, pg.orderTypesDropdown.Layout)
layout.E.Layout(gtx, func(gtx C) D {

Check failure on line 924 in ui/page/dcrdex/market.go

View workflow job for this annotation

GitHub Actions / Build

expected 1 expression (typecheck)
return layout.Inset{Bottom: dp5, Top: dp5}.Layout(gtx, pg.orderTypesDropdown.Layout)
}),
)

Check failure on line 927 in ui/page/dcrdex/market.go

View workflow job for this annotation

GitHub Actions / Build

syntax error: unexpected ), expected expression

Check failure on line 927 in ui/page/dcrdex/market.go

View workflow job for this annotation

GitHub Actions / Build

expected operand, found ')' (typecheck)
}),
Expand Down Expand Up @@ -1236,7 +1228,7 @@ func (pg *DEXMarketPage) openOrdersAndHistory(gtx C) D {
Width: cryptomaterial.MatchParent,
Height: sectionHeight,
Background: pg.Theme.Color.Surface,
Margin: layout.Inset{Top: dp5, Bottom: 30},
Margin: layout.Inset{Top: dp5, Bottom: dp5},
Padding: layout.UniformInset(dp10),
Border: cryptomaterial.Border{
Radius: cryptomaterial.Radius(8),
Expand Down

0 comments on commit 0d95d17

Please sign in to comment.