-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Switching between light and dark modes in the material 3 sample on the web is super janky. I haven't looked at HTML, but it does happen in CanvasKit mode. Profiling the app I see way too much text layout. Theoretically, there shouldn't be any layout at all, since only colors are changing. So even the framework shouldn't be laying out text.
But let's allow the framework re-layout text for some reason. The second problem is that the web engine re-lays out text during the paint phase. I'm suspecting that something broke the heuristic that attempts to save memory by proactively deleting paragraphs and then restoring them on repaint.
This is not right. We should fix this.
Reproduction
git clone [email protected]:flutter/samples.gitcd samples/material_3_demoflutter run -d chrome --profile- Toggle the "Brightness" switch and observe janky transition
- Use Chrome DevTools' "Performance" tab to record a profile
- Observe a lot of text layout present in the profile (similar to the picture above)
Revisions
Flutter: 9a721c456d4a6418c60f2512cbb54ee420b9c69b
Samples: 3e9bb78aec619065bbb29cfb1d20a80026c63818
