Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable scroll from ListWidget #261

Open
Diy2210 opened this issue Jul 10, 2020 · 5 comments
Open

Disable scroll from ListWidget #261

Diy2210 opened this issue Jul 10, 2020 · 5 comments
Labels
question Further information is requested

Comments

@Diy2210
Copy link

Diy2210 commented Jul 10, 2020

How disable scroll from ListWidget inside Scroll
Code:
scroll(
id = Ids.RootScroll,
size = AsParent,
child = linear(
id = Ids.RootLinearId,
size = WidthAsParentHeightWrapContent
) { ... }

Снимок экрана 2020-07-10 в 17 34 22

My ListWidget inside Constraint:
Снимок экрана 2020-07-10 в 17 34 03

I try change Size from List but scroll is enabled too.

Server Status Block:
Снимок экрана 2020-07-10 в 17 33 00
Снимок экрана 2020-07-10 в 17 32 40

@Dorofeev
Copy link
Contributor

I'm not sure that it is possible with ListWidget inside ScrollWidget.
But I think, you can rework screen and make it with just one big list, except of scroll with linear. It would be better solution for screen with dynamic data. And this will resolve problems with scroll inside scroll.

@Diy2210
Copy link
Author

Diy2210 commented Jul 13, 2020

I fixed it by changing the blocks in some places down!

@Diy2210
Copy link
Author

Diy2210 commented Jul 13, 2020

But I think this is bug, if container dont change size.

@kkalisz
Copy link

kkalisz commented Jul 13, 2020

Basically you should avoid nesting containers with scroll support.
https://developer.android.com/reference/android/widget/ScrollView

Never add a RecyclerView or ListView to a scroll view. Doing so results in poor user interface performance and a poor user experience.

For vertical scrolling, consider NestedScrollView instead of scroll view which offers greater user interface flexibility and support for the material design scrolling patterns.

Maybe you can consider adding NestedScrollView support.

@Alex009
Copy link
Member

Alex009 commented Jul 14, 2020

hi, @Diy2210

in your case you should not use ScrollWidget with child ListWidget. You can achive required result with ListWidget - just use multiple UnitItems.

this your screen:
screen

can be built from units like:

val headers = listOf(
    BasicItem(title = "System date".desc(), value = date.desc()),
    BasicItem(title = "Updates".desc(), value = "available 29".desc()),    
    HeaderItem(title = "Disk Usage".desc())
)
val disksUsage = disks.map { disk ->
    DiskUsageItem(name = disk.map { it.name.desc() }, available = disk.map { "${it.available} %".desc() }, space = disk.map { it.space }
}
val serverStatus = statuses.map { status ->
    ....
}
val softwareVersions = versions.map { version ->
    ....
}
viewModel.listUnits.value = headers
    .plus(DiskUsageHeaderItem()),
    .plus(disksUsage),
    .plus(HeaderItem(title = "Server status")),
    .plus(serverStatus),
    .plus(HeaderItem(title = "Software versions")),
    .plus(softwareVersions)

and in screen just observe in ListWidget - viewModel.listUnits

@Alex009 Alex009 added the question Further information is requested label Jul 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants