compose-multiplatform icon indicating copy to clipboard operation
compose-multiplatform copied to clipboard

Small ripple glitch with material3 Switch on iOS and Desktop

Open alexzhirkevich opened this issue 1 year ago • 6 comments

Describe the bug material3 Switch ripple appears lower then needed when switch is toggled off

Affected platforms

  • iOS
  • Desktop

Versions

  • Kotlin version*: 1.8.20
  • Compose Multiplatform version*: 1.4.0

To Reproduce Display material3 Switch, toggle on, toggle off

https://user-images.githubusercontent.com/63979218/232333487-9487b0fb-1d20-4051-97a6-63fa05c60951.mov


Expected behavior Works well on Android:

https://user-images.githubusercontent.com/63979218/232333490-46d913e7-0975-4d31-9b33-1119f12e6580.mov

alexzhirkevich avatar Apr 16 '23 18:04 alexzhirkevich

Same bug appears on Desktop with material3 Switch

dima-avdeev-jb avatar Apr 19 '23 18:04 dima-avdeev-jb

We can fix it after merging with stable material3 in androidx repository

dima-avdeev-jb avatar Apr 20 '23 07:04 dima-avdeev-jb

UPD: issue still exists after merge with stable m3 :(

alexzhirkevich avatar Aug 01 '23 18:08 alexzhirkevich

Found the cause.

Indication animation breaks if size of the component it applied to changes during the animation. See this. If we set fixed size insted of dynamic thumbSizeDp variable the issue dissapear

alexzhirkevich avatar Aug 01 '23 19:08 alexzhirkevich

Same issue appears for wasmJs target with: CMP - v1.6.11 and Material3 - v1.2.1

https://github.com/JetBrains/compose-multiplatform/assets/115993681/3884fe9d-7c77-425c-af9f-c1e718896e3c

https://github.com/JetBrains/compose-multiplatform/assets/115993681/cd3a02d8-a124-46de-bdc9-315090f4cf80

vlohachov avatar Jun 19 '24 07:06 vlohachov

Found the cause.

Indication animation breaks if size of the component it applied to changes during the animation. See this. If we set fixed size insted of dynamic thumbSizeDp variable the issue dissapear

I believe it should be possible to use animateDpAsState so there is no glitch when size changes

vlohachov avatar Jun 19 '24 07:06 vlohachov

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

okushnikov avatar Jul 14 '24 14:07 okushnikov