-
Notifications
You must be signed in to change notification settings - Fork 28.6k
Clarify MaterialButton usage and documentation #98693
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
Comments
If this is just planned to be removed eventually, see full linked comment above, just that would be a beneficial bit of guidance. |
From what I can tell, while there are no more uses of MaterialButton in the framework (after removing the deprecated buttons - Flat, Raised, and Outline), there are still a lot of customers that use it - a lot. A MaterialButton just basically creates a RawMaterialButton, but the big difference is the former supports inherited themes while the later does not. I think the mention of the old button should be removed from the docs, as well as the "this is obsolete" distinction to avoid confusion. Since this is still a heavily used widget, I think the docs should just focus on the use cases with theming in contrast to the Raw one - rather than how this widget used to be used. It affords folks a totally customizable - and theme-able - button, in contrast to the already configured Text, Elevated and Outlined buttons. |
Agreed, after removing the deprecated buttons, The As a reminder, Color getSplashColor(MaterialButton button) {
if (button.splashColor != null)
return button.splashColor!;
if (_splashColor != null && (button is RaisedButton || button is OutlineButton))
return _splashColor!;
if (_splashColor != null && button is FlatButton) {
switch (getTextTheme(button)) {
case ButtonTextTheme.normal:
case ButtonTextTheme.accent:
return _splashColor!;
case ButtonTextTheme.primary:
break;
}
}
return getTextColor(button).withOpacity(0.12);
} Where I think it's deprecation and removal is on the roadmap now too, mentioned at least in this comment #53378 (comment), but I did not see an issue issue on it yet. If it exists, it might be good to add to the In any case complete removal of the classes for the deprecated buttons cannot happen unless it is also in sync with needed changes to |
This is going to be deprecated, will sync with @TahaTesser's work first |
Had a sync with @TahaTesser, I am un-assigning myself from this currently to go focus on refactoring FAB (#99086) to remove dependencies there in order to make removing this class in the future possible. |
From @rydmike in #98537 (comment)
MaterialButton
Next comes the question of the fate of the
MaterialButton
the parent class for the buttons to be removed.It is also in the docs marked as obsolete but not deprecated.
flutter/packages/flutter/lib/src/material/material_button.dart
Line 22 in adafd66
Will it remain available or be removed? My conclusion is, it will stay, even if it does not correctly implement or enable users to create Material buttons, plus its children will be gone due to same reasons. Considering this, it seems a bit illogical for it to remain, but it would be difficult to remove without a number of other changes discussed further below.
My search did no reveal any other usages and mentions of
MaterialButton
than in its child buttons that will be removed, and inButtonThemeData
itself, in a large number of odd looking getters.The fact that
ButtonThemeData
, that needs to remain forButtonBar
andDropdownButton
, itself depends onMaterialButton
, also makes it impossible to remove the "obsolete"MaterialButton
parent of all the 3 buttons now being removed.In
Material
there is in theMaterialType
enum a doc comment toMaterialButton
in enum valuebutton
.flutter/packages/flutter/lib/src/material/material.dart
Line 35 in 8a6d0d6
So I checked for references to
MaterialType.button
, other than inMaterial
it is only used byRawMatererialButton
andButtonStyleButton
. maybe consider updating the above doc ref to them instead ofMaterialButton
.If the
MaterialButton
is considered and marked as obsolete in the docs, which imo is correct, thus maybe consider deprecating it and plan for changes need to be able to remove it.Similar to #98691,
obsolete
is not a term folks know what to do with. What does it mean when other parts of the framework still depend on it? Some guidance would be helpful to add. cc @HansMuller & @darrenaustinThe text was updated successfully, but these errors were encountered: