flutter icon indicating copy to clipboard operation
flutter copied to clipboard

Update `Switch` to support Material 3

Open darrenaustin opened this issue 3 years ago • 9 comments

As part of the Material 3 specification there are updates to the Switch's visuals:

Screen Shot 2022-05-11 at 1 53 27 PM

We need to update the existing Switch class in the Flutter Material library to support this.

darrenaustin avatar May 11 '22 20:05 darrenaustin

This should require #81564

guidezpl avatar Jun 01 '22 10:06 guidezpl

Is there an update on this? A timeplan?

tmaihoff avatar Aug 13 '22 19:08 tmaihoff

Is there an update on this? A timeplan?

Hi! I'm working on it and will create a pr once it's ready. Thanks for asking!

QuncCccccc avatar Aug 15 '22 23:08 QuncCccccc

Is there an update on this? A timeplan?

Hi! I'm working on it and will create a pr once it's ready. Thanks for asking!

Is there any way that I can help with this?

mavyfaby avatar Aug 16 '22 01:08 mavyfaby

Great work @QuncCccccc! However, I noticed the layout (thumb size) and motion isn't quite to spec

Expected Actual
image image

Do you plan on addressing this in a separate PR?

guidezpl avatar Sep 12 '22 09:09 guidezpl

@guidezpl

  1. Will Flutter exactly repeat this behavior of the switch? unnamed (1)

  2. If we talk about this switch in Flutter, then when it reaches the middle, the circle begins to decrease in radius, and then returns to the radius, depending on where the switch goes. What about the difference regarding specification? Is Flutter trying to be different? image https://firebasestorage.googleapis.com/v0/b/design-spec/o/projects%2Fm3%2Fimages%2Fl1xillgu-00_Deck_Tap_Drag.mp4?alt=media&token=c7599d2c-0cbc-47b7-b58a-2a3f95e51c8c

MaxYablochkin avatar Sep 20 '22 23:09 MaxYablochkin

@guidezpl

  1. Will Flutter exactly repeat this behavior of the switch? unnamed (1)
  2. If we talk about this switch in Flutter, then when it reaches the middle, the circle begins to decrease in radius, and then returns to the radius, depending on where the switch goes. What about the difference regarding specification? Is Flutter trying to be different? image https://firebasestorage.googleapis.com/v0/b/design-spec/o/projects%2Fm3%2Fimages%2Fl1xillgu-00_Deck_Tap_Drag.mp4?alt=media&token=c7599d2c-0cbc-47b7-b58a-2a3f95e51c8c

Thanks for catching this! The decreasing radius in the middle comes from the implementation of Material 2, just raised an issue for this and will fix it soon. https://github.com/flutter/flutter/issues/112026

QuncCccccc avatar Sep 21 '22 02:09 QuncCccccc

@guidezpl

Flutter IMG_20220921_060215.jpg IMG_20220921_060138.jpg

Native Android IMG_20220921_060402.jpg IMG_20220921_060302.jpg

There are also a few visual inconsistencies, for example, when the switch is off and pressed at the same time, the switch does not repaint in dark gray, and the same applies to the on, pressed state, it does not repaint in the color of the shade, but remains just white. The switch does not animate smoothly when raised when held, and also, in my opinion, there is no accompanying InkRipple animation behind the switch.

MaxYablochkin avatar Sep 21 '22 03:09 MaxYablochkin

There is a difference between web on android and web on windows, and it is a little surprising where the second one shows the correct display of colors that I described above🤔.

MaxYablochkin avatar Sep 21 '22 09:09 MaxYablochkin

Is there a separate pull request for the additional changes?

mavyfaby avatar Sep 21 '22 10:09 mavyfaby

Is there a separate pull request for the additional changes?

Yes, I will raise a pr for these changes soon.

QuncCccccc avatar Sep 21 '22 16:09 QuncCccccc

great work!

Will it be released in version 3.5.0?

huage2580 avatar Oct 26 '22 02:10 huage2580

You need to check the beta that includes this commit, so I don't know. But it's very recent, so I would wait for an additional 2-4 months. I would bet the next next flutter stable.

bernaferrari avatar Oct 26 '22 12:10 bernaferrari

There is a sligh inconsistency in animation, if you drag the thumb halfway and then release the "pan" then instead of continuing animation from that drag position there is slight glitch which feels like the thumb starts animation from the start instead of the position where drag was release.

ArishSultan avatar Nov 03 '22 09:11 ArishSultan

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

github-actions[bot] avatar Nov 17 '22 10:11 github-actions[bot]