Skip to content

Conversation

@bleroux
Copy link
Contributor

@bleroux bleroux commented Dec 11, 2025

Description

This PR adds the FloatingActionButtonTheme subclass of InheritedTheme. Similarly to other theme classes.

This missing theme class was mentioned in flutter.dev/go/material-theme-system-updates:
"FloatingActionButtonThemeData is conformant but there’s no FloatingActionButtonTheme class. "

Related Issue

Fixes Missing FloatingActionButtonTheme

Tests

Adds 2 tests.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Dec 11, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces FloatingActionButtonTheme, an InheritedTheme that allows for theming FloatingActionButton widgets within a subtree. This is a standard pattern in Flutter and brings FloatingActionButton in line with other Material components that have their own theme widgets. The implementation correctly uses dependOnInheritedWidgetOfExactType and falls back to Theme.of(context).floatingActionButtonTheme. The documentation for FloatingActionButton and FloatingActionButtonThemeData has been updated to reflect this change. Two new tests have been added to verify the behavior of the new theme, ensuring that it overrides the app-level theme and that widget-level properties take precedence. The changes are well-implemented and follow existing conventions in the Flutter framework.

@bleroux bleroux force-pushed the Add_FloatingActioButtonTheme branch from 6541307 to d5be232 Compare December 11, 2025 15:30
@bleroux bleroux requested a review from QuncCccccc December 11, 2025 19:25
Copy link
Contributor

@QuncCccccc QuncCccccc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

const FloatingActionButtonTheme({super.key, this.data, required super.child});

/// The properties for descendant [FloatingActionButton] widgets.
final FloatingActionButtonThemeData? data;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any cases that data might be null? I'm thinking maybe we can just make the type be FloatingActionButtonThemeData.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh very good catch!
I used MaterialBannerTheme as an inspiration when writing this PR and I just realized that it is the only theme where data is nullable. Probably by mistake.


await tester.pumpWidget(
MaterialApp(
theme: ThemeData().copyWith(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
theme: ThemeData().copyWith(
theme: ThemeData(

@bleroux bleroux force-pushed the Add_FloatingActioButtonTheme branch 2 times, most recently from 91f3124 to c3b7c9b Compare December 17, 2025 11:14
@bleroux bleroux force-pushed the Add_FloatingActioButtonTheme branch from c3b7c9b to 2b321e0 Compare December 17, 2025 12:39
@bleroux bleroux added the autosubmit Merge PR when tree becomes green via auto submit App label Dec 17, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Dec 17, 2025
Merged via the queue into flutter:master with commit 57c3f8b Dec 17, 2025
71 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Dec 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 17, 2025
@bleroux bleroux deleted the Add_FloatingActioButtonTheme branch December 17, 2025 17:47
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 18, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 18, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing FloatingActionButtonTheme

2 participants