Pager's pagerTabIndicatorOffset doesn't work with androidx.compose.material3
I'm trying to sync tabrow and HorizontalPager with Modifier.pagerTabIndicatorOffset.
It seems like it requires material 2 TabPosition. I'm using Material 3 library and I would like to use one material3 supplies. Could this be fixed, or is there any other way to circumvent this issue?
That is correct, accompanist would need to provide a material3-compatible version (it looks like it would also need to adjust some of the color handling to work with material3 too).
In the meantime, your best bet is probably to adapt the code you need to Material 3 yourself: https://github.com/google/accompanist/tree/main/pager-indicators/src/main/java/com/google/accompanist/pager
For anyone trying to get this to work with material3, simply create a new Modifier using the code from PagerTab.kt from the link above and use import androix.compose.material3.TabPosition instead of import androidx.compose.material.TabPosition.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
Why was this issue closed as completed? Was it really fixed or was just the bot that closed because nothing happened for 1 month? And, if the latter, does it really make sense to close issues that are stale for 1 month?
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
Please don't close it automatically.
Add support for this, please. You can't just make this api without full support for actually good-looking material3
For anyone trying to get this to work with
material3, simply create a new Modifier using the code fromPagerTab.ktfrom the link above and useimport androix.compose.material3.TabPositioninstead ofimport androidx.compose.material.TabPosition.
Bro it doesn't work
For anyone trying to get this to work with
material3, simply create a new Modifier using the code fromPagerTab.ktfrom the link above and useimport androix.compose.material3.TabPositioninstead ofimport androidx.compose.material.TabPosition.Bro it doesn't work
"Bro", it sure does work.
Make sure you're using the material3 version of Tab, TabRow and TabRowDefaults.Indicator.
I've just tested it again on latest versions of material3, pager and pager-indicators.
For anyone trying to get this to work with
material3, simply create a new Modifier using the code fromPagerTab.ktfrom the link above and useimport androix.compose.material3.TabPositioninstead ofimport androidx.compose.material.TabPosition.Bro it doesn't work
"Bro", it sure does work.
Make sure you're using the
material3version ofTab,TabRowandTabRowDefaults.Indicator.I've just tested it again on latest versions of
material3,pagerandpager-indicators.
Can you send me some example code? 🙂
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
Please don't close it automatically.
Please don't close it automatically.
Unfortunate that there's still not a material 3 version of pager. This is still broken.
For anyone trying to get this to work with
material3, simply create a new Modifier using the code fromPagerTab.ktfrom the link above and useimport androix.compose.material3.TabPositioninstead ofimport androidx.compose.material.TabPosition.
Can you send me some example code? 🙂
This worked as explained above. Here's a sample project using the latest Compose BOM (2022.12.00), Material3, and Accompanist (0.28.0): https://github.com/c5inco/Material3Pager
Unfortunate that there's still not a material 3 version of pager. This is still broken.
FWIW I don't think the Accompanist Pager is meant to be Material-specific. Given the new Pager (its successor available as experimental in 1.4.0) is in Compose Foundation, it's a clear signal this is the case.
The Pager Indicators do take a dependency on Material Tabs, but the APIs called in Material2 are identical in Material3, albeit some references to LocalContentColor and LocalContentAlpha which can easily be substituted for any other colors since they are just used as good defaults for tab colors. Additionally, what is being done in the library to synchronize with tabs can be relatively simple to adapt to other scrollable UIs in Compose.
That is all to say, yes you can get the Accompanist Pager Indicators to work with Material3 Tabs with a copy-paste-replace, and given the new Pager is upstream in Compose Foundation, its unlikely the team will make any further changes to Pager or Pager Indicators in Accompanist.
With that I think we can close this issue.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
Please don't close it automatically.
Please don't close it automatically.
Please don't close it automatically.
Can we have more info on why it was closed as completed?
Can we have more info on why it was closed as completed?
Because Accompanist's Pager is getting deprecated, Horizontal and Vertical pagers have been added to Compose Foundation and there is a material3 version of the .tabIndicatorOffset modifier which you can use in combination with the TabRow of compose.material3.
@leinardi what resolution are you expecting for this issue?
@c5inco closing the issue without a PR link to the M3 version or an explanation on how to migrate from the M2 to the M3 version wasn't what I was expecting.
Gotcha @leinardi . I believe I provided one approach on how to migrate in the previous comment: https://github.com/google/accompanist/issues/1076#issuecomment-1363805668
It's a little old now, but I don't think Material3 or the new Pager APIs have changed that significantly that it's no longer applicable.
And to my knowledge there are no plans for an M3 version as pager indicators aren't in the Material3 Design spec, which is the criteria for warranting inclusion in the Compose Material library.