Repository navigation
Material 3 FloatingActionButton background/foreground docs are inconsistent #147368
Description
Steps to reproduce
The docs here state
If this property is null, then the
[FloatingActionButtonThemeData.backgroundColor] of
[ThemeData.floatingActionButtonTheme] is used. If that property is also
null, then the [Theme]'s [ColorScheme.secondary] color is used.
That is the case with M2 themes but with M3 Theme, it uses primaryContainer as can be seen in the code referenced.
It is just confusing figuring out why secondary is not what it should look like. Seems like a minor documentation fix, though even the website right now states the same, not sure where its code comes from.
Links referenced above:
- Doc https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/material/floating_action_button.dart#L282
- _M2Theme https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/material/floating_action_button.dart#L760
- _M3Theme https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/material/floating_action_button.dart#L813
Expected results
The expected color either should be secondary in M3 theme or docs should reflect it is primaryContainer
Actual results
In case of M3 theme, the color if not provided for property background turns out to be primaryContainer, not secondary as the documentation states.
Code sample
Not sure if this is required. The report itself should suffice
Screenshots or Video
No response
Logs
No response
Flutter Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.19.6, on macOS 14.4.1 23E224 darwin-arm64, locale en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
[✓] VS Code (version 1.88.1)
[✓] Connected device (4 available)
! Error: Browsing on the local area network for Ishaan’s iPad. Ensure the device is unlocked and attached with a cable or
associated with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources
• No issues found!
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone (PR merged)
Activity
[-]M3 FloatingActionButton default background color is primaryContainer, not secondary[/-][+]Material 3 `FloatingActionButton` background/foreground docs are inconsistent[/+]Fix `FloatingActionButton` docs for `background` and `foreground` pro…
github-actions commentedon May 10, 2024
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 -vand a minimal reproduction of the issue.