Skip to content

Prepare framework for use_super_parameters #100905

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

Merged
merged 1 commit into from
Apr 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 5 additions & 5 deletions packages/flutter/lib/src/animation/tween.dart
Original file line number Diff line number Diff line change
@@ -368,7 +368,7 @@ class ColorTween extends Tween<Color?> {
/// or [end] if you want the effect of fading in or out of transparent.
/// Instead prefer null. [Colors.transparent] refers to black transparent and
/// thus will fade out of or into black which is likely unwanted.
ColorTween({ Color? begin, Color? end }) : super(begin: begin, end: end);
ColorTween({ super.begin, super.end });

/// Returns the value this variable has at the given animation clock value.
@override
@@ -388,7 +388,7 @@ class SizeTween extends Tween<Size?> {
///
/// The [begin] and [end] properties may be null; the null value
/// is treated as an empty size.
SizeTween({ Size? begin, Size? end }) : super(begin: begin, end: end);
SizeTween({ super.begin, super.end });

/// Returns the value this variable has at the given animation clock value.
@override
@@ -409,7 +409,7 @@ class RectTween extends Tween<Rect?> {
///
/// The [begin] and [end] properties may be null; the null value
/// is treated as an empty rect at the top left corner.
RectTween({ Rect? begin, Rect? end }) : super(begin: begin, end: end);
RectTween({ super.begin, super.end });

/// Returns the value this variable has at the given animation clock value.
@override
@@ -436,7 +436,7 @@ class IntTween extends Tween<int> {
/// The [begin] and [end] properties must be non-null before the tween is
/// first used, but the arguments can be null if the values are going to be
/// filled in later.
IntTween({ int? begin, int? end }) : super(begin: begin, end: end);
IntTween({ super.begin, super.end });

// The inherited lerp() function doesn't work with ints because it multiplies
// the begin and end types by a double, and int * double returns a double.
@@ -464,7 +464,7 @@ class StepTween extends Tween<int> {
/// The [begin] and [end] properties must be non-null before the tween is
/// first used, but the arguments can be null if the values are going to be
/// filled in later.
StepTween({ int? begin, int? end }) : super(begin: begin, end: end);
StepTween({ super.begin, super.end });

// The inherited lerp() function doesn't work with ints because it multiplies
// the begin and end types by a double, and int * double returns a double.
5 changes: 2 additions & 3 deletions packages/flutter/lib/src/animation/tween_sequence.dart
Original file line number Diff line number Diff line change
@@ -110,9 +110,8 @@ class FlippedTweenSequence extends TweenSequence<double> {
/// There's a small cost associated with building a `TweenSequence` so it's
/// best to reuse one, rather than rebuilding it on every frame, when that's
/// possible.
FlippedTweenSequence(List<TweenSequenceItem<double>> items)
: assert(items != null),
super(items);
FlippedTweenSequence(super.items)
: assert(items != null);

@override
double transform(double t) => 1 - super.transform(1 - t);
10 changes: 4 additions & 6 deletions packages/flutter/lib/src/cupertino/activity_indicator.dart
Original file line number Diff line number Diff line change
@@ -26,15 +26,14 @@ const Color _kActiveTickColor = CupertinoDynamicColor.withBrightness(
class CupertinoActivityIndicator extends StatefulWidget {
/// Creates an iOS-style activity indicator that spins clockwise.
const CupertinoActivityIndicator({
Key? key,
super.key,
this.color,
this.animating = true,
this.radius = _kDefaultIndicatorRadius,
}) : assert(animating != null),
assert(radius != null),
assert(radius > 0.0),
progress = 1.0,
super(key: key);
progress = 1.0;

/// Creates a non-animated iOS-style activity indicator that displays
/// a partial count of ticks based on the value of [progress].
@@ -43,7 +42,7 @@ class CupertinoActivityIndicator extends StatefulWidget {
/// will be shown) and 1.0 (all ticks will be shown) inclusive. Defaults
/// to 1.0.
const CupertinoActivityIndicator.partiallyRevealed({
Key? key,
super.key,
this.color,
this.radius = _kDefaultIndicatorRadius,
this.progress = 1.0,
@@ -52,8 +51,7 @@ class CupertinoActivityIndicator extends StatefulWidget {
assert(progress != null),
assert(progress >= 0.0),
assert(progress <= 1.0),
animating = false,
super(key: key);
animating = false;

/// Color of the activity indicator.
///
10 changes: 4 additions & 6 deletions packages/flutter/lib/src/cupertino/app.dart
Original file line number Diff line number Diff line change
@@ -148,7 +148,7 @@ class CupertinoApp extends StatefulWidget {
///
/// The boolean arguments, [routes], and [navigatorObservers], must not be null.
const CupertinoApp({
Key? key,
super.key,
this.navigatorKey,
this.home,
this.theme,
@@ -188,12 +188,11 @@ class CupertinoApp extends StatefulWidget {
routeInformationProvider = null,
routeInformationParser = null,
routerDelegate = null,
backButtonDispatcher = null,
super(key: key);
backButtonDispatcher = null;

/// Creates a [CupertinoApp] that uses the [Router] instead of a [Navigator].
const CupertinoApp.router({
Key? key,
super.key,
this.routeInformationProvider,
required RouteInformationParser<Object> this.routeInformationParser,
required RouterDelegate<Object> this.routerDelegate,
@@ -231,8 +230,7 @@ class CupertinoApp extends StatefulWidget {
onGenerateInitialRoutes = null,
onUnknownRoute = null,
routes = null,
initialRoute = null,
super(key: key);
initialRoute = null;

/// {@macro flutter.widgets.widgetsApp.navigatorKey}
final GlobalKey<NavigatorState>? navigatorKey;
5 changes: 2 additions & 3 deletions packages/flutter/lib/src/cupertino/bottom_tab_bar.dart
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ const Color _kDefaultTabBarInactiveColor = CupertinoColors.inactiveGray;
class CupertinoTabBar extends StatelessWidget implements PreferredSizeWidget {
/// Creates a tab bar in the iOS style.
const CupertinoTabBar({
Key? key,
super.key,
required this.items,
this.onTap,
this.currentIndex = 0,
@@ -82,8 +82,7 @@ class CupertinoTabBar extends StatelessWidget implements PreferredSizeWidget {
assert(0 <= currentIndex && currentIndex < items.length),
assert(iconSize != null),
assert(height != null && height >= 0.0),
assert(inactiveColor != null),
super(key: key);
assert(inactiveColor != null);

/// The interactive items laid out within the bottom navigation bar.
///
10 changes: 4 additions & 6 deletions packages/flutter/lib/src/cupertino/button.dart
Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@ const EdgeInsets _kBackgroundButtonPadding = EdgeInsets.symmetric(
class CupertinoButton extends StatefulWidget {
/// Creates an iOS-style button.
const CupertinoButton({
Key? key,
super.key,
required this.child,
this.padding,
this.color,
@@ -52,8 +52,7 @@ class CupertinoButton extends StatefulWidget {
}) : assert(pressedOpacity == null || (pressedOpacity >= 0.0 && pressedOpacity <= 1.0)),
assert(disabledColor != null),
assert(alignment != null),
_filled = false,
super(key: key);
_filled = false;

/// Creates an iOS-style button with a filled background.
///
@@ -62,7 +61,7 @@ class CupertinoButton extends StatefulWidget {
/// To specify a custom background color, use the [color] argument of the
/// default constructor.
const CupertinoButton.filled({
Key? key,
super.key,
required this.child,
this.padding,
this.disabledColor = CupertinoColors.quaternarySystemFill,
@@ -75,8 +74,7 @@ class CupertinoButton extends StatefulWidget {
assert(disabledColor != null),
assert(alignment != null),
color = null,
_filled = true,
super(key: key);
_filled = true;

/// The widget below this widget in the tree.
///
27 changes: 9 additions & 18 deletions packages/flutter/lib/src/cupertino/context_menu.dart
Original file line number Diff line number Diff line change
@@ -98,13 +98,12 @@ class CupertinoContextMenu extends StatefulWidget {
///
/// [child] is required and cannot be null.
CupertinoContextMenu({
Key? key,
super.key,
required this.actions,
required this.child,
this.previewBuilder,
}) : assert(actions != null && actions.isNotEmpty),
assert(child != null),
super(key: key);
assert(child != null);

/// The widget that can be "opened" with the [CupertinoContextMenu].
///
@@ -403,12 +402,11 @@ class _CupertinoContextMenuState extends State<CupertinoContextMenu> with Ticker
// siblings of the original child.
class _DecoyChild extends StatefulWidget {
const _DecoyChild({
Key? key,
this.beginRect,
required this.controller,
this.endRect,
this.child,
}) : super(key: key);
});

final Rect? beginRect;
final AnimationController controller;
@@ -521,19 +519,15 @@ class _ContextMenuRoute<T> extends PopupRoute<T> {
required _ContextMenuLocation contextMenuLocation,
this.barrierLabel,
_ContextMenuPreviewBuilderChildless? builder,
ui.ImageFilter? filter,
super.filter,
required Rect previousChildRect,
RouteSettings? settings,
super.settings,
}) : assert(actions != null && actions.isNotEmpty),
assert(contextMenuLocation != null),
_actions = actions,
_builder = builder,
_contextMenuLocation = contextMenuLocation,
_previousChildRect = previousChildRect,
super(
filter: filter,
settings: settings,
);
_previousChildRect = previousChildRect;

// Barrier color for a Cupertino modal barrier.
static const Color _kModalBarrierColor = Color(0x6604040F);
@@ -812,7 +806,6 @@ class _ContextMenuRoute<T> extends PopupRoute<T> {
// animating out.
class _ContextMenuRouteStatic extends StatefulWidget {
const _ContextMenuRouteStatic({
Key? key,
this.actions,
required this.child,
this.childGlobalKey,
@@ -821,8 +814,7 @@ class _ContextMenuRouteStatic extends StatefulWidget {
required this.orientation,
this.sheetGlobalKey,
}) : assert(contextMenuLocation != null),
assert(orientation != null),
super(key: key);
assert(orientation != null);

final List<Widget>? actions;
final Widget child;
@@ -1145,16 +1137,15 @@ class _ContextMenuRouteStaticState extends State<_ContextMenuRouteStatic> with T
// list of actions that are typically CupertinoContextMenuActions.
class _ContextMenuSheet extends StatelessWidget {
_ContextMenuSheet({
Key? key,
super.key,
required this.actions,
required _ContextMenuLocation contextMenuLocation,
required Orientation orientation,
}) : assert(actions != null && actions.isNotEmpty),
assert(contextMenuLocation != null),
assert(orientation != null),
_contextMenuLocation = contextMenuLocation,
_orientation = orientation,
super(key: key);
_orientation = orientation;

final List<Widget> actions;
final _ContextMenuLocation _contextMenuLocation;
5 changes: 2 additions & 3 deletions packages/flutter/lib/src/cupertino/context_menu_action.dart
Original file line number Diff line number Diff line change
@@ -14,16 +14,15 @@ import 'colors.dart';
class CupertinoContextMenuAction extends StatefulWidget {
/// Construct a CupertinoContextMenuAction.
const CupertinoContextMenuAction({
Key? key,
super.key,
required this.child,
this.isDefaultAction = false,
this.isDestructiveAction = false,
this.onPressed,
this.trailingIcon,
}) : assert(child != null),
assert(isDefaultAction != null),
assert(isDestructiveAction != null),
super(key: key);
assert(isDestructiveAction != null);

/// The widget that will be placed inside the action.
final Widget child;
10 changes: 4 additions & 6 deletions packages/flutter/lib/src/cupertino/date_picker.dart
Original file line number Diff line number Diff line change
@@ -259,7 +259,7 @@ class CupertinoDatePicker extends StatefulWidget {
/// [dateOrder] determines the order of the columns inside [CupertinoDatePicker] in date mode.
/// Defaults to the locale's default date format/order.
CupertinoDatePicker({
Key? key,
super.key,
this.mode = CupertinoDatePickerMode.dateAndTime,
required this.onDateTimeChanged,
DateTime? initialDateTime,
@@ -278,8 +278,7 @@ class CupertinoDatePicker extends StatefulWidget {
assert(
minuteInterval > 0 && 60 % minuteInterval == 0,
'minute interval is not a positive integer factor of 60',
),
super(key: key) {
) {
assert(this.initialDateTime != null);
assert(
mode != CupertinoDatePickerMode.dateAndTime || minimumDate == null || !this.initialDateTime.isBefore(minimumDate!),
@@ -1525,7 +1524,7 @@ class CupertinoTimerPicker extends StatefulWidget {
/// [secondInterval] is the granularity of the second spinner. Must be a
/// positive integer factor of 60.
CupertinoTimerPicker({
Key? key,
super.key,
this.mode = CupertinoTimerPickerMode.hms,
this.initialTimerDuration = Duration.zero,
this.minuteInterval = 1,
@@ -1541,8 +1540,7 @@ class CupertinoTimerPicker extends StatefulWidget {
assert(secondInterval > 0 && 60 % secondInterval == 0),
assert(initialTimerDuration.inMinutes % minuteInterval == 0),
assert(initialTimerDuration.inSeconds % secondInterval == 0),
assert(alignment != null),
super(key: key);
assert(alignment != null);

/// The mode of the timer picker.
final CupertinoTimerPickerMode mode;
14 changes: 4 additions & 10 deletions packages/flutter/lib/src/cupertino/desktop_text_selection.dart
Original file line number Diff line number Diff line change
@@ -91,7 +91,6 @@ final TextSelectionControls cupertinoDesktopTextSelectionControls =
// Generates the child that's passed into CupertinoDesktopTextSelectionToolbar.
class _CupertinoDesktopTextSelectionControlsToolbar extends StatefulWidget {
const _CupertinoDesktopTextSelectionControlsToolbar({
Key? key,
required this.clipboardStatus,
required this.endpoints,
required this.globalEditableRegion,
@@ -102,7 +101,7 @@ class _CupertinoDesktopTextSelectionControlsToolbar extends StatefulWidget {
required this.selectionMidpoint,
required this.textLineHeight,
required this.lastSecondaryTapDownPosition,
}) : super(key: key);
});

final ClipboardStatusNotifier? clipboardStatus;
final List<TextSelectionPoint> endpoints;
@@ -228,11 +227,9 @@ class _CupertinoDesktopTextSelectionControlsToolbarState extends State<_Cupertin
class _CupertinoDesktopTextSelectionToolbar extends StatelessWidget {
/// Creates an instance of CupertinoTextSelectionToolbar.
const _CupertinoDesktopTextSelectionToolbar({
Key? key,
required this.anchor,
required this.children,
}) : assert(children.length > 0),
super(key: key);
}) : assert(children.length > 0);

/// The point at which the toolbar will attempt to position itself as closely
/// as possible.
@@ -318,15 +315,13 @@ const EdgeInsets _kToolbarButtonPadding = EdgeInsets.fromLTRB(
class _CupertinoDesktopTextSelectionToolbarButton extends StatefulWidget {
/// Creates an instance of CupertinoDesktopTextSelectionToolbarButton.
const _CupertinoDesktopTextSelectionToolbarButton({
Key? key,
required this.onPressed,
required this.child,
}) : super(key: key);
});

/// Create an instance of [CupertinoDesktopTextSelectionToolbarButton] whose child is
/// a [Text] widget styled like the default Mac context menu button.
_CupertinoDesktopTextSelectionToolbarButton.text({
Key? key,
required BuildContext context,
required this.onPressed,
required String text,
@@ -339,8 +334,7 @@ class _CupertinoDesktopTextSelectionToolbarButton extends StatefulWidget {
darkColor: CupertinoColors.white,
).resolveFrom(context),
),
),
super(key: key);
);

/// {@macro flutter.cupertino.CupertinoTextSelectionToolbarButton.onPressed}
final VoidCallback onPressed;
Loading