Skip to content

Conversation

@gspencergoog
Copy link
Contributor

@gspencergoog gspencergoog commented Oct 30, 2020

Description

This standardizes the dartdoc template macro names to roughly follow the convention:

flutter.library.Class.member[.optionalDescription]

Where there was no need for a description, I didn't add one.

Some (about 1/4) of the macros were already in this form, but standardizing the rest (which were in various forms) resulted in the following transforms:

flutter.animation.curves.catmull_rom_description => flutter.animation.CatmullRomSpline
flutter.cupertino.navBar.actionsForegroundColor => flutter.cupertino.CupertinoNavigationBar.actionsForegroundColor
flutter.cupertino.navBar.automaticallyImplyLeading => flutter.cupertino.CupertinoNavigationBar.automaticallyImplyLeading
flutter.cupertino.navBar.backgroundColor => flutter.cupertino.CupertinoNavigationBar.backgroundColor
flutter.cupertino.navBar.border => flutter.cupertino.CupertinoNavigationBar.border
flutter.cupertino.navBar.brightness => flutter.cupertino.CupertinoNavigationBar.brightness
flutter.cupertino.navBar.heroTag => flutter.cupertino.CupertinoNavigationBar.heroTag
flutter.cupertino.navBar.leading => flutter.cupertino.CupertinoNavigationBar.leading
flutter.cupertino.navBar.padding => flutter.cupertino.CupertinoNavigationBar.padding
flutter.cupertino.navBar.previousPageTitle => flutter.cupertino.CupertinoNavigationBar.previousPageTitle
flutter.cupertino.navBar.trailing => flutter.cupertino.CupertinoNavigationBar.trailing
flutter.cupertino.navBar.transitionBetweenRoutes => flutter.cupertino.CupertinoNavigationBar.transitionBetweenRoutes
flutter.cupertino.cupertinoRouteTransitionMixin.title => flutter.cupertino.CupertinoRouteTransitionMixin.title
flutter.cupertino.switch.dragStartBehavior => flutter.cupertino.CupertinoSwitch.dragStartBehavior
flutter.frame_rasterized_vs_presented => flutter.flutter_driver.WaitUntilFirstFrameRasterized
flutter.flutter_test.frame_policy => flutter.flutter_test.LiveTestWidgetsFlutterBindingFramePolicy
flutter.flutter_test.moreOrLessEquals.epsilon => flutter.flutter_test.moreOrLessEquals
flutter.flutter_test.drag => flutter.flutter_test.WidgetController.drag
flutter.flutter_test.fling => flutter.flutter_test.WidgetController.fling
flutter.flutter_test.timeddrag => flutter.flutter_test.WidgetController.timedDrag
flutter.foundation.bindingBase.registerServiceExtension => flutter.foundation.BindingBase.registerServiceExtension
flutter.gestures.gestureRecognizer.kind => flutter.gestures.GestureRecognizer.kind
flutter.material.dataTable.dataRowColorCode => flutter.material.DataTable.dataRowColor
flutter.material.dataTable.headingRowColorCode => flutter.material.DataTable.headingRowColor
flutter.material.drawer.dragStartBehavior => flutter.material.DrawerController.dragStartBehavior
flutter.widgets.inputDecorator.textAlignVertical => flutter.material.InputDecorator.textAlignVertical
flutter.material.ListTile.shape => flutter.material.ListTileTheme.shape
flutter.widgets.Clip => flutter.material.Material.clipBehavior
flutter.material.progressIndicator.parameters => flutter.material.ProgressIndicator.ProgressIndicator
flutter.material.rangeSlider.shape.argument.isDiscrete => flutter.material.RangeSliderThumbShape.getPreferredSize.isDiscrete
flutter.material.rangeSlider.shape.argument.isEnabled => flutter.material.RangeSliderThumbShape.getPreferredSize.isEnabled
flutter.material.rangeSlider.shape.argument.activationAnimation => flutter.material.RangeSliderThumbShape.paint.activationAnimation
flutter.material.rangeSlider.shape.argument.context => flutter.material.RangeSliderThumbShape.paint.context
flutter.material.rangeSlider.shape.argument.enableAnimation => flutter.material.RangeSliderThumbShape.paint.enableAnimation
flutter.material.rangeSlider.shape.argument.sliderTheme => flutter.material.RangeSliderThumbShape.paint.sliderTheme
flutter.material.rangeSlider.shape.argument.thumb => flutter.material.RangeSliderThumbShape.paint.thumb
flutter.material.rangeSlider.trackSegment => flutter.material.RangeSliderTickMarkShape.paint.trackSegment
flutter.material.rangeSlider.shape.argument.parentBox => flutter.material.RangeSliderValueIndicatorShape.paint.parentBox
flutter.material.button.mouseCursor => flutter.material.RawMaterialButton.mouseCursor
flutter.material.slider.shape.argument.center => flutter.material.SliderComponentShape.paint.center
flutter.material.slider.shape.argument.context => flutter.material.SliderComponentShape.paint.context
flutter.material.slider.shape.argument.enableAnimation => flutter.material.SliderComponentShape.paint.enableAnimation
flutter.material.slider.shape.argument.isDiscrete => flutter.material.SliderComponentShape.paint.isDiscrete
flutter.material.slider.shape.argument.parentBox => flutter.material.SliderComponentShape.paint.parentBox
flutter.material.slider.shape.argument.sizeWithOverflow => flutter.material.SliderComponentShape.paint.sizeWithOverflow
flutter.material.slider.shape.argument.sliderTheme => flutter.material.SliderComponentShape.paint.sliderTheme
flutter.material.slider.shape.argument.textScaleFactor => flutter.material.SliderComponentShape.paint.textScaleFactor
flutter.material.slider.seeAlso.rangeSliderThumbShape => flutter.material.SliderTheme.rangeSliderThumbShape
flutter.material.slider.seeAlso.rangeSliderTickMarkShape => flutter.material.SliderTheme.rangeSliderTickMarkShape
flutter.material.slider.seeAlso.rangeSliderTrackShape => flutter.material.SliderTheme.rangeSliderTrackShape
flutter.material.slider.seeAlso.rangeSliderValueIndicatorShape => flutter.material.SliderTheme.rangeSliderValueIndicatorShape
flutter.material.slider.seeAlso.sliderComponentShape => flutter.material.SliderTheme.sliderComponentShape
flutter.material.slider.seeAlso.sliderTickMarkShape => flutter.material.SliderTheme.sliderTickMarkShape
flutter.material.slider.seeAlso.sliderTrackShape => flutter.material.SliderTheme.sliderTrackShape
flutter.material.slider.shape.argument.isEnabled => flutter.material.SliderTickMarkShape.getPreferredSize.isEnabled
flutter.material.slider.trackSegment => flutter.material.SliderTrackShape.paint.trackSegment
flutter.painting.boxDecoration.clip => flutter.painting.BoxDecoration.clip
clip_with_box_fit => flutter.painting.BoxFit.cover
flutter.material.progressIndicator.semanticsLabel => flutter.progress_indicator.ProgressIndicator.semanticsLabel
flutter.material.progressIndicator.semanticsValue => flutter.progress_indicator.ProgressIndicator.semanticsValue
flutter.rendering.annotatedRegionLayer.restrictions => flutter.rendering.AnnotatedRegionLayer.restrictions
flutter.clipper.clipBehavior => flutter.rendering.ClipRectLayer.clipBehavior
flutter.leaderFollower.alwaysNeedsAddToScene => flutter.rendering.FollowerLayer.alwaysNeedsAddToScene
flutter.rendering.layer.findAnnotations.aboutAnnotations => flutter.rendering.Layer.findAnnotations.aboutAnnotations
flutter.rendering.object.needsCompositing => flutter.rendering.PaintingContext.pushClipRect.needsCompositing
flutter.rendering.object.pushClipLayer.offset => flutter.rendering.PaintingContext.pushClipRect.offset
flutter.rendering.object.oldLayer => flutter.rendering.PaintingContext.pushClipRect.oldLayer
flutter.rendering.object.pushLayer.offset => flutter.rendering.PaintingContext.pushLayer.offset
flutter.rendering.persistentHeader.showOnScreenConfiguration => flutter.rendering.PersistentHeaderShowOnScreenConfiguration
flutter.rendering.platformView.gestures => flutter.rendering.RenderAndroidView.gestures
flutter.rendering.platformView.layout => flutter.rendering.RenderAndroidView.layout
flutter.rendering.platformView.updateGestureRecognizers => flutter.rendering.RenderAndroidView.updateGestureRecognizers
flutter.rendering.editable.cursorOffset => flutter.rendering.RenderEditable.cursorOffset
flutter.rendering.editable.paintCursorOnTop => flutter.rendering.RenderEditable.paintCursorAboveText
flutter.rendering.editable.select => flutter.rendering.RenderEditable.selectPosition
flutter.rendering.followerLayer.anchor => flutter.rendering.RenderFollowerLayer.leaderAnchor
flutter.rendering.wheelList.diameterRatio => flutter.rendering.RenderListWheelViewport.diameterRatio
flutter.rendering.wheelList.itemExtent => flutter.rendering.RenderListWheelViewport.itemExtent
flutter.rendering.wheelList.magnification => flutter.rendering.RenderListWheelViewport.magnification
flutter.rendering.wheelList.offAxisFraction => flutter.rendering.RenderListWheelViewport.offAxisFraction
flutter.rendering.wheelList.overAndUnderCenterOpacity => flutter.rendering.RenderListWheelViewport.overAndUnderCenterOpacity
flutter.rendering.wheelList.perspective => flutter.rendering.RenderListWheelViewport.perspective
flutter.rendering.wheelList.renderChildrenOutsideViewport => flutter.rendering.RenderListWheelViewport.renderChildrenOutsideViewport
flutter.rendering.wheelList.squeeze => flutter.rendering.RenderListWheelViewport.squeeze
flutter.rendering.wheelList.useMagnifier => flutter.rendering.RenderListWheelViewport.useMagnifier
flutter.rendering.sliverPadding.limitation => flutter.rendering.RenderSliverEdgeInsetsPadding
flutter.rendering.platformView.preview => flutter.rendering.RenderUiKitView
flutter.rendering.viewport.cacheExtent => flutter.rendering.RenderViewportBase.cacheExtent
flutter.rendering.viewport.cacheExtentStyle => flutter.rendering.RenderViewportBase.cacheExtentStyle
flutter.services.autofill.autofillHints => flutter.services.AutofillConfiguration.autofillHints
flutter.services.autofill.AutofillScope => flutter.services.AutofillScope
flutter.services.glfwKeyHelper.modifiers => flutter.services.GLFWKeyHelper.modifierCapsLock
flutter.services.gtkKeyHelper.modifiers => flutter.services.GtkKeyHelper.modifierShift
flutter.services.rawKeyEventDataIOS.modifiers => flutter.services.RawKeyEventDataIos.modifierCapsLock
flutter.services.rawKeyEventDataMacOs.modifiers => flutter.services.RawKeyEventDataMacOs.modifierCapsLock
flutter.services.rawKeyEventDataWindows.modifiers => flutter.services.RawKeyEventDataWindows.modifierShift
flutter.services.restoration.bucketcreation => flutter.services.RestorationBucket.empty.bucketCreation
flutter.services.autofill.autofillContext => flutter.services.TextInput.finishAutofillContext
flutter.services.textInput.enableSuggestions => flutter.services.TextInputConfiguration.enableSuggestions
flutter.services.textInput.smartDashesType => flutter.services.TextInputConfiguration.smartDashesType
flutter.services.textInput.smartQuotesType => flutter.services.TextInputConfiguration.smartQuotesType
flutter.widgets.actions.multipleAdds => flutter.widgets.Action.addActionListener
flutter.widgets.platformViews.constructorParams => flutter.widgets.AndroidView.constructorArgs
flutter.widgets.platformViews.gestureRecognizersDescFoot => flutter.widgets.AndroidView.gestureRecognizers.descFoot
flutter.widgets.platformViews.gestureRecognizersDescHead => flutter.widgets.AndroidView.gestureRecognizers.descHead
flutter.widgets.platformViews.gestures => flutter.widgets.AndroidView.gestures
flutter.widgets.platformViews.hittestParam => flutter.widgets.AndroidView.hitTestBehavior
flutter.widgets.platformViews.layout => flutter.widgets.AndroidView.layout
flutter.widgets.platformViews.directionParam => flutter.widgets.AndroidView.layoutDirection
flutter.widgets.platformViews.lifetime => flutter.widgets.AndroidView.lifetime
flutter.widgets.platformViews.createdParam => flutter.widgets.AndroidView.onPlatformViewCreated
flutter.widgets.autofill.AutofillGroupState => flutter.widgets.AutofillGroupState
flutter.widgets.followerLayer.anchor => flutter.widgets.CompositedTransformFollower.targetAnchor
flutter.widgets.layoutBuilder.builderFunctionInvocation => flutter.widgets.ConstrainedLayoutBuilder
flutter.widgets.editableText.complexCharacters => flutter.widgets.EditableText.onChanged
flutter.widgets.reassemble => flutter.widgets.Element.reassemble
flutter.widgets.focus_manager.focus.keyEvents => flutter.widgets.FocusNode.keyEvents
flutter.widgets.focus_manager.focus.lifecycle => flutter.widgets.FocusNode.lifecycle
flutter.widgets.focusorder.comparable => flutter.widgets.FocusOrder.comparable
flutter.widgets.form.autovalidateMode => flutter.widgets.FormField.autovalidateMode
flutter.widgets.image.chainedBuildersExample => flutter.widgets.Image.frameBuilder.chainedBuildersExample
flutter.widgets.interactiveViewer.onInteraction => flutter.widgets.InteractiveViewer.onInteractionEnd
flutter.widgets.wheelList.childCount => flutter.widgets.ListWheelChildBuilderDelegate.childCount
flutter.widgets.widgetsApp.localeResolutionCallback => flutter.widgets.LocaleResolutionCallback
flutter.widgets.modalRoute.barrierColor => flutter.widgets.ModalRoute.barrierColor
flutter.widgets.modalRoute.barrierDismissible => flutter.widgets.ModalRoute.barrierDismissible
flutter.widgets.modalRoute.barrierLabel => flutter.widgets.ModalRoute.barrierLabel
flutter.widgets.modalRoute.maintainState => flutter.widgets.ModalRoute.maintainState
flutter.mouseRegion.triggerTime => flutter.widgets.MouseRegion.onEnter.triggerTime
flutter.widgets.navigator.pushNamed.arguments => flutter.widgets.Navigator.pushNamed
flutter.widgets.navigator.restorablePush.arguments => flutter.widgets.Navigator.restorablePush
flutter.widgets.navigator.restorablePushNamed.arguments => flutter.widgets.Navigator.restorablePushNamed.arguments
flutter.widgets.navigator.restorablePushNamed.returnValue => flutter.widgets.Navigator.restorablePushNamed.returnValue
flutter.widgets.pageRoute.fullscreenDialog => flutter.widgets.PageRoute.fullscreenDialog
flutter.widgets.pageView.allowImplicitScrolling => flutter.widgets.PageView.allowImplicitScrolling
flutter.widgets.child => flutter.widgets.ProxyWidget.child
flutter.widgets.slots => flutter.widgets.RenderObjectElement.insertRenderObjectChild
flutter.widgets.restoration.primitivevalue => flutter.widgets.RestorableNum
flutter.widgets.restoration.primitivevalue.constructor => flutter.widgets.RestorableNum.constructorArgs
flutter.widgets.restoration.scope => flutter.widgets.RestorationScope
flutter.widgets.scrollable.scroll_increment_type.intent => flutter.widgets.ScrollIncrementType.intent
flutter.widgets.sliverChildDelegate.lifecycle => flutter.widgets.SliverChildDelegate.lifecycle
flutter.widgets.sliverMultiBoxAdaptor.delegate => flutter.widgets.SliverMultiBoxAdaptorWidget.delegate
flutter.widgets.subscriptions => flutter.widgets.State.initState
flutter.widgets.textSelection.onSelectionHandleTapped => flutter.widgets.TextSelectionOverlay.onSelectionHandleTapped
FilterQuality => flutter.widgets.Texture.filterQuality
flutter.widgets.transitionRoute.opaque => flutter.widgets.TransitionRoute.opaque
flutter.widgets.transitionRoute.reverseTransitionDuration => flutter.widgets.TransitionRoute.reverseTransitionDuration
flutter.widgets.transitionRoute.transitionDuration => flutter.widgets.TransitionRoute.transitionDuration
flutter.widgets.implicit_animations.tweenVisitorArguments => flutter.widgets.TweenVisitor.arguments
widgets.inspector.trackCreation => flutter.widgets.WidgetInspectorService.getChildrenSummaryTree

I think flutter.widgets.child => flutter.widgets.ProxyWidget.child is kind of dubious, since it's a pretty core thing to Widget, and kind of a detail that it's defined in ProxyWidget, but at least you do know where the template resides if you wanted to change it, and makes it easy to find.

The slider and range slider changes also might be a step back, but they contain the same information, just in the more standard form.

[And, no, I didn't audit all of the templates by hand: I used a hacked version of dartdoc to print out the canonical names of the symbols each of the templates was attached to, and then (by hand) fixed up the ones that all mapped to the same one by adding their descriptions back in, and made a quick script to do the substitutions in place, verifying first that none of the new names already existed.]

Related Issues

Tests

  • This is a "docs only" only change, so no tests.

@flutter-dashboard flutter-dashboard bot added a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) a: internationalization Supporting other languages or locales. (aka i18n) a: tests "flutter test", flutter_test, or one of our tests f: cupertino flutter/packages/flutter/cupertino repository f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. c: contributor-productivity Team-specific productivity, code health, technical debt. work in progress; do not review labels Oct 30, 2020
@google-cla google-cla bot added the cla: yes label Oct 30, 2020
@gspencergoog gspencergoog force-pushed the standardize_macro_names branch 3 times, most recently from fdc7f25 to beabc7c Compare October 30, 2020 23:31
@gspencergoog gspencergoog requested a review from Hixie October 30, 2020 23:34
@gspencergoog gspencergoog marked this pull request as ready for review October 30, 2020 23:42
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@Hixie
Copy link
Contributor

Hixie commented Oct 30, 2020

Please make sure to update the style guide accordingly.
Since this can be mechanically tested, it might be worth doing so.

I share your dubiousness about things like "flutter.widgets.Clip => flutter.material.Material.clipBehavior". I agree that an argument can be made that at least now we know where to go to find the canonical definition.

cc @goderbauer

@gspencergoog
Copy link
Contributor Author

Yes, I'll update the style guide to match.

Auditing it might be hard: I'd have to modify dartdoc to spit out the failures, which is a bigger job than just hacking it like I did, since I wouldn't want to impose our rules on others. Or I could build my own script that used the analyzer. Maybe the second option's not too bad, actually. I'll check it out if I have time.

@Hixie
Copy link
Contributor

Hixie commented Oct 31, 2020

Definitely time box any effort to write automated testing, yeah. What we need is a way to schedule ourselves to do this kind of manual audit regularly. Maybe we should have a Wiki page that says "In October, someone should audit the templates. In May and December, someone should check the deprecation notices for any that need clearing out." along with some helpful hints for how we did each of these in the past.

@gspencergoog
Copy link
Contributor Author

That's a good idea. I do that about once a year or so with the spell checking, since it's really kind of a manual process.

@goderbauer
Copy link
Member

Can you document the naming style for macros in the style guide (e.g. that they should be named based on the lib they are defined in and based on the property they document?).

We should also document in the wiki how to check for this manually every so often.

Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

LGTM

@gspencergoog
Copy link
Contributor Author

Yes, I added a section to the style guide last week. It reads:


Dartdoc templates and macros

Dartdoc supports creating templates that can be reused in other parts of the code. They are defined
like so:

/// {@template <id>}
/// ...
/// {@endtemplate}

and used via:

/// {@macro <id>}

The <id> should be a unique identifier that is of the form flutter.library.Class.member[.optionalDescription].

For example:

// GOOD:
/// {@template flutter.rendering.Layer.findAnnotations.aboutAnnotations}
/// Annotations are great!
/// {@endtemplate

// BAD:
/// {@template the_stuff!}
/// This is some great stuff!
/// {@endtemplate}

The optionalDescription component of the identifier is only necessary if there is more than one
template defined in one Dartdoc block. If a symbol is not part of a library, or not part of a class, then
just omit those parts from the ID.

@fluttergithubbot fluttergithubbot merged commit 88809aa into flutter:master Nov 2, 2020
@gspencergoog gspencergoog deleted the standardize_macro_names branch October 7, 2022 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) a: internationalization Supporting other languages or locales. (aka i18n) a: tests "flutter test", flutter_test, or one of our tests c: contributor-productivity Team-specific productivity, code health, technical debt. f: cupertino flutter/packages/flutter/cupertino repository 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.

4 participants