Commit 04dca44f authored by Adam Barth's avatar Adam Barth Committed by GitHub

Be consistent about method versus function (#4828)

Fixes #4761
parent ea24d14c
...@@ -15,13 +15,13 @@ abstract class HitTestable { // ignore: one_member_abstracts ...@@ -15,13 +15,13 @@ abstract class HitTestable { // ignore: one_member_abstracts
/// An object that can dispatch events. /// An object that can dispatch events.
abstract class HitTestDispatcher { // ignore: one_member_abstracts abstract class HitTestDispatcher { // ignore: one_member_abstracts
/// Override this function to dispatch events. /// Override this method to dispatch events.
void dispatchEvent(PointerEvent event, HitTestResult result); void dispatchEvent(PointerEvent event, HitTestResult result);
} }
/// An object that can handle events. /// An object that can handle events.
abstract class HitTestTarget { // ignore: one_member_abstracts abstract class HitTestTarget { // ignore: one_member_abstracts
/// Override this function to receive events. /// Override this method to receive events.
void handleEvent(PointerEvent event, HitTestEntry entry); void handleEvent(PointerEvent event, HitTestEntry entry);
} }
......
...@@ -193,7 +193,7 @@ abstract class MultiDragGestureRecognizer<T extends MultiDragPointerState> exten ...@@ -193,7 +193,7 @@ abstract class MultiDragGestureRecognizer<T extends MultiDragPointerState> exten
state._setArenaEntry(GestureBinding.instance.gestureArena.add(event.pointer, this)); state._setArenaEntry(GestureBinding.instance.gestureArena.add(event.pointer, this));
} }
/// Subclasses should override this function to create per-pointer state /// Subclasses should override this method to create per-pointer state
/// objects to track the pointer associated with the given event. /// objects to track the pointer associated with the given event.
T createNewPointerState(PointerDownEvent event); T createNewPointerState(PointerDownEvent event);
......
...@@ -206,7 +206,7 @@ abstract class PrimaryPointerGestureRecognizer extends OneSequenceGestureRecogni ...@@ -206,7 +206,7 @@ abstract class PrimaryPointerGestureRecognizer extends OneSequenceGestureRecogni
/// Override to be notified when [deadline] is exceeded. /// Override to be notified when [deadline] is exceeded.
/// ///
/// You must override this function if you supply a [deadline]. /// You must override this method if you supply a [deadline].
void didExceedDeadline() { void didExceedDeadline() {
assert(deadline == null); assert(deadline == null);
} }
......
...@@ -552,7 +552,7 @@ abstract class RenderBox extends RenderObject { ...@@ -552,7 +552,7 @@ abstract class RenderBox extends RenderObject {
/// Calling this function is expensive and as it can result in O(N^2) /// Calling this function is expensive and as it can result in O(N^2)
/// behavior. /// behavior.
/// ///
/// Do not override this function. Instead, implement [computeMinIntrinsicWidth]. /// Do not override this method. Instead, implement [computeMinIntrinsicWidth].
@mustCallSuper @mustCallSuper
double getMinIntrinsicWidth(double height) { double getMinIntrinsicWidth(double height) {
return _computeIntrinsicDimension(_IntrinsicDimension.minWidth, height, computeMinIntrinsicWidth); return _computeIntrinsicDimension(_IntrinsicDimension.minWidth, height, computeMinIntrinsicWidth);
...@@ -652,7 +652,7 @@ abstract class RenderBox extends RenderObject { ...@@ -652,7 +652,7 @@ abstract class RenderBox extends RenderObject {
/// Calling this function is expensive and as it can result in O(N^2) /// Calling this function is expensive and as it can result in O(N^2)
/// behavior. /// behavior.
/// ///
/// Do not override this function. Instead, implement /// Do not override this method. Instead, implement
/// [computeMaxIntrinsicWidth]. /// [computeMaxIntrinsicWidth].
@mustCallSuper @mustCallSuper
double getMaxIntrinsicWidth(double height) { double getMaxIntrinsicWidth(double height) {
...@@ -707,7 +707,7 @@ abstract class RenderBox extends RenderObject { ...@@ -707,7 +707,7 @@ abstract class RenderBox extends RenderObject {
/// Calling this function is expensive and as it can result in O(N^2) /// Calling this function is expensive and as it can result in O(N^2)
/// behavior. /// behavior.
/// ///
/// Do not override this function. Instead, implement /// Do not override this method. Instead, implement
/// [computeMinIntrinsicHeight]. /// [computeMinIntrinsicHeight].
@mustCallSuper @mustCallSuper
double getMinIntrinsicHeight(double width) { double getMinIntrinsicHeight(double width) {
...@@ -754,7 +754,7 @@ abstract class RenderBox extends RenderObject { ...@@ -754,7 +754,7 @@ abstract class RenderBox extends RenderObject {
/// Calling this function is expensive and as it can result in O(N^2) /// Calling this function is expensive and as it can result in O(N^2)
/// behavior. /// behavior.
/// ///
/// Do not override this function. Instead, implement /// Do not override this method. Instead, implement
/// [computeMaxIntrinsicHeight]. /// [computeMaxIntrinsicHeight].
@mustCallSuper @mustCallSuper
double getMaxIntrinsicHeight(double width) { double getMaxIntrinsicHeight(double width) {
...@@ -952,7 +952,7 @@ abstract class RenderBox extends RenderObject { ...@@ -952,7 +952,7 @@ abstract class RenderBox extends RenderObject {
/// are implementing [computeDistanceToActualBaseline] and need to defer to a /// are implementing [computeDistanceToActualBaseline] and need to defer to a
/// child. /// child.
/// ///
/// Subclasses should override this function to supply the distances to their /// Subclasses should override this method to supply the distances to their
/// baselines. /// baselines.
@protected @protected
double computeDistanceToActualBaseline(TextBaseline baseline) { double computeDistanceToActualBaseline(TextBaseline baseline) {
...@@ -1174,7 +1174,7 @@ abstract class RenderBox extends RenderObject { ...@@ -1174,7 +1174,7 @@ abstract class RenderBox extends RenderObject {
return false; return false;
} }
/// Override this function if this render object can be hit even if its /// Override this method if this render object can be hit even if its
/// children were not hit. /// children were not hit.
/// ///
/// Used by [hitTest]. If you override [hitTest] and do not call this /// Used by [hitTest]. If you override [hitTest] and do not call this
...@@ -1182,7 +1182,7 @@ abstract class RenderBox extends RenderObject { ...@@ -1182,7 +1182,7 @@ abstract class RenderBox extends RenderObject {
@protected @protected
bool hitTestSelf(Point position) => false; bool hitTestSelf(Point position) => false;
/// Override this function to check whether any children are located at the /// Override this method to check whether any children are located at the
/// given position. /// given position.
/// ///
/// Typically children should be hit tested in reverse paint order so that /// Typically children should be hit tested in reverse paint order so that
...@@ -1261,7 +1261,7 @@ abstract class RenderBox extends RenderObject { ...@@ -1261,7 +1261,7 @@ abstract class RenderBox extends RenderObject {
int _debugActivePointers = 0; int _debugActivePointers = 0;
/// Override this function to handle pointer events that hit this render object. /// Override this method to handle pointer events that hit this render object.
/// ///
/// For [RenderBox] objects, the `entry` argument is a [BoxHitTestEntry]. From this /// For [RenderBox] objects, the `entry` argument is a [BoxHitTestEntry]. From this
/// object you can determine the [PointerDownEvent]'s position in local coordinates. /// object you can determine the [PointerDownEvent]'s position in local coordinates.
......
...@@ -187,10 +187,10 @@ class GridChildPlacement { ...@@ -187,10 +187,10 @@ class GridChildPlacement {
/// An abstract interface to control the layout of a [RenderGrid]. /// An abstract interface to control the layout of a [RenderGrid].
abstract class GridDelegate { abstract class GridDelegate {
/// Override this function to control size of the columns and rows. /// Override this method to control size of the columns and rows.
GridSpecification getGridSpecification(BoxConstraints constraints, int childCount); GridSpecification getGridSpecification(BoxConstraints constraints, int childCount);
/// Override this function to control where children are placed in the grid. /// Override this method to control where children are placed in the grid.
/// ///
/// During layout, the grid calls this function for each child, passing the /// During layout, the grid calls this function for each child, passing the
/// [placementData] associated with that child as context. The returned /// [placementData] associated with that child as context. The returned
......
...@@ -65,7 +65,7 @@ abstract class Layer { ...@@ -65,7 +65,7 @@ abstract class Layer {
_parent = null; _parent = null;
} }
/// Override this function to upload this layer to the engine /// Override this method to upload this layer to the engine
/// ///
/// The layerOffset is the accumulated offset of this layer's parent from the /// The layerOffset is the accumulated offset of this layer's parent from the
/// origin of the builder's coordinate system. /// origin of the builder's coordinate system.
......
...@@ -61,7 +61,7 @@ class AbstractNode { ...@@ -61,7 +61,7 @@ class AbstractNode {
} }
} }
/// Override this function in subclasses with child nodes to call /// Override this method in subclasses with child nodes to call
/// redepthChild(child) for each child. Do not call directly. /// redepthChild(child) for each child. Do not call directly.
void redepthChildren() { } void redepthChildren() { }
......
...@@ -1525,7 +1525,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget { ...@@ -1525,7 +1525,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
/// render object during layout. The layout constraints provided by your /// render object during layout. The layout constraints provided by your
/// parent are available via the [constraints] getter. /// parent are available via the [constraints] getter.
/// ///
/// Subclasses that set [sizedByParent] to true should override this function /// Subclasses that set [sizedByParent] to true should override this method
/// to compute their size. /// to compute their size.
/// ///
/// This function is called only if [sizedByParent] is true. /// This function is called only if [sizedByParent] is true.
...@@ -1827,13 +1827,13 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget { ...@@ -1827,13 +1827,13 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
/// layer. /// layer.
Rect get paintBounds; Rect get paintBounds;
/// Override this function to paint debugging information. /// Override this method to paint debugging information.
@protected @protected
void debugPaint(PaintingContext context, Offset offset) { } void debugPaint(PaintingContext context, Offset offset) { }
/// Paint this render object into the given context at the given offset. /// Paint this render object into the given context at the given offset.
/// ///
/// Subclasses should override this function to provide a visual appearance /// Subclasses should override this method to provide a visual appearance
/// for themselves. The render object's local coordinate system is /// for themselves. The render object's local coordinate system is
/// axis-aligned with the coordinate system of the context's canvas and the /// axis-aligned with the coordinate system of the context's canvas and the
/// render object's local origin (i.e, x=0 and y=0) is placed at the given /// render object's local origin (i.e, x=0 and y=0) is placed at the given
...@@ -2094,7 +2094,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget { ...@@ -2094,7 +2094,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
// EVENTS // EVENTS
/// Override this function to handle pointer events that hit this render object. /// Override this method to handle pointer events that hit this render object.
@override @override
void handleEvent(PointerEvent event, HitTestEntry entry) { } void handleEvent(PointerEvent event, HitTestEntry entry) { }
......
...@@ -926,7 +926,7 @@ abstract class ParentDataWidget<T extends RenderObjectWidget> extends _ProxyWidg ...@@ -926,7 +926,7 @@ abstract class ParentDataWidget<T extends RenderObjectWidget> extends _ProxyWidg
@override @override
ParentDataElement<T> createElement() => new ParentDataElement<T>(this); ParentDataElement<T> createElement() => new ParentDataElement<T>(this);
/// Subclasses should override this function to return true if the given /// Subclasses should override this method to return true if the given
/// ancestor is a RenderObjectWidget that wraps a RenderObject that can handle /// ancestor is a RenderObjectWidget that wraps a RenderObject that can handle
/// the kind of ParentData widget that the ParentDataWidget subclass handles. /// the kind of ParentData widget that the ParentDataWidget subclass handles.
/// ///
......
...@@ -230,13 +230,13 @@ abstract class TransitionRoute<T> extends OverlayRoute<T> { ...@@ -230,13 +230,13 @@ abstract class TransitionRoute<T> extends OverlayRoute<T> {
/// Whether this route can perform a transition to the given route. /// Whether this route can perform a transition to the given route.
/// ///
/// Subclasses can override this function to restrict the set of routes they /// Subclasses can override this method to restrict the set of routes they
/// need to coordinate transitions with. /// need to coordinate transitions with.
bool canTransitionTo(TransitionRoute<dynamic> nextRoute) => true; bool canTransitionTo(TransitionRoute<dynamic> nextRoute) => true;
/// Whether this route can perform a transition from the given route. /// Whether this route can perform a transition from the given route.
/// ///
/// Subclasses can override this function to restrict the set of routes they /// Subclasses can override this method to restrict the set of routes they
/// need to coordinate transitions with. /// need to coordinate transitions with.
bool canTransitionFrom(TransitionRoute<dynamic> nextRoute) => true; bool canTransitionFrom(TransitionRoute<dynamic> nextRoute) => true;
...@@ -490,7 +490,7 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T ...@@ -490,7 +490,7 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T
// The API for subclasses to override - used by _ModalScope // The API for subclasses to override - used by _ModalScope
/// Override this function to build the primary content of this route. /// Override this method to build the primary content of this route.
/// ///
/// * [context] The context in which the route is being built. /// * [context] The context in which the route is being built.
/// * [animation] The animation for this route's transition. When entering, /// * [animation] The animation for this route's transition. When entering,
...@@ -501,7 +501,7 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T ...@@ -501,7 +501,7 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T
/// and exit transition of routes pushed on top of this route. /// and exit transition of routes pushed on top of this route.
Widget buildPage(BuildContext context, Animation<double> animation, Animation<double> forwardAnimation); Widget buildPage(BuildContext context, Animation<double> animation, Animation<double> forwardAnimation);
/// Override this function to wrap the route in a number of transition widgets. /// Override this method to wrap the route in a number of transition widgets.
/// ///
/// For example, to create a fade entrance transition, wrap the given child /// For example, to create a fade entrance transition, wrap the given child
/// widget in a [FadeTransition] using the given animation as the opacity. /// widget in a [FadeTransition] using the given animation as the opacity.
......
...@@ -545,7 +545,7 @@ class ScrollableState<T extends Scrollable> extends State<T> { ...@@ -545,7 +545,7 @@ class ScrollableState<T extends Scrollable> extends State<T> {
/// Calls the onScroll callback. /// Calls the onScroll callback.
/// ///
/// Subclasses can override this function to hook the scroll callback. /// Subclasses can override this method to hook the scroll callback.
void dispatchOnScroll() { void dispatchOnScroll() {
assert(_numberOfInProgressScrolls > 0); assert(_numberOfInProgressScrolls > 0);
if (config.onScroll != null) if (config.onScroll != null)
...@@ -575,7 +575,7 @@ class ScrollableState<T extends Scrollable> extends State<T> { ...@@ -575,7 +575,7 @@ class ScrollableState<T extends Scrollable> extends State<T> {
/// Calls the onScrollStart callback. /// Calls the onScrollStart callback.
/// ///
/// Subclasses can override this function to hook the scroll start callback. /// Subclasses can override this method to hook the scroll start callback.
void dispatchOnScrollStart() { void dispatchOnScrollStart() {
assert(_numberOfInProgressScrolls == 1); assert(_numberOfInProgressScrolls == 1);
if (config.onScrollStart != null) if (config.onScrollStart != null)
...@@ -603,7 +603,7 @@ class ScrollableState<T extends Scrollable> extends State<T> { ...@@ -603,7 +603,7 @@ class ScrollableState<T extends Scrollable> extends State<T> {
/// Calls the dispatchOnScrollEnd callback. /// Calls the dispatchOnScrollEnd callback.
/// ///
/// Subclasses can override this function to hook the scroll end callback. /// Subclasses can override this method to hook the scroll end callback.
void dispatchOnScrollEnd() { void dispatchOnScrollEnd() {
assert(_numberOfInProgressScrolls == 0); assert(_numberOfInProgressScrolls == 0);
if (config.onScrollEnd != null) if (config.onScrollEnd != null)
...@@ -672,7 +672,7 @@ class ScrollableState<T extends Scrollable> extends State<T> { ...@@ -672,7 +672,7 @@ class ScrollableState<T extends Scrollable> extends State<T> {
/// Calls the widget's [builder] by default. /// Calls the widget's [builder] by default.
/// ///
/// Subclasses can override this function to build the interior of their /// Subclasses can override this method to build the interior of their
/// scrollable widget. Scrollable wraps the returned widget in a /// scrollable widget. Scrollable wraps the returned widget in a
/// [GestureDetector] to observe the user's interaction with this widget and /// [GestureDetector] to observe the user's interaction with this widget and
/// to adjust the scroll offset accordingly. /// to adjust the scroll offset accordingly.
......
...@@ -22,7 +22,7 @@ abstract class StatusTransitionWidget extends StatefulWidget { ...@@ -22,7 +22,7 @@ abstract class StatusTransitionWidget extends StatefulWidget {
/// The animation to which this widget is listening. /// The animation to which this widget is listening.
final Animation<double> animation; final Animation<double> animation;
/// Override this function to build widgets that depend on the current status /// Override this method to build widgets that depend on the current status
/// of the animation. /// of the animation.
Widget build(BuildContext context); Widget build(BuildContext context);
......
...@@ -33,7 +33,7 @@ abstract class AnimatedWidget extends StatefulWidget { ...@@ -33,7 +33,7 @@ abstract class AnimatedWidget extends StatefulWidget {
/// The animation to which this widget is listening. /// The animation to which this widget is listening.
final Animation<Object> animation; final Animation<Object> animation;
/// Override this function to build widgets that depend on the current value /// Override this method to build widgets that depend on the current value
/// of the animation. /// of the animation.
Widget build(BuildContext context); Widget build(BuildContext context);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment