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

Material 3 #279

Open
yegor-pelykh opened this issue Oct 14, 2022 · 3 comments
Open

Material 3 #279

yegor-pelykh opened this issue Oct 14, 2022 · 3 comments

Comments

@yegor-pelykh
Copy link

Hi!
Is it possible to make this control look like Material 3 FAB if that "Material 3" mode is used in the application?

Just for information: The "Material 3" theme mode can be set using the useMaterial3 property of the ThemeData class when setting it as a theme in the MaterialApp widget.
example

In fact, I have already tried this "Material 3" mode in my app with a SpeedDial.
This control already looks pretty good when opened:
speed-dial example

But the main FAB button still looks wrong, which looks quite inappropriate.

Could you fix this button with some styling, please?

For reference, the documentation for Material 3 FAB:
https://m3.material.io/components/floating-action-button

@nvi9
Copy link

nvi9 commented Oct 17, 2022

You can specify the shape to override the currently default StadiumBorder, this way it looks similar to M3 FAB:

SpeedDial(
  shape: RoundedRectangleBorder(
    borderRadius: BorderRadius.circular(16),
  ),
  ...
)

@yegor-pelykh
Copy link
Author

Yes, I can specify this shape, but in fact, I am now noticed that this is not enough to match Material 3. Both in part of the main fab, and in part of speed-dial children.
Could you please do a full inspection of the controls to match Material 3?

For the reference:
https://m3.material.io/components/floating-action-button/specs
Section "Small FAB layout".

Specs

@nizioleque
Copy link

Hi,
after some tweaking I found the configuration that matches the M3 spec :)

Here is some example code

SpeedDial(
  shape: const RoundedRectangleBorder(
    borderRadius: BorderRadius.all(Radius.circular(16)),
  ),
  spacing: 16,
  childMargin: EdgeInsets.zero,
  childPadding: const EdgeInsets.all(8.0),
  children: [
    SpeedDialChild(
      shape: const RoundedRectangleBorder(
        borderRadius: BorderRadius.all(Radius.circular(12)),
      ),
    ),
    SpeedDialChild(
      shape: const RoundedRectangleBorder(
        borderRadius: BorderRadius.all(Radius.circular(12)),
      ),
    ),
  ]
)

and here is the result
image

and a comparison
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants