Arrow syntax for getters (#156483)
This egotistical PR aims to draw attention to a [style guideline](https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md#use--for-getters-and-callbacks-that-just-return-literals-or-switch-expressions) that I changed: > #### Use `=>` for getters and callbacks that just return literals or switch expressions <br> There was an opportunity for valuable discussion in #154753 about how this structure affects readability, but I shut it down pretty quick since there was a lot of other stuff going on there. Interested to hear thoughts from @Piinks and others.
This commit is contained in:
@@ -53,24 +53,20 @@ class _${blockName}DefaultsM3 extends FloatingActionButtonThemeData {
|
||||
@override Color? get hoverColor => ${componentColor("md.comp.fab.primary.hover.state-layer")};
|
||||
|
||||
@override
|
||||
ShapeBorder? get shape {
|
||||
return switch (type) {
|
||||
_FloatingActionButtonType.regular => ${shape("md.comp.fab.primary.container")},
|
||||
_FloatingActionButtonType.small => ${shape("md.comp.fab.primary.small.container")},
|
||||
_FloatingActionButtonType.large => ${shape("md.comp.fab.primary.large.container")},
|
||||
_FloatingActionButtonType.extended => ${shape("md.comp.extended-fab.primary.container")},
|
||||
};
|
||||
}
|
||||
ShapeBorder? get shape => switch (type) {
|
||||
_FloatingActionButtonType.regular => ${shape("md.comp.fab.primary.container")},
|
||||
_FloatingActionButtonType.small => ${shape("md.comp.fab.primary.small.container")},
|
||||
_FloatingActionButtonType.large => ${shape("md.comp.fab.primary.large.container")},
|
||||
_FloatingActionButtonType.extended => ${shape("md.comp.extended-fab.primary.container")},
|
||||
};
|
||||
|
||||
@override
|
||||
double? get iconSize {
|
||||
return switch (type) {
|
||||
_FloatingActionButtonType.regular => ${getToken("md.comp.fab.primary.icon.size")},
|
||||
_FloatingActionButtonType.small => ${getToken("md.comp.fab.primary.small.icon.size")},
|
||||
_FloatingActionButtonType.large => ${getToken("md.comp.fab.primary.large.icon.size")},
|
||||
_FloatingActionButtonType.extended => ${getToken("md.comp.extended-fab.primary.icon.size")},
|
||||
};
|
||||
}
|
||||
double? get iconSize => switch (type) {
|
||||
_FloatingActionButtonType.regular => ${getToken("md.comp.fab.primary.icon.size")},
|
||||
_FloatingActionButtonType.small => ${getToken("md.comp.fab.primary.small.icon.size")},
|
||||
_FloatingActionButtonType.large => ${getToken("md.comp.fab.primary.large.icon.size")},
|
||||
_FloatingActionButtonType.extended => ${getToken("md.comp.extended-fab.primary.icon.size")},
|
||||
};
|
||||
|
||||
@override EdgeInsetsGeometry? get extendedPadding => EdgeInsetsDirectional.only(start: hasChild && _isExtended ? 16.0 : 20.0, end: 20.0);
|
||||
@override TextStyle? get extendedTextStyle => ${textStyle("md.comp.extended-fab.primary.label-text")};
|
||||
|
||||
Reference in New Issue
Block a user