Unverified Commit a9c40a2a authored by hgraceb's avatar hgraceb Committed by GitHub

Add commonly used parameter names (#140027)

## Description

Similar to #119877, but with more cases that I could find in `packages/flutter`. 

Although there is already a [proposal](https://github.com/dart-lang/linter/issues/4102), it is uncertain how long it will take to be implemented.

![[image-20200711205959042](https://user-images.githubusercontent.com/72788825/216486897-b56453d2-b309-47ea-885b-b0ec6ed1b648.png)](https://user-images.githubusercontent.com/72788825/216486897-b56453d2-b309-47ea-885b-b0ec6ed1b648.png)
parent 0926a553
...@@ -19,7 +19,7 @@ export 'curves.dart' show Curve; ...@@ -19,7 +19,7 @@ export 'curves.dart' show Curve;
/// A typedef used by [Animatable.fromCallback] to create an [Animatable] /// A typedef used by [Animatable.fromCallback] to create an [Animatable]
/// from a callback. /// from a callback.
typedef AnimatableCallback<T> = T Function(double); typedef AnimatableCallback<T> = T Function(double value);
/// An object that can produce a value of type `T` given an [Animation<double>] /// An object that can produce a value of type `T` given an [Animation<double>]
/// as input. /// as input.
......
...@@ -52,7 +52,7 @@ abstract class ObjectEvent{ ...@@ -52,7 +52,7 @@ abstract class ObjectEvent{
} }
/// A listener of [ObjectEvent]. /// A listener of [ObjectEvent].
typedef ObjectEventListener = void Function(ObjectEvent); typedef ObjectEventListener = void Function(ObjectEvent event);
/// An event that describes creation of an object. /// An event that describes creation of an object.
class ObjectCreated extends ObjectEvent { class ObjectCreated extends ObjectEvent {
......
...@@ -428,7 +428,7 @@ class _BottomSheetState extends State<BottomSheet> { ...@@ -428,7 +428,7 @@ class _BottomSheetState extends State<BottomSheet> {
// See scaffold.dart // See scaffold.dart
typedef _SizeChangeCallback<Size> = void Function(Size); typedef _SizeChangeCallback<Size> = void Function(Size size);
class _DragHandle extends StatelessWidget { class _DragHandle extends StatelessWidget {
const _DragHandle({ const _DragHandle({
......
...@@ -2112,7 +2112,7 @@ class _HourMinuteTextFieldState extends State<_HourMinuteTextField> with Restora ...@@ -2112,7 +2112,7 @@ class _HourMinuteTextFieldState extends State<_HourMinuteTextField> with Restora
} }
/// Signature for when the time picker entry mode is changed. /// Signature for when the time picker entry mode is changed.
typedef EntryModeChangeCallback = void Function(TimePickerEntryMode); typedef EntryModeChangeCallback = void Function(TimePickerEntryMode mode);
/// A Material Design time picker designed to appear inside a popup dialog. /// A Material Design time picker designed to appear inside a popup dialog.
/// ///
......
...@@ -41,7 +41,7 @@ HttpClientProvider? debugNetworkImageHttpClientProvider; ...@@ -41,7 +41,7 @@ HttpClientProvider? debugNetworkImageHttpClientProvider;
/// output size. /// output size.
/// ///
/// See: [debugOnPaintImage]. /// See: [debugOnPaintImage].
typedef PaintImageCallback = void Function(ImageSizeInfo); typedef PaintImageCallback = void Function(ImageSizeInfo info);
/// Tracks the bytes used by a [dart:ui.Image] compared to the bytes needed to /// Tracks the bytes used by a [dart:ui.Image] compared to the bytes needed to
/// paint that image without scaling it. /// paint that image without scaling it.
...@@ -199,14 +199,14 @@ bool debugAssertAllPaintingVarsUnset(String reason, { bool debugDisableShadowsOv ...@@ -199,14 +199,14 @@ bool debugAssertAllPaintingVarsUnset(String reason, { bool debugDisableShadowsOv
/// Used by tests to run assertions on the [Picture] created by /// Used by tests to run assertions on the [Picture] created by
/// [ShaderWarmUp.execute]. The return value indicates whether the assertions /// [ShaderWarmUp.execute]. The return value indicates whether the assertions
/// pass or not. /// pass or not.
typedef ShaderWarmUpPictureCallback = bool Function(Picture); typedef ShaderWarmUpPictureCallback = bool Function(Picture picture);
/// The signature of [debugCaptureShaderWarmUpImage]. /// The signature of [debugCaptureShaderWarmUpImage].
/// ///
/// Used by tests to run assertions on the [Image] created by /// Used by tests to run assertions on the [Image] created by
/// [ShaderWarmUp.execute]. The return value indicates whether the assertions /// [ShaderWarmUp.execute]. The return value indicates whether the assertions
/// pass or not. /// pass or not.
typedef ShaderWarmUpImageCallback = bool Function(Image); typedef ShaderWarmUpImageCallback = bool Function(Image image);
/// Called by [ShaderWarmUp.execute] immediately after it creates a [Picture]. /// Called by [ShaderWarmUp.execute] immediately after it creates a [Picture].
/// ///
......
...@@ -1077,7 +1077,7 @@ class PerformanceOverlayLayer extends Layer { ...@@ -1077,7 +1077,7 @@ class PerformanceOverlayLayer extends Layer {
} }
/// The signature of the callback added in [Layer.addCompositionCallback]. /// The signature of the callback added in [Layer.addCompositionCallback].
typedef CompositionCallback = void Function(Layer); typedef CompositionCallback = void Function(Layer layer);
/// A composited layer that has a list of children. /// A composited layer that has a list of children.
/// ///
......
...@@ -19,7 +19,7 @@ import 'stack.dart' show RelativeRect; ...@@ -19,7 +19,7 @@ import 'stack.dart' show RelativeRect;
/// Used by [RenderConstraintsTransformBox] and [ConstraintsTransformBox]. /// Used by [RenderConstraintsTransformBox] and [ConstraintsTransformBox].
/// Typically the caller requires the returned [BoxConstraints] to be /// Typically the caller requires the returned [BoxConstraints] to be
/// [BoxConstraints.isNormalized]. /// [BoxConstraints.isNormalized].
typedef BoxConstraintsTransform = BoxConstraints Function(BoxConstraints); typedef BoxConstraintsTransform = BoxConstraints Function(BoxConstraints constraints);
/// Abstract class for one-child-layout render boxes that provide control over /// Abstract class for one-child-layout render boxes that provide control over
/// the child's position. /// the child's position.
......
...@@ -59,7 +59,7 @@ export 'package:flutter/services.dart' show KeyboardInsertedContent, SelectionCh ...@@ -59,7 +59,7 @@ export 'package:flutter/services.dart' show KeyboardInsertedContent, SelectionCh
typedef SelectionChangedCallback = void Function(TextSelection selection, SelectionChangedCause? cause); typedef SelectionChangedCallback = void Function(TextSelection selection, SelectionChangedCause? cause);
/// Signature for the callback that reports the app private command results. /// Signature for the callback that reports the app private command results.
typedef AppPrivateCommandCallback = void Function(String, Map<String, dynamic>); typedef AppPrivateCommandCallback = void Function(String action, Map<String, dynamic> data);
/// Signature for a widget builder that builds a context menu for the given /// Signature for a widget builder that builds a context menu for the given
/// [EditableTextState]. /// [EditableTextState].
......
...@@ -54,7 +54,7 @@ export 'package:flutter/rendering.dart' show AxisDirection; ...@@ -54,7 +54,7 @@ export 'package:flutter/rendering.dart' show AxisDirection;
/// * [WidgetBuilder], which is similar but only takes a [BuildContext]. /// * [WidgetBuilder], which is similar but only takes a [BuildContext].
/// * [NullableIndexedWidgetBuilder], which is similar but may return null. /// * [NullableIndexedWidgetBuilder], which is similar but may return null.
/// * [IndexedWidgetBuilder], which is similar but not nullable. /// * [IndexedWidgetBuilder], which is similar but not nullable.
typedef TwoDimensionalIndexedWidgetBuilder = Widget? Function(BuildContext, ChildVicinity vicinity); typedef TwoDimensionalIndexedWidgetBuilder = Widget? Function(BuildContext context, ChildVicinity vicinity);
/// A widget through which a portion of larger content can be viewed, typically /// A widget through which a portion of larger content can be viewed, typically
/// in combination with a [TwoDimensionalScrollable]. /// in combination with a [TwoDimensionalScrollable].
......
...@@ -490,7 +490,7 @@ class MockScrollBehavior extends ScrollBehavior { ...@@ -490,7 +490,7 @@ class MockScrollBehavior extends ScrollBehavior {
ScrollPhysics getScrollPhysics(BuildContext context) => const NeverScrollableScrollPhysics(); ScrollPhysics getScrollPhysics(BuildContext context) => const NeverScrollableScrollPhysics();
} }
typedef SimpleRouterDelegateBuilder = Widget Function(BuildContext, RouteInformation); typedef SimpleRouterDelegateBuilder = Widget Function(BuildContext context, RouteInformation information);
typedef SimpleNavigatorRouterDelegatePopPage<T> = bool Function(Route<T> route, T result, SimpleNavigatorRouterDelegate delegate); typedef SimpleNavigatorRouterDelegatePopPage<T> = bool Function(Route<T> route, T result, SimpleNavigatorRouterDelegate delegate);
class SimpleRouteInformationParser extends RouteInformationParser<RouteInformation> { class SimpleRouteInformationParser extends RouteInformationParser<RouteInformation> {
......
...@@ -1611,7 +1611,7 @@ class MockScrollBehavior extends ScrollBehavior { ...@@ -1611,7 +1611,7 @@ class MockScrollBehavior extends ScrollBehavior {
ScrollPhysics getScrollPhysics(BuildContext context) => const NeverScrollableScrollPhysics(); ScrollPhysics getScrollPhysics(BuildContext context) => const NeverScrollableScrollPhysics();
} }
typedef SimpleRouterDelegateBuilder = Widget Function(BuildContext, RouteInformation); typedef SimpleRouterDelegateBuilder = Widget Function(BuildContext context, RouteInformation information);
typedef SimpleNavigatorRouterDelegatePopPage<T> = bool Function(Route<T> route, T result, SimpleNavigatorRouterDelegate delegate); typedef SimpleNavigatorRouterDelegatePopPage<T> = bool Function(Route<T> route, T result, SimpleNavigatorRouterDelegate delegate);
class SimpleRouteInformationParser extends RouteInformationParser<RouteInformation> { class SimpleRouteInformationParser extends RouteInformationParser<RouteInformation> {
......
...@@ -17131,7 +17131,7 @@ class _ObscureTextTestWidgetState extends State<_ObscureTextTestWidget> { ...@@ -17131,7 +17131,7 @@ class _ObscureTextTestWidgetState extends State<_ObscureTextTestWidget> {
} }
typedef FormatEditUpdateCallback = void Function(TextEditingValue, TextEditingValue); typedef FormatEditUpdateCallback = void Function(TextEditingValue oldValue, TextEditingValue newValue);
// On web, key events in text fields are handled by the browser. // On web, key events in text fields are handled by the browser.
const bool areKeyEventsHandledByPlatform = isBrowser; const bool areKeyEventsHandledByPlatform = isBrowser;
......
...@@ -1425,7 +1425,7 @@ void main() { ...@@ -1425,7 +1425,7 @@ void main() {
}); });
testWidgetsWithLeakTracking('Passes onAppPrivateCommand to onAppPrivateCommand TextField', (WidgetTester tester) async { testWidgetsWithLeakTracking('Passes onAppPrivateCommand to onAppPrivateCommand TextField', (WidgetTester tester) async {
void onAppPrivateCommand(String p0, Map<String, dynamic> p1) {} void onAppPrivateCommand(String action, Map<String, dynamic> data) {}
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
......
...@@ -784,7 +784,7 @@ void main() { ...@@ -784,7 +784,7 @@ void main() {
}); });
} }
typedef SimpleRouterDelegateBuilder = Widget Function(BuildContext, RouteInformation); typedef SimpleRouterDelegateBuilder = Widget Function(BuildContext context, RouteInformation information);
typedef SimpleNavigatorRouterDelegatePopPage<T> = bool Function(Route<T> route, T result, SimpleNavigatorRouterDelegate delegate); typedef SimpleNavigatorRouterDelegatePopPage<T> = bool Function(Route<T> route, T result, SimpleNavigatorRouterDelegate delegate);
class SelectAllSpy extends Action<SelectAllTextIntent> { class SelectAllSpy extends Action<SelectAllTextIntent> {
......
...@@ -32,7 +32,7 @@ void main() { ...@@ -32,7 +32,7 @@ void main() {
}); });
} }
typedef BuildCallback = void Function(BuildContext); typedef BuildCallback = void Function(BuildContext context);
class TestStatelessWidget extends StatelessWidget { class TestStatelessWidget extends StatelessWidget {
const TestStatelessWidget({super.key, required this.onBuild}); const TestStatelessWidget({super.key, required this.onBuild});
......
...@@ -319,7 +319,7 @@ void main() { ...@@ -319,7 +319,7 @@ void main() {
}); });
} }
typedef SimpleRouterDelegateBuilder = Widget Function(BuildContext, RouteInformation); typedef SimpleRouterDelegateBuilder = Widget Function(BuildContext context, RouteInformation information);
typedef SimpleRouterDelegatePopRoute = Future<bool> Function(); typedef SimpleRouterDelegatePopRoute = Future<bool> Function();
class SimpleRouteInformationParser extends RouteInformationParser<RouteInformation> { class SimpleRouteInformationParser extends RouteInformationParser<RouteInformation> {
......
...@@ -1708,11 +1708,11 @@ Widget buildBoilerPlate(Widget child) { ...@@ -1708,11 +1708,11 @@ Widget buildBoilerPlate(Widget child) {
); );
} }
typedef SimpleRouterDelegateBuilder = Widget Function(BuildContext, RouteInformation?); typedef SimpleRouterDelegateBuilder = Widget Function(BuildContext context, RouteInformation? information);
typedef SimpleRouterDelegatePopRoute = Future<bool> Function(); typedef SimpleRouterDelegatePopRoute = Future<bool> Function();
typedef SimpleNavigatorRouterDelegatePopPage<T> = bool Function(Route<T> route, T result); typedef SimpleNavigatorRouterDelegatePopPage<T> = bool Function(Route<T> route, T result);
typedef RouterReportRouterInformation = void Function(RouteInformation, RouteInformationReportingType); typedef RouterReportRouterInformation = void Function(RouteInformation information, RouteInformationReportingType type);
typedef CustomRouteInformationParserCallback = RouteInformation Function(RouteInformation, BuildContext); typedef CustomRouteInformationParserCallback = RouteInformation Function(RouteInformation information, BuildContext context);
class SimpleRouteInformationParser extends RouteInformationParser<RouteInformation> { class SimpleRouteInformationParser extends RouteInformationParser<RouteInformation> {
SimpleRouteInformationParser(); SimpleRouteInformationParser();
......
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