Unverified Commit 58ab556f authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

first part of applying sort_child_properties_last (#82387)

parent 64765d86
......@@ -442,8 +442,8 @@ class CupertinoScrollBehavior extends ScrollBehavior {
case TargetPlatform.macOS:
case TargetPlatform.windows:
return CupertinoScrollbar(
child: child,
controller: details.controller,
child: child,
);
case TargetPlatform.android:
case TargetPlatform.fuchsia:
......@@ -489,13 +489,13 @@ class _CupertinoAppState extends State<CupertinoApp> {
Widget _inspectorSelectButtonBuilder(BuildContext context, VoidCallback onPressed) {
return CupertinoButton.filled(
padding: EdgeInsets.zero,
onPressed: onPressed,
child: const Icon(
CupertinoIcons.search,
size: 28.0,
color: CupertinoColors.white,
),
padding: EdgeInsets.zero,
onPressed: onPressed,
);
}
......
......@@ -383,9 +383,9 @@ class _CupertinoContextMenuState extends State<CupertinoContextMenu> with Ticker
builder: (BuildContext context) {
return _DecoyChild(
beginRect: childRect,
child: widget.child,
controller: _openController,
endRect: _decoyChildEndRect,
child: widget.child,
);
},
);
......@@ -820,12 +820,12 @@ class _ContextMenuRoute<T> extends PopupRoute<T> {
// in the final position.
return _ContextMenuRouteStatic(
actions: _actions,
child: _builder!(context, animation),
childGlobalKey: _childGlobalKey,
contextMenuLocation: _contextMenuLocation,
onDismiss: _onDismiss,
orientation: orientation,
sheetGlobalKey: _sheetGlobalKey,
child: _builder!(context, animation),
);
},
);
......
......@@ -344,9 +344,9 @@ class CupertinoAlertDialog extends StatelessWidget {
);
if (actions.isNotEmpty) {
actionSection = _CupertinoAlertActionSection(
children: actions,
scrollController: actionScrollController,
isActionSheet: false,
children: actions,
);
}
......@@ -646,10 +646,10 @@ class CupertinoActionSheet extends StatelessWidget {
);
}
return _CupertinoAlertActionSection(
children: actions!,
scrollController: actionScrollController,
hasCancelButton: cancelButton != null,
isActionSheet: true,
children: actions!,
);
}
......@@ -708,9 +708,9 @@ class CupertinoActionSheet extends StatelessWidget {
vertical: _kActionSheetEdgeVerticalPadding,
),
child: Column(
children: children,
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: children,
),
),
),
......@@ -788,8 +788,8 @@ class CupertinoActionSheetAction extends StatelessWidget {
),
child: DefaultTextStyle(
style: style,
child: child,
textAlign: TextAlign.center,
child: child,
),
),
),
......
......@@ -1076,9 +1076,9 @@ class _NavigationBarStaticComponents {
route.fullscreenDialog
) {
leadingContent = CupertinoButton(
child: const Text('Close'),
padding: EdgeInsets.zero,
onPressed: () { route.navigator!.maybePop(); },
child: const Text('Close'),
);
}
......@@ -1318,6 +1318,7 @@ class CupertinoNavigationBarBackButton extends StatelessWidget {
}
return CupertinoButton(
padding: EdgeInsets.zero,
child: Semantics(
container: true,
excludeSemantics: true,
......@@ -1345,7 +1346,6 @@ class CupertinoNavigationBarBackButton extends StatelessWidget {
),
),
),
padding: EdgeInsets.zero,
onPressed: () {
if (onPressed != null) {
onPressed!();
......
......@@ -265,8 +265,8 @@ mixin CupertinoRouteTransitionMixin<T> on PageRoute<T> {
return CupertinoFullscreenDialogTransition(
primaryRouteAnimation: animation,
secondaryRouteAnimation: secondaryAnimation,
child: child,
linearTransition: linearTransition,
child: child,
);
} else {
return CupertinoPageTransition(
......@@ -1227,8 +1227,8 @@ Widget _buildCupertinoDialogTransitions(BuildContext context, Animation<double>
return FadeTransition(
opacity: fadeAnimation,
child: ScaleTransition(
child: child,
scale: animation.drive(_dialogScaleTween),
child: child,
),
);
}
......
......@@ -394,21 +394,24 @@ class _CupertinoSearchTextFieldState extends State<CupertinoSearchTextField>
);
final Widget prefix = Padding(
padding: widget.prefixInsets,
child: IconTheme(
data: iconThemeData,
child: widget.prefixIcon,
),
padding: widget.prefixInsets,
);
final Widget suffix = Padding(
padding: widget.suffixInsets,
child: CupertinoButton(
child: IconTheme(child: widget.suffixIcon, data: iconThemeData),
onPressed: widget.onSuffixTap ?? _defaultOnSuffixTap,
minSize: 0,
padding: EdgeInsets.zero,
child: IconTheme(
data: iconThemeData,
child: widget.suffixIcon,
),
),
padding: widget.suffixInsets,
);
return CupertinoTextField(
......
......@@ -409,11 +409,11 @@ class _SegmentedControlState<T extends Object> extends State<CupertinoSegmentedC
}
final Widget box = _SegmentedControlRenderWidget<T>(
children: _gestureChildren,
selectedIndex: selectedIndex,
pressedIndex: pressedIndex,
backgroundColors: _backgroundColors,
borderColor: _borderColor!,
children: _gestureChildren,
);
return Padding(
......
......@@ -687,11 +687,11 @@ class _SegmentedControlState<T> extends State<CupertinoSlidingSegmentedControl<T
animation: thumbScaleAnimation,
builder: (BuildContext context, Widget? child) {
return _SegmentedControlRenderWidget<T>(
children: children,
highlightedIndex: highlightedIndex,
thumbColor: CupertinoDynamicColor.resolve(widget.thumbColor, context),
thumbScale: thumbScaleAnimation.value,
state: this,
children: children,
);
},
),
......
......@@ -713,8 +713,8 @@ class MaterialScrollBehavior extends ScrollBehavior {
case TargetPlatform.macOS:
case TargetPlatform.windows:
return Scrollbar(
child: child,
controller: details.controller,
child: child,
);
case TargetPlatform.android:
case TargetPlatform.fuchsia:
......@@ -737,9 +737,9 @@ class MaterialScrollBehavior extends ScrollBehavior {
case TargetPlatform.android:
case TargetPlatform.fuchsia:
return GlowingOverscrollIndicator(
child: child,
axisDirection: details.direction,
color: Theme.of(context).colorScheme.secondary,
child: child,
);
}
}
......@@ -770,9 +770,9 @@ class _MaterialAppState extends State<MaterialApp> {
Widget _inspectorSelectButtonBuilder(BuildContext context, VoidCallback onPressed) {
return FloatingActionButton(
child: const Icon(Icons.search),
onPressed: onPressed,
mini: true,
child: const Icon(Icons.search),
);
}
......
......@@ -901,8 +901,8 @@ class _AppBarState extends State<AppBar> {
if (!widget.excludeHeaderSemantics) {
title = Semantics(
namesRoute: namesRoute,
child: title,
header: true,
child: title,
);
}
......@@ -1186,7 +1186,10 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
title: title,
actions: actions,
flexibleSpace: (title == null && flexibleSpace != null && !excludeHeaderSemantics)
? Semantics(child: flexibleSpace, header: true)
? Semantics(
header: true,
child: flexibleSpace,
)
: flexibleSpace,
bottom: bottom,
elevation: forceElevated || isScrolledUnder ? elevation : 0.0,
......
......@@ -188,13 +188,13 @@ class ButtonBar extends StatelessWidget {
mainAxisAlignment: alignment ?? barTheme.alignment ?? MainAxisAlignment.end,
mainAxisSize: mainAxisSize ?? barTheme.mainAxisSize ?? MainAxisSize.max,
overflowDirection: overflowDirection ?? barTheme.overflowDirection ?? VerticalDirection.down,
overflowButtonSpacing: overflowButtonSpacing,
children: children.map<Widget>((Widget child) {
return Padding(
padding: EdgeInsets.symmetric(horizontal: paddingUnit),
child: child,
);
}).toList(),
overflowButtonSpacing: overflowButtonSpacing,
),
);
switch (buttonTheme.layoutBehavior) {
......
......@@ -1982,14 +1982,14 @@ class _RawChipState extends State<RawChip> with TickerProviderStateMixin<RawChip
child: widget.label,
),
avatar: AnimatedSwitcher(
child: widget.avatar,
duration: _kDrawerDuration,
switchInCurve: Curves.fastOutSlowIn,
child: widget.avatar,
),
deleteIcon: AnimatedSwitcher(
child: _buildDeleteIcon(context, theme, chipTheme, deleteIconKey),
duration: _kDrawerDuration,
switchInCurve: Curves.fastOutSlowIn,
child: _buildDeleteIcon(context, theme, chipTheme, deleteIconKey),
),
brightness: chipTheme.brightness,
padding: (widget.padding ?? chipTheme.padding).resolve(textDirection),
......@@ -2028,9 +2028,9 @@ class _RawChipState extends State<RawChip> with TickerProviderStateMixin<RawChip
result = _ChipRedirectingHitDetectionWidget(
constraints: constraints,
child: Center(
child: result,
widthFactor: 1.0,
heightFactor: 1.0,
child: result,
),
);
return Semantics(
......
......@@ -790,8 +790,8 @@ class DataTable extends StatelessWidget {
if (onRowTap != null) {
contents = TableRowInkWell(
onTap: onRowTap,
child: contents,
overlayColor: overlayColor,
child: contents,
);
}
return TableCell(
......@@ -915,14 +915,14 @@ class DataTable extends StatelessWidget {
onLongPress: onLongPress,
onTapCancel: onTapCancel,
onTapDown: onTapDown,
child: label,
overlayColor: overlayColor,
child: label,
);
} else if (onSelectChanged != null) {
label = TableRowInkWell(
onTap: onSelectChanged,
child: label,
overlayColor: overlayColor,
child: label,
);
}
return label;
......
......@@ -528,12 +528,12 @@ class _DatePickerDialogState extends State<DatePickerDialog> with RestorationMix
spacing: 8,
children: <Widget>[
TextButton(
child: Text(widget.cancelText ?? localizations.cancelButtonLabel),
onPressed: _handleCancel,
child: Text(widget.cancelText ?? localizations.cancelButtonLabel),
),
TextButton(
child: Text(widget.confirmText ?? localizations.okButtonLabel),
onPressed: _handleOk,
child: Text(widget.confirmText ?? localizations.okButtonLabel),
),
],
),
......@@ -630,6 +630,8 @@ class _DatePickerDialogState extends State<DatePickerDialog> with RestorationMix
final Size dialogSize = _dialogSize(context) * textScaleFactor;
return Dialog(
insetPadding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 24.0),
clipBehavior: Clip.antiAlias,
child: AnimatedContainer(
width: dialogSize.width,
height: dialogSize.height,
......@@ -673,8 +675,6 @@ class _DatePickerDialogState extends State<DatePickerDialog> with RestorationMix
}),
),
),
insetPadding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 24.0),
clipBehavior: Clip.antiAlias,
);
}
}
......@@ -1512,6 +1512,10 @@ class _DateRangePickerDialogState extends State<DateRangePickerDialog> with Rest
}
return Dialog(
insetPadding: insetPadding,
shape: shape,
elevation: elevation,
clipBehavior: Clip.antiAlias,
child: AnimatedContainer(
width: size.width,
height: size.height,
......@@ -1526,10 +1530,6 @@ class _DateRangePickerDialogState extends State<DateRangePickerDialog> with Rest
}),
),
),
insetPadding: insetPadding,
shape: shape,
elevation: elevation,
clipBehavior: Clip.antiAlias,
);
}
}
......@@ -1607,6 +1607,7 @@ class _CalendarRangePickerDialog extends StatelessWidget {
const SizedBox(width: 8),
],
bottom: PreferredSize(
preferredSize: const Size(double.infinity, 64),
child: Row(children: <Widget>[
SizedBox(width: MediaQuery.of(context).size.width < 360 ? 42 : 72),
Expanded(
......@@ -1654,7 +1655,6 @@ class _CalendarRangePickerDialog extends StatelessWidget {
child: entryModeButton!,
),
]),
preferredSize: const Size(double.infinity, 64),
),
),
body: _CalendarDateRangePicker(
......@@ -2725,12 +2725,12 @@ class _InputDateRangePickerDialog extends StatelessWidget {
spacing: 8,
children: <Widget>[
TextButton(
child: Text(cancelText ?? localizations.cancelButtonLabel),
onPressed: onCancel,
child: Text(cancelText ?? localizations.cancelButtonLabel),
),
TextButton(
child: Text(confirmText ?? localizations.okButtonLabel),
onPressed: onConfirm,
child: Text(confirmText ?? localizations.okButtonLabel),
),
],
),
......
......@@ -301,8 +301,8 @@ class DayPicker extends StatelessWidget {
onTap: () {
onChanged(dayToBuild);
},
child: dayWidget,
dragStartBehavior: dragStartBehavior,
child: dayWidget,
);
}
......
......@@ -507,9 +507,9 @@ class AlertDialog extends StatelessWidget {
child: DefaultTextStyle(
style: titleTextStyle ?? dialogTheme.titleTextStyle ?? theme.textTheme.headline6!,
child: Semantics(
child: title,
namesRoute: label == null,
container: true,
child: title,
),
),
);
......
......@@ -176,9 +176,9 @@ class _DropdownMenuItemButtonState<T> extends State<_DropdownMenuItemButton<T>>
child = InkWell(
autofocus: widget.itemIndex == widget.route.selectedIndex,
enableFeedback: widget.enableFeedback,
child: child,
onTap: _handleOnTap,
onFocusChange: _handleFocusChange,
child: child,
);
}
child = FadeTransition(opacity: opacity, child: child);
......
......@@ -309,7 +309,9 @@ class _ExpansionTileState extends State<ExpansionTile> with SingleTickerProvider
final bool shouldRemoveChildren = closed && !widget.maintainState;
final Widget result = Offstage(
offstage: closed,
child: TickerMode(
enabled: !closed,
child: Padding(
padding: widget.childrenPadding ?? EdgeInsets.zero,
child: Column(
......@@ -317,9 +319,7 @@ class _ExpansionTileState extends State<ExpansionTile> with SingleTickerProvider
children: widget.children,
),
),
enabled: !closed,
),
offstage: closed,
);
return AnimatedBuilder(
......
......@@ -337,13 +337,13 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
final double blurAmount = (constraints.maxHeight - settings.maxExtent) / 10;
children.add(Positioned.fill(
child: BackdropFilter(
child: Container(
color: Colors.transparent,
),
filter: ui.ImageFilter.blur(
sigmaX: blurAmount,
sigmaY: blurAmount,
),
child: Container(
color: Colors.transparent,
),
),
));
}
......
......@@ -499,8 +499,8 @@ class FloatingActionButton extends StatelessWidget {
clipBehavior: clipBehavior,
focusNode: focusNode,
autofocus: autofocus,
child: child,
enableFeedback: enableFeedback,
child: child,
);
if (tooltip != null) {
......
......@@ -381,7 +381,6 @@ class IconButton extends StatelessWidget {
onTap: onPressed,
mouseCursor: mouseCursor,
enableFeedback: enableFeedback,
child: result,
focusColor: focusColor ?? theme.focusColor,
hoverColor: hoverColor ?? theme.hoverColor,
highlightColor: highlightColor ?? theme.highlightColor,
......@@ -391,6 +390,7 @@ class IconButton extends StatelessWidget {
(iconSize + math.min(padding.horizontal, padding.vertical)) * 0.7,
// x 0.5 for diameter -> radius and + 40% overflow derived from other Material apps.
),
child: result,
),
);
}
......
......@@ -580,7 +580,6 @@ class InkResponse extends StatelessWidget {
Widget build(BuildContext context) {
final _ParentInkResponseState? parentState = _ParentInkResponseProvider.of(context);
return _InkResponseStateWidget(
child: child,
onTap: onTap,
onTapDown: onTapDown,
onTapCancel: onTapCancel,
......@@ -609,6 +608,7 @@ class InkResponse extends StatelessWidget {
parentState: parentState,
getRectCallback: getRectCallback,
debugCheckContext: debugCheckContext,
child: child,
);
}
......
......@@ -385,8 +385,8 @@ class _MaterialState extends State<Material> with TickerProviderStateMixin {
key: _inkFeatureRenderer,
absorbHitTest: widget.type != MaterialType.transparency,
color: backgroundColor,
child: contents,
vsync: this,
child: contents,
),
);
......@@ -445,19 +445,19 @@ class _MaterialState extends State<Material> with TickerProviderStateMixin {
required Widget contents,
}) {
final _ShapeBorderPaint child = _ShapeBorderPaint(
child: contents,
shape: shape,
child: contents,
);
if (clipBehavior == Clip.none) {
return child;
}
return ClipPath(
child: child,
clipper: ShapeBorderClipper(
shape: shape,
textDirection: Directionality.maybeOf(context),
),
clipBehavior: clipBehavior,
child: child,
);
}
......@@ -781,11 +781,6 @@ class _MaterialInteriorState extends AnimatedWidgetBaseState<_MaterialInterior>
final ShapeBorder shape = _border!.evaluate(animation)!;
final double elevation = _elevation!.evaluate(animation);
return PhysicalShape(
child: _ShapeBorderPaint(
child: widget.child,
shape: shape,
borderOnForeground: widget.borderOnForeground,
),
clipper: ShapeBorderClipper(
shape: shape,
textDirection: Directionality.maybeOf(context),
......@@ -794,6 +789,11 @@ class _MaterialInteriorState extends AnimatedWidgetBaseState<_MaterialInterior>
elevation: elevation,
color: ElevationOverlay.applyOverlay(context, widget.color, elevation),
shadowColor: _shadowColor!.evaluate(animation)!,
child: _ShapeBorderPaint(
shape: shape,
borderOnForeground: widget.borderOnForeground,
child: widget.child,
),
);
}
}
......@@ -812,9 +812,9 @@ class _ShapeBorderPaint extends StatelessWidget {
@override
Widget build(BuildContext context) {
return CustomPaint(
child: child,
painter: borderOnForeground ? null : _ShapeBorderPainter(shape, Directionality.maybeOf(context)),
foregroundPainter: borderOnForeground ? _ShapeBorderPainter(shape, Directionality.maybeOf(context)) : null,
child: child,
);
}
}
......
......@@ -427,9 +427,9 @@ class MaterialButton extends StatelessWidget {
focusNode: focusNode,
autofocus: autofocus,
animationDuration: buttonTheme.getAnimationDuration(this),
child: child,
materialTapTargetSize: materialTapTargetSize ?? theme.materialTapTargetSize,
disabledElevation: disabledElevation ?? 0.0,
child: child,
);
}
......
......@@ -1169,8 +1169,8 @@ class PopupMenuButtonState<T> extends State<PopupMenuButton<T>> {
child: InkWell(
onTap: widget.enabled ? showButtonMenu : null,
canRequestFocus: _canRequestFocus,
child: widget.child,
enableFeedback: enableFeedback,
child: widget.child,
),
);
......
......@@ -491,8 +491,8 @@ class _ReorderableListViewState extends State<ReorderableListView> {
final double animValue = Curves.easeInOut.transform(animation.value);
final double elevation = lerpDouble(0, 6, animValue)!;
return Material(
child: child,
elevation: elevation,
child: child,
);
},
child: child,
......
......@@ -2919,13 +2919,13 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
DrawerController(
key: _endDrawerKey,
alignment: DrawerAlignment.end,
child: widget.endDrawer!,
drawerCallback: _endDrawerOpenedCallback,
dragStartBehavior: widget.drawerDragStartBehavior,
scrimColor: widget.drawerScrimColor,
edgeDragWidth: widget.drawerEdgeDragWidth,
enableOpenDragGesture: widget.endDrawerEnableOpenDragGesture,
isDrawerOpen: _endDrawerOpened.value,
child: widget.endDrawer!,
),
_ScaffoldSlot.endDrawer,
// remove the side padding from the side we're not touching
......@@ -2945,13 +2945,13 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
DrawerController(
key: _drawerKey,
alignment: DrawerAlignment.start,
child: widget.drawer!,
drawerCallback: _drawerOpenedCallback,
dragStartBehavior: widget.drawerDragStartBehavior,
scrimColor: widget.drawerScrimColor,
edgeDragWidth: widget.drawerEdgeDragWidth,
enableOpenDragGesture: widget.drawerEnableOpenDragGesture,
isDrawerOpen: _drawerOpened.value,
child: widget.drawer!,
),
_ScaffoldSlot.drawer,
// remove the side padding from the side we're not touching
......@@ -3185,11 +3185,11 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
_addIfNonNull(
children,
_FloatingActionButtonTransition(
child: widget.floatingActionButton,
fabMoveAnimation: _floatingActionButtonMoveController,
fabMotionAnimator: _floatingActionButtonAnimator,
geometryNotifier: _geometryNotifier,
currentController: _floatingActionButtonVisibilityController,
child: widget.floatingActionButton,
),
_ScaffoldSlot.floatingActionButton,
removeLeftPadding: true,
......@@ -3253,7 +3253,6 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
color: widget.backgroundColor ?? themeData.scaffoldBackgroundColor,
child: AnimatedBuilder(animation: _floatingActionButtonMoveController, builder: (BuildContext context, Widget? child) {
return CustomMultiChildLayout(
children: children,
delegate: _ScaffoldLayout(
extendBody: _extendBody,
extendBodyBehindAppBar: widget.extendBodyBehindAppBar,
......@@ -3268,6 +3267,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
isSnackBarFloating: isSnackBarFloating,
snackBarWidth: snackBarWidth,
),
children: children,
);
}),
),
......
......@@ -176,7 +176,6 @@ class _ScrollbarState extends State<Scrollbar> {
Widget build(BuildContext context) {
if (_useCupertinoScrollbar) {
return CupertinoScrollbar(
child: widget.child,
isAlwaysShown: widget.isAlwaysShown ?? false,
thickness: widget.thickness ?? CupertinoScrollbar.defaultThickness,
thicknessWhileDragging: widget.thickness ?? CupertinoScrollbar.defaultThicknessWhileDragging,
......@@ -184,10 +183,10 @@ class _ScrollbarState extends State<Scrollbar> {
radiusWhileDragging: widget.radius ?? CupertinoScrollbar.defaultRadiusWhileDragging,
controller: widget.controller,
notificationPredicate: widget.notificationPredicate,
child: widget.child,
);
}
return _MaterialScrollbar(
child: widget.child,
controller: widget.controller,
isAlwaysShown: widget.isAlwaysShown,
showTrackOnHover: widget.showTrackOnHover,
......@@ -196,6 +195,7 @@ class _ScrollbarState extends State<Scrollbar> {
radius: widget.radius,
notificationPredicate: widget.notificationPredicate,
interactive: widget.interactive,
child: widget.child,
);
}
}
......
......@@ -632,8 +632,8 @@ class _SnackBarState extends State<SnackBar> {
}
return Hero(
child: ClipRect(child: snackBarTransition),
tag: '<SnackBar Hero tag - ${widget.content}>',
child: ClipRect(child: snackBarTransition),
);
}
}
......@@ -119,8 +119,8 @@ class Tab extends StatelessWidget implements PreferredSizeWidget{
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
child: icon,
margin: iconMargin,
child: icon,
),
_buildLabelText(),
],
......@@ -130,8 +130,8 @@ class Tab extends StatelessWidget implements PreferredSizeWidget{
return SizedBox(
height: height,
child: Center(
child: label,
widthFactor: 1.0,
child: label,
),
);
}
......
......@@ -227,8 +227,8 @@ class _AnimatedThemeState extends AnimatedWidgetBaseState<AnimatedTheme> {
@override
Widget build(BuildContext context) {
return Theme(
child: widget.child,
data: _data!.evaluate(animation),
child: widget.child,
);
}
......
......@@ -199,8 +199,8 @@ class _AccountDetailsState extends State<_AccountDetails> with SingleTickerProvi
if (widget.onTap != null) {
accountDetails = InkWell(
onTap: widget.onTap,
child: accountDetails,
excludeFromSemantics: true,
child: accountDetails,
);
}
......
......@@ -123,13 +123,13 @@ class _AnimatedSizeState
@override
Widget build(BuildContext context) {
return _AnimatedSize(
child: widget.child,
alignment: widget.alignment,
curve: widget.curve,
duration: widget.duration,
reverseDuration: widget.reverseDuration,
vsync: this,
clipBehavior: widget.clipBehavior,
child: widget.child,
);
}
}
......
......@@ -273,11 +273,11 @@ class AnimatedSwitcher extends StatefulWidget {
/// This is an [AnimatedSwitcherLayoutBuilder] function.
static Widget defaultLayoutBuilder(Widget? currentChild, List<Widget> previousChildren) {
return Stack(
alignment: Alignment.center,
children: <Widget>[
...previousChildren,
if (currentChild != null) currentChild,
],
alignment: Alignment.center,
);
}
......
......@@ -1592,8 +1592,8 @@ class _WidgetsAppState extends State<WidgetsApp> with WidgetsBindingObserver {
assert(() {
if (widget.debugShowWidgetInspector || WidgetsApp.debugShowWidgetInspectorOverride) {
result = WidgetInspector(
child: result,
selectButtonBuilder: widget.inspectorSelectButtonBuilder,
child: result,
);
}
if (widget.debugShowCheckedModeBanner && WidgetsApp.debugAllowBannerOverride) {
......
......@@ -345,10 +345,10 @@ class CheckedModeBanner extends StatelessWidget {
Widget result = child;
assert(() {
result = Banner(
child: result,
message: 'DEBUG',
textDirection: TextDirection.ltr,
location: BannerLocation.topEnd,
child: result,
);
return true;
}());
......
......@@ -2653,11 +2653,11 @@ class UnconstrainedBox extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ConstraintsTransformBox(
child: child,
textDirection: textDirection,
alignment: alignment,
clipBehavior: clipBehavior,
constraintsTransform: _axisToTransform(constrainedAxis),
child: child,
);
}
......
......@@ -431,7 +431,7 @@ class Container extends StatelessWidget {
current = Padding(padding: margin!, child: current);
if (transform != null)
current = Transform(transform: transform!, child: current, alignment: transformAlignment);
current = Transform(transform: transform!, alignment: transformAlignment, child: current);
return current!;
}
......
......@@ -618,8 +618,8 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin
onVerticalDragUpdate: _directionIsXAxis ? null : _handleDragUpdate,
onVerticalDragEnd: _directionIsXAxis ? null : _handleDragEnd,
behavior: widget.behavior,
child: content,
dragStartBehavior: widget.dragStartBehavior,
child: content,
);
}
}
......@@ -1007,8 +1007,8 @@ class _DragAvatar<T extends Object> extends Drag {
left: _lastOffset!.dx - overlayTopLeft.dx,
top: _lastOffset!.dy - overlayTopLeft.dy,
child: IgnorePointer(
child: feedback,
ignoringSemantics: ignoringFeedbackSemantics,
child: feedback,
),
);
}
......
......@@ -335,8 +335,8 @@ class _DraggableScrollableSheetState extends State<DraggableScrollableSheet> {
_extent.availablePixels = widget.maxChildSize * constraints.biggest.height;
final Widget sheet = FractionallySizedBox(
heightFactor: _extent.currentExtent,
child: widget.builder(context, _scrollController),
alignment: Alignment.bottomCenter,
child: widget.builder(context, _scrollController),
);
return widget.expand ? SizedBox.expand(child: sheet) : sheet;
},
......@@ -554,7 +554,7 @@ class DraggableScrollableActuator extends StatelessWidget {
@override
Widget build(BuildContext context) {
return _InheritedResetNotifier(child: child, notifier: _notifier);
return _InheritedResetNotifier(notifier: _notifier, child: child);
}
}
......
......@@ -772,7 +772,6 @@ class _AnimatedContainerState extends AnimatedWidgetBaseState<AnimatedContainer>
Widget build(BuildContext context) {
final Animation<double> animation = this.animation;
return Container(
child: widget.child,
alignment: _alignment?.evaluate(animation),
padding: _padding?.evaluate(animation),
decoration: _decoration?.evaluate(animation),
......@@ -782,6 +781,7 @@ class _AnimatedContainerState extends AnimatedWidgetBaseState<AnimatedContainer>
transform: _transform?.evaluate(animation),
transformAlignment: _transformAlignment?.evaluate(animation),
clipBehavior: widget.clipBehavior,
child: widget.child,
);
}
......@@ -1248,13 +1248,13 @@ class _AnimatedPositionedState extends AnimatedWidgetBaseState<AnimatedPositione
@override
Widget build(BuildContext context) {
return Positioned(
child: widget.child,
left: _left?.evaluate(animation),
top: _top?.evaluate(animation),
right: _right?.evaluate(animation),
bottom: _bottom?.evaluate(animation),
width: _width?.evaluate(animation),
height: _height?.evaluate(animation),
child: widget.child,
);
}
......@@ -1385,13 +1385,13 @@ class _AnimatedPositionedDirectionalState extends AnimatedWidgetBaseState<Animat
assert(debugCheckHasDirectionality(context));
return Positioned.directional(
textDirection: Directionality.of(context),
child: widget.child,
start: _start?.evaluate(animation),
top: _top?.evaluate(animation),
end: _end?.evaluate(animation),
bottom: _bottom?.evaluate(animation),
width: _width?.evaluate(animation),
height: _height?.evaluate(animation),
child: widget.child,
);
}
......@@ -1532,8 +1532,8 @@ class _AnimatedOpacityState extends ImplicitlyAnimatedWidgetState<AnimatedOpacit
Widget build(BuildContext context) {
return FadeTransition(
opacity: _opacityAnimation,
child: widget.child,
alwaysIncludeSemantics: widget.alwaysIncludeSemantics,
child: widget.child,
);
}
}
......@@ -1919,7 +1919,6 @@ class _AnimatedPhysicalModelState extends AnimatedWidgetBaseState<AnimatedPhysic
@override
Widget build(BuildContext context) {
return PhysicalModel(
child: widget.child,
shape: widget.shape,
clipBehavior: widget.clipBehavior,
borderRadius: _borderRadius!.evaluate(animation),
......@@ -1928,6 +1927,7 @@ class _AnimatedPhysicalModelState extends AnimatedWidgetBaseState<AnimatedPhysic
shadowColor: widget.animateShadowColor
? _shadowColor!.evaluate(animation)!
: widget.shadowColor,
child: widget.child,
);
}
}
......@@ -93,7 +93,7 @@ class ListWheelChildListDelegate extends ListWheelChildDelegate {
Widget? build(BuildContext context, int index) {
if (index < 0 || index >= children.length)
return null;
return IndexedSemantics(child: children[index], index: index);
return IndexedSemantics(index: index, child: children[index]);
}
@override
......@@ -139,7 +139,7 @@ class ListWheelChildLoopingListDelegate extends ListWheelChildDelegate {
Widget? build(BuildContext context, int index) {
if (children.isEmpty)
return null;
return IndexedSemantics(child: children[index % children.length], index: index);
return IndexedSemantics(index: index, child: children[index % children.length]);
}
@override
......@@ -182,11 +182,11 @@ class ListWheelChildBuilderDelegate extends ListWheelChildDelegate {
Widget? build(BuildContext context, int index) {
if (childCount == null) {
final Widget? child = builder(context, index);
return child == null ? null : IndexedSemantics(child: child, index: index);
return child == null ? null : IndexedSemantics(index: index, child: child);
}
if (index < 0 || index >= childCount!)
return null;
return IndexedSemantics(child: builder(context, index), index: index);
return IndexedSemantics(index: index, child: builder(context, index));
}
@override
......
......@@ -507,8 +507,8 @@ class OverlayState extends State<Overlay> with TickerProviderStateMixin {
}
return _Theatre(
skipCount: children.length - onstageCount,
children: children.reversed.toList(growable: false),
clipBehavior: widget.clipBehavior,
children: children.reversed.toList(growable: false),
);
}
......
......@@ -852,8 +852,8 @@ class SliverReorderableListState extends State<SliverReorderableList> with Ticke
return _ReorderableItem(
key: _ReorderableItemGlobalKey(child.key!, index, this),
index: index,
child: child,
capturedThemes: InheritedTheme.capture(from: context, to: overlay.context),
child: child,
);
}
......@@ -1221,11 +1221,11 @@ class _DragInfo extends Drag {
_DragItemProxy(
listState: listState,
index: index,
child: child,
size: itemSize,
animation: _proxyAnimation!,
position: dragPosition - dragOffset - _overlayOrigin(context),
proxyDecorator: proxyDecorator,
child: child,
),
);
}
......@@ -1270,14 +1270,14 @@ class _DragItemProxy extends StatelessWidget {
if (dropPosition != null) {
effectivePosition = Offset.lerp(dropPosition - overlayOrigin, effectivePosition, Curves.easeOut.transform(animation.value))!;
}
return Positioned(
return Positioned(
left: effectivePosition.dx,
top: effectivePosition.dy,
child: SizedBox(
width: size.width,
height: size.height,
child: child,
),
left: effectivePosition.dx,
top: effectivePosition.dy,
);
},
child: proxyChild,
......
......@@ -1823,9 +1823,9 @@ class RawDialogRoute<T> extends PopupRoute<T> {
@override
Widget buildPage(BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation) {
return Semantics(
child: _pageBuilder(context, animation, secondaryAnimation),
scopesRoute: true,
explicitChildNodes: true,
child: _pageBuilder(context, animation, secondaryAnimation),
);
}
......
......@@ -108,9 +108,9 @@ class ScrollBehavior {
case TargetPlatform.android:
case TargetPlatform.fuchsia:
return GlowingOverscrollIndicator(
child: child,
axisDirection: axisDirection,
color: _kDefaultGlowColor,
child: child,
);
}
}
......@@ -124,8 +124,8 @@ class ScrollBehavior {
case TargetPlatform.macOS:
case TargetPlatform.windows:
return RawScrollbar(
child: child,
controller: details.controller,
child: child,
);
case TargetPlatform.android:
case TargetPlatform.fuchsia:
......
......@@ -758,10 +758,10 @@ class ScrollableState extends State<Scrollable> with TickerProviderStateMixin, R
if (!widget.excludeFromSemantics) {
result = _ScrollSemantics(
key: _scrollSemanticsKey,
child: result,
position: position,
allowImplicitScrolling: _physics!.allowImplicitScrolling,
semanticChildCount: widget.semanticChildCount,
child: result,
);
}
......
......@@ -338,8 +338,8 @@ class SingleChildScrollView extends StatelessWidget {
return _SingleChildViewport(
axisDirection: axisDirection,
offset: offset,
child: contents,
clipBehavior: clipBehavior,
child: contents,
);
},
);
......
......@@ -470,7 +470,7 @@ class SliverChildBuilderDelegate extends SliverChildDelegate {
}
if (addAutomaticKeepAlives)
child = AutomaticKeepAlive(child: child);
return KeyedSubtree(child: child, key: key);
return KeyedSubtree(key: key, child: child);
}
@override
......@@ -734,7 +734,7 @@ class SliverChildListDelegate extends SliverChildDelegate {
}
if (addAutomaticKeepAlives)
child = AutomaticKeepAlive(child: child);
return KeyedSubtree(child: child, key: key);
return KeyedSubtree(key: key, child: child);
}
@override
......
......@@ -218,9 +218,9 @@ class Visibility extends StatelessWidget {
Widget result = child;
if (!maintainInteractivity) {
result = IgnorePointer(
child: child,
ignoring: !visible,
ignoringSemantics: !visible && !maintainSemantics,
child: child,
);
}
return Opacity(
......@@ -235,10 +235,10 @@ class Visibility extends StatelessWidget {
if (maintainState) {
Widget result = child;
if (!maintainAnimation)
result = TickerMode(child: child, enabled: visible);
result = TickerMode(enabled: visible, child: child);
return Offstage(
child: result,
offstage: !visible,
child: result,
);
}
assert(!maintainAnimation);
......@@ -473,7 +473,7 @@ class SliverVisibility extends StatelessWidget {
if (maintainState) {
Widget result = sliver;
if (!maintainAnimation)
result = TickerMode(child: sliver, enabled: visible);
result = TickerMode(enabled: visible, child: sliver);
return SliverOffstage(
sliver: result,
offstage: !visible,
......
......@@ -19,8 +19,8 @@ void main() {
testWidgets('Default layout minimum size', (WidgetTester tester) async {
await tester.pumpWidget(
boilerplate(child: const CupertinoButton(
child: Text('X', style: testStyle),
onPressed: null,
child: Text('X', style: testStyle),
)),
);
final RenderBox buttonBox = tester.renderObject(find.byType(CupertinoButton));
......@@ -35,9 +35,9 @@ void main() {
const double minSize = 60.0;
await tester.pumpWidget(
boilerplate(child: const CupertinoButton(
child: Text('X', style: testStyle),
onPressed: null,
minSize: minSize,
child: Text('X', style: testStyle),
)),
);
final RenderBox buttonBox = tester.renderObject(find.byType(CupertinoButton));
......@@ -51,8 +51,8 @@ void main() {
testWidgets('Size grows with text', (WidgetTester tester) async {
await tester.pumpWidget(
boilerplate(child: const CupertinoButton(
child: Text('XXXX', style: testStyle),
onPressed: null,
child: Text('XXXX', style: testStyle),
)),
);
final RenderBox buttonBox = tester.renderObject(find.byType(CupertinoButton));
......@@ -130,9 +130,9 @@ void main() {
testWidgets('Button with background is wider', (WidgetTester tester) async {
await tester.pumpWidget(boilerplate(child: const CupertinoButton(
child: Text('X', style: testStyle),
onPressed: null,
color: Color(0xFFFFFFFF),
child: Text('X', style: testStyle),
)));
final RenderBox buttonBox = tester.renderObject(find.byType(CupertinoButton));
expect(
......@@ -144,9 +144,9 @@ void main() {
testWidgets('Custom padding', (WidgetTester tester) async {
await tester.pumpWidget(boilerplate(child: const CupertinoButton(
child: Text('X', style: testStyle),
onPressed: null,
padding: EdgeInsets.all(100.0),
child: Text('X', style: testStyle),
)));
final RenderBox buttonBox = tester.renderObject(find.byType(CupertinoButton));
expect(
......@@ -185,8 +185,8 @@ void main() {
testWidgets("Disabled button doesn't animate", (WidgetTester tester) async {
await tester.pumpWidget(boilerplate(child: const CupertinoButton(
child: Text('Tap me'),
onPressed: null,
child: Text('Tap me'),
)));
expect(SchedulerBinding.instance!.transientCallbackCount, equals(0));
await tester.tap(find.byType(CupertinoButton));
......@@ -267,10 +267,10 @@ void main() {
testWidgets('Can specify colors', (WidgetTester tester) async {
await tester.pumpWidget(boilerplate(child: CupertinoButton(
child: const Text('Skeuomorph me'),
color: const Color(0x000000FF),
disabledColor: const Color(0x0000FF00),
onPressed: () { },
child: const Text('Skeuomorph me'),
)));
BoxDecoration boxDecoration = tester.widget<DecoratedBox>(
......@@ -280,10 +280,10 @@ void main() {
expect(boxDecoration.color, const Color(0x000000FF));
await tester.pumpWidget(boilerplate(child: const CupertinoButton(
child: Text('Skeuomorph me'),
color: Color(0x000000FF),
disabledColor: Color(0x0000FF00),
onPressed: null,
child: Text('Skeuomorph me'),
)));
boxDecoration = tester.widget<DecoratedBox>(
......@@ -308,10 +308,10 @@ void main() {
MediaQuery(
data: const MediaQueryData(platformBrightness: Brightness.dark),
child: boilerplate(child: CupertinoButton(
child: const Text('Skeuomorph me'),
color: bgColor,
disabledColor: inactive,
onPressed: () { },
child: const Text('Skeuomorph me'),
)),
),
);
......@@ -326,10 +326,10 @@ void main() {
MediaQuery(
data: const MediaQueryData(platformBrightness: Brightness.light),
child: boilerplate(child: const CupertinoButton(
child: Text('Skeuomorph me'),
color: bgColor,
disabledColor: inactive,
onPressed: null,
child: Text('Skeuomorph me'),
)),
),
);
......
......@@ -17,11 +17,11 @@ void main() {
final UniqueKey actionKey = UniqueKey();
final CupertinoContextMenuAction action = CupertinoContextMenuAction(
key: actionKey,
child: const Text('I am a CupertinoContextMenuAction'),
onPressed: onPressed,
trailingIcon: CupertinoIcons.home,
isDestructiveAction: isDestructiveAction,
isDefaultAction: isDefaultAction,
child: const Text('I am a CupertinoContextMenuAction'),
);
return CupertinoApp(
......
......@@ -127,7 +127,11 @@ void main() {
title: const Text('The Title'),
content: const Text('Content'),
actions: <Widget>[
CupertinoDialogAction(child: const Text('Cancel'), isDefaultAction: true, onPressed: () {}),
CupertinoDialogAction(
isDefaultAction: true,
onPressed: () {},
child: const Text('Cancel'),
),
const CupertinoDialogAction(child: Text('OK')),
],
),
......
......@@ -123,8 +123,8 @@ void main() {
child: MediaQuery(
data: const MediaQueryData(),
child: CupertinoFormSection(
children: <Widget>[CupertinoTextFormFieldRow()],
backgroundColor: backgroundColor,
children: <Widget>[CupertinoTextFormFieldRow()],
),
),
),
......@@ -142,8 +142,8 @@ void main() {
CupertinoApp(
home: Center(
child: CupertinoFormSection(
children: <Widget>[CupertinoTextFormFieldRow()],
clipBehavior: Clip.antiAlias,
children: <Widget>[CupertinoTextFormFieldRow()],
),
),
),
......
......@@ -18,8 +18,8 @@ void main() {
const CupertinoApp(
home: CupertinoNavigationBar(
leading: CupertinoButton(
child: Text('Something'),
onPressed: null,
child: Text('Something'),
),
middle: Text('Title'),
),
......@@ -133,7 +133,7 @@ void main() {
home: Align(
alignment: Alignment.topCenter,
child: CupertinoNavigationBar(
leading: const CupertinoButton(child: Text('Cheetah'), onPressed: null),
leading: const CupertinoButton(onPressed: null, child: Text('Cheetah')),
// Let the box take all the vertical space to test vertical padding but let
// the nav bar position it horizontally.
middle: Align(
......@@ -142,7 +142,7 @@ void main() {
widthFactor: 1.0,
child: const Text('Title'),
),
trailing: const CupertinoButton(child: Text('Puma'), onPressed: null),
trailing: const CupertinoButton(onPressed: null, child: Text('Puma')),
padding: const EdgeInsetsDirectional.only(
start: 10.0,
end: 20.0,
......@@ -245,11 +245,11 @@ void main() {
child: Align(
alignment: Alignment.topCenter,
child: CupertinoNavigationBar(
leading: CupertinoButton(child: Text('Cheetah'), onPressed: null),
leading: CupertinoButton(onPressed: null, child: Text('Cheetah')),
// Let the box take all the vertical space to test vertical padding but let
// the nav bar position it horizontally.
middle: Text('Title'),
trailing: CupertinoButton(child: Text('Puma'), onPressed: null),
trailing: CupertinoButton(onPressed: null, child: Text('Puma')),
padding: EdgeInsetsDirectional.only(
start: 10.0,
end: 20.0,
......
......@@ -182,9 +182,9 @@ void main() {
width: 300.0,
child: CupertinoPicker(
itemExtent: 15.0,
children: const <Widget>[Text('1'), Text('1')],
onSelectedItemChanged: (int i) {},
selectionOverlay: null,
children: const <Widget>[Text('1'), Text('1')],
),
),
),
......
......@@ -420,8 +420,8 @@ void main() {
await tester.pumpWidget(
const CupertinoApp(
home: CupertinoPageScaffold(
child: Center(),
backgroundColor: Color(0xFF010203),
child: Center(),
),
),
);
......
......@@ -58,10 +58,10 @@ void main() {
tabBar: _buildTabBar(),
tabBuilder: (BuildContext context, int index) {
return CustomPaint(
child: Text('Page ${index + 1}'),
painter: TestCallbackPainter(
onPaint: () { tabsPainted.add(index); },
),
child: Text('Page ${index + 1}'),
);
},
),
......@@ -248,10 +248,10 @@ void main() {
controller: controller,
tabBuilder: (BuildContext context, int index) {
return CustomPaint(
child: Text('Page ${index + 1}'),
painter: TestCallbackPainter(
onPaint: () { tabsPainted.add(index); },
),
child: Text('Page ${index + 1}'),
);
},
),
......@@ -284,10 +284,10 @@ void main() {
tabBar: _buildTabBar(),
tabBuilder: (BuildContext context, int index) {
return CustomPaint(
child: Text('Page ${index + 1}'),
painter: TestCallbackPainter(
onPaint: () { tabsPainted.add(index); },
),
child: Text('Page ${index + 1}'),
);
},
),
......@@ -303,10 +303,10 @@ void main() {
controller: CupertinoTabController(initialIndex: 1), // Programmatically change the tab now.
tabBuilder: (BuildContext context, int index) {
return CustomPaint(
child: Text('Page ${index + 1}'),
painter: TestCallbackPainter(
onPaint: () { tabsPainted.add(index); },
),
child: Text('Page ${index + 1}'),
);
},
),
......@@ -630,10 +630,10 @@ void main() {
controller: controller,
tabBuilder: (BuildContext context, int index) {
return CustomPaint(
child: Text('Page ${index + 1}'),
painter: TestCallbackPainter(
onPaint: () { tabsPainted.add(index); },
),
child: Text('Page ${index + 1}'),
);
},
),
......@@ -652,10 +652,10 @@ void main() {
controller: controller,
tabBuilder: (BuildContext context, int index) {
return CustomPaint(
child: Text('Page ${index + 1}'),
painter: TestCallbackPainter(
onPaint: () { tabsPainted.add(index); },
),
child: Text('Page ${index + 1}'),
);
},
),
......@@ -688,10 +688,10 @@ void main() {
controller: oldController,
tabBuilder: (BuildContext context, int index) {
return CustomPaint(
child: Text('Page ${index + 1}'),
painter: TestCallbackPainter(
onPaint: () { tabsPainted.add(index); },
),
child: Text('Page ${index + 1}'),
);
},
),
......@@ -710,10 +710,10 @@ void main() {
tabBuilder:
(BuildContext context, int index) {
return CustomPaint(
child: Text('Page ${index + 1}'),
painter: TestCallbackPainter(
onPaint: () { tabsPainted.add(index); },
),
child: Text('Page ${index + 1}'),
);
},
),
......
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