Getting rid of containers (#147432)
This pull request aims to make the Flutter framework more efficient, based on issue #147431.
This commit is contained in:
parent
77427f6608
commit
94a7151eb8
@ -120,26 +120,18 @@ class _CupertinoContextMenuActionState extends State<CupertinoContextMenuAction>
|
|||||||
),
|
),
|
||||||
child: Semantics(
|
child: Semantics(
|
||||||
button: true,
|
button: true,
|
||||||
child: Container(
|
child: ColoredBox(
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: _isPressed
|
color: _isPressed
|
||||||
? CupertinoDynamicColor.resolve(_kBackgroundColorPressed, context)
|
? CupertinoDynamicColor.resolve(_kBackgroundColorPressed, context)
|
||||||
: CupertinoDynamicColor.resolve(_kBackgroundColor, context),
|
: CupertinoDynamicColor.resolve(_kBackgroundColor, context),
|
||||||
),
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.fromLTRB(15.5, 8.0, 17.5, 8.0),
|
||||||
top: 8,
|
|
||||||
bottom: 8,
|
|
||||||
left: 15.5,
|
|
||||||
right: 17.5,
|
|
||||||
),
|
|
||||||
child: DefaultTextStyle(
|
child: DefaultTextStyle(
|
||||||
style: _textStyle,
|
style: _textStyle,
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Flexible(
|
Flexible(child: widget.child),
|
||||||
child: widget.child,
|
|
||||||
),
|
|
||||||
if (widget.trailingIcon != null)
|
if (widget.trailingIcon != null)
|
||||||
Icon(
|
Icon(
|
||||||
widget.trailingIcon,
|
widget.trailingIcon,
|
||||||
@ -153,6 +145,7 @@ class _CupertinoContextMenuActionState extends State<CupertinoContextMenuAction>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1050,10 +1050,11 @@ class _CupertinoDatePickerDateTimeState extends State<CupertinoDatePicker> {
|
|||||||
final List<Widget> pickers = <Widget>[];
|
final List<Widget> pickers = <Widget>[];
|
||||||
double totalColumnWidths = 4 * _kDatePickerPadSize;
|
double totalColumnWidths = 4 * _kDatePickerPadSize;
|
||||||
|
|
||||||
for (int i = 0; i < columnWidths.length; i++) {
|
for (final (int i, double width) in columnWidths.indexed) {
|
||||||
|
final (bool firstColumn, bool lastColumn) = (i == 0, i == columnWidths.length - 1);
|
||||||
double offAxisFraction = 0.0;
|
double offAxisFraction = 0.0;
|
||||||
Widget selectionOverlay = _centerSelectionOverlay;
|
Widget selectionOverlay = _centerSelectionOverlay;
|
||||||
if (i == 0) {
|
if (firstColumn) {
|
||||||
offAxisFraction = -_kMaximumOffAxisFraction * textDirectionFactor;
|
offAxisFraction = -_kMaximumOffAxisFraction * textDirectionFactor;
|
||||||
selectionOverlay = _startSelectionOverlay;
|
selectionOverlay = _startSelectionOverlay;
|
||||||
} else if (i >= 2 || columnWidths.length == 2) {
|
} else if (i >= 2 || columnWidths.length == 2) {
|
||||||
@ -1061,7 +1062,7 @@ class _CupertinoDatePickerDateTimeState extends State<CupertinoDatePicker> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EdgeInsets padding = const EdgeInsets.only(right: _kDatePickerPadSize);
|
EdgeInsets padding = const EdgeInsets.only(right: _kDatePickerPadSize);
|
||||||
if (i == columnWidths.length - 1) {
|
if (lastColumn) {
|
||||||
padding = padding.flipped;
|
padding = padding.flipped;
|
||||||
selectionOverlay = _endSelectionOverlay;
|
selectionOverlay = _endSelectionOverlay;
|
||||||
}
|
}
|
||||||
@ -1069,24 +1070,23 @@ class _CupertinoDatePickerDateTimeState extends State<CupertinoDatePicker> {
|
|||||||
padding = padding.flipped;
|
padding = padding.flipped;
|
||||||
}
|
}
|
||||||
|
|
||||||
totalColumnWidths += columnWidths[i] + (2 * _kDatePickerPadSize);
|
totalColumnWidths += width + (2 * _kDatePickerPadSize);
|
||||||
|
|
||||||
pickers.add(LayoutId(
|
pickers.add(LayoutId(
|
||||||
id: i,
|
id: i,
|
||||||
child: pickerBuilders[i](
|
child: pickerBuilders[i](
|
||||||
offAxisFraction,
|
offAxisFraction,
|
||||||
(BuildContext context, Widget? child) {
|
(BuildContext context, Widget? child) {
|
||||||
return Container(
|
late final Widget constrained = ConstrainedBox(
|
||||||
alignment: i == columnWidths.length - 1
|
constraints: BoxConstraints(maxWidth: width + _kDatePickerPadSize),
|
||||||
? alignCenterLeft
|
|
||||||
: alignCenterRight,
|
|
||||||
padding: padding,
|
|
||||||
child: Container(
|
|
||||||
alignment: i == columnWidths.length - 1 ? alignCenterLeft : alignCenterRight,
|
|
||||||
width: i == 0 || i == columnWidths.length - 1
|
|
||||||
? null
|
|
||||||
: columnWidths[i] + _kDatePickerPadSize,
|
|
||||||
child: child,
|
child: child,
|
||||||
|
);
|
||||||
|
|
||||||
|
return Padding(
|
||||||
|
padding: padding,
|
||||||
|
child: Align(
|
||||||
|
alignment: lastColumn ? alignCenterLeft : alignCenterRight,
|
||||||
|
child: firstColumn || lastColumn ? constrained : child,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -1453,7 +1453,8 @@ class _CupertinoDatePickerDateState extends State<CupertinoDatePicker> {
|
|||||||
final List<Widget> pickers = <Widget>[];
|
final List<Widget> pickers = <Widget>[];
|
||||||
double totalColumnWidths = 4 * _kDatePickerPadSize;
|
double totalColumnWidths = 4 * _kDatePickerPadSize;
|
||||||
|
|
||||||
for (int i = 0; i < columnWidths.length; i++) {
|
for (final (int i, double width) in columnWidths.indexed) {
|
||||||
|
final (bool firstColumn, bool lastColumn) = (i == 0, i == columnWidths.length - 1);
|
||||||
final double offAxisFraction = (i - 1) * 0.3 * textDirectionFactor;
|
final double offAxisFraction = (i - 1) * 0.3 * textDirectionFactor;
|
||||||
|
|
||||||
EdgeInsets padding = const EdgeInsets.only(right: _kDatePickerPadSize);
|
EdgeInsets padding = const EdgeInsets.only(right: _kDatePickerPadSize);
|
||||||
@ -1462,29 +1463,31 @@ class _CupertinoDatePickerDateState extends State<CupertinoDatePicker> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget selectionOverlay = _centerSelectionOverlay;
|
Widget selectionOverlay = _centerSelectionOverlay;
|
||||||
if (i == 0) {
|
if (firstColumn) {
|
||||||
selectionOverlay = _startSelectionOverlay;
|
selectionOverlay = _startSelectionOverlay;
|
||||||
} else if (i == columnWidths.length - 1) {
|
} else if (i == columnWidths.length - 1) {
|
||||||
selectionOverlay = _endSelectionOverlay;
|
selectionOverlay = _endSelectionOverlay;
|
||||||
}
|
}
|
||||||
|
|
||||||
totalColumnWidths += columnWidths[i] + (2 * _kDatePickerPadSize);
|
totalColumnWidths += width + (2 * _kDatePickerPadSize);
|
||||||
|
|
||||||
pickers.add(LayoutId(
|
pickers.add(LayoutId(
|
||||||
id: i,
|
id: i,
|
||||||
child: pickerBuilders[i](
|
child: pickerBuilders[i](
|
||||||
offAxisFraction,
|
offAxisFraction,
|
||||||
(BuildContext context, Widget? child) {
|
(BuildContext context, Widget? child) {
|
||||||
return Container(
|
return Padding(
|
||||||
alignment: i == columnWidths.length - 1
|
padding: firstColumn ? EdgeInsets.zero : padding,
|
||||||
? alignCenterLeft
|
child: Align(
|
||||||
: alignCenterRight,
|
alignment: lastColumn ? alignCenterLeft : alignCenterRight,
|
||||||
padding: i == 0 ? null : padding,
|
child: SizedBox(
|
||||||
child: Container(
|
width: width + _kDatePickerPadSize,
|
||||||
alignment: i == 0 ? alignCenterLeft : alignCenterRight,
|
child: Align(
|
||||||
width: columnWidths[i] + _kDatePickerPadSize,
|
alignment: firstColumn ? alignCenterLeft : alignCenterRight,
|
||||||
child: child,
|
child: child,
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
selectionOverlay,
|
selectionOverlay,
|
||||||
@ -1763,33 +1766,39 @@ class _CupertinoDatePickerMonthYearState extends State<CupertinoDatePicker> {
|
|||||||
final List<Widget> pickers = <Widget>[];
|
final List<Widget> pickers = <Widget>[];
|
||||||
double totalColumnWidths = 3 * _kDatePickerPadSize;
|
double totalColumnWidths = 3 * _kDatePickerPadSize;
|
||||||
|
|
||||||
for (int i = 0; i < columnWidths.length; i++) {
|
for (final (int i, double width) in columnWidths.indexed) {
|
||||||
final (bool first, bool last) = (i == 0, i == columnWidths.length - 1);
|
final (bool firstColumn, bool lastColumn) = (i == 0, i == columnWidths.length - 1);
|
||||||
final double offAxisFraction = textDirectionFactor * (first ? -0.3 : 0.5);
|
final double offAxisFraction = textDirectionFactor * (firstColumn ? -0.3 : 0.5);
|
||||||
|
|
||||||
totalColumnWidths += columnWidths[i] + (2 * _kDatePickerPadSize);
|
totalColumnWidths += width + (2 * _kDatePickerPadSize);
|
||||||
|
|
||||||
pickers.add(LayoutId(
|
pickers.add(LayoutId(
|
||||||
id: i,
|
id: i,
|
||||||
child: pickerBuilders[i](
|
child: pickerBuilders[i](
|
||||||
offAxisFraction,
|
offAxisFraction,
|
||||||
(BuildContext context, Widget? child) {
|
(BuildContext context, Widget? child) {
|
||||||
return Container(
|
final Widget contents = Align(
|
||||||
alignment: last ? alignCenterLeft : alignCenterRight,
|
alignment: lastColumn ? alignCenterLeft : alignCenterRight,
|
||||||
padding: switch (textDirectionFactor) {
|
child: SizedBox(
|
||||||
_ when first => null,
|
width: width + _kDatePickerPadSize,
|
||||||
-1 => const EdgeInsets.only(left: _kDatePickerPadSize),
|
child: Align(
|
||||||
_ => const EdgeInsets.only(right: _kDatePickerPadSize),
|
alignment: firstColumn ? alignCenterLeft : alignCenterRight,
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
alignment: first ? alignCenterLeft : alignCenterRight,
|
|
||||||
width: columnWidths[i] + _kDatePickerPadSize,
|
|
||||||
child: child,
|
child: child,
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
if (firstColumn) {
|
||||||
|
return contents;
|
||||||
|
}
|
||||||
|
|
||||||
|
const EdgeInsets padding = EdgeInsets.only(right: _kDatePickerPadSize);
|
||||||
|
return Padding(
|
||||||
|
padding: textDirectionFactor == -1 ? padding.flipped : padding,
|
||||||
|
child: contents,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
switch (last) {
|
switch (lastColumn) {
|
||||||
_ when first => _startSelectionOverlay,
|
_ when firstColumn => _startSelectionOverlay,
|
||||||
false => _centerSelectionOverlay,
|
false => _centerSelectionOverlay,
|
||||||
true => _endSelectionOverlay,
|
true => _endSelectionOverlay,
|
||||||
},
|
},
|
||||||
@ -2127,9 +2136,10 @@ class _CupertinoTimerPickerState extends State<CupertinoTimerPicker> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return IgnorePointer(
|
return IgnorePointer(
|
||||||
child: Container(
|
child: Padding(
|
||||||
alignment: AlignmentDirectional.centerStart.resolve(textDirection),
|
|
||||||
padding: padding.resolve(textDirection),
|
padding: padding.resolve(textDirection),
|
||||||
|
child: Align(
|
||||||
|
alignment: AlignmentDirectional.centerStart.resolve(textDirection),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: numberLabelHeight,
|
height: numberLabelHeight,
|
||||||
child: Baseline(
|
child: Baseline(
|
||||||
@ -2147,21 +2157,28 @@ class _CupertinoTimerPickerState extends State<CupertinoTimerPicker> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The picker has to be wider than its content, since the separators
|
// The picker has to be wider than its content, since the separators
|
||||||
// are part of the picker.
|
// are part of the picker.
|
||||||
Widget _buildPickerNumberLabel(String text, EdgeInsetsDirectional padding) {
|
Widget _buildPickerNumberLabel(String text, EdgeInsetsDirectional padding) {
|
||||||
return Container(
|
return SizedBox(
|
||||||
width: _kTimerPickerColumnIntrinsicWidth + padding.horizontal,
|
width: _kTimerPickerColumnIntrinsicWidth + padding.horizontal,
|
||||||
|
child: Padding(
|
||||||
padding: padding.resolve(textDirection),
|
padding: padding.resolve(textDirection),
|
||||||
|
child: Align(
|
||||||
alignment: AlignmentDirectional.centerStart.resolve(textDirection),
|
alignment: AlignmentDirectional.centerStart.resolve(textDirection),
|
||||||
child: Container(
|
child: SizedBox(
|
||||||
width: numberLabelWidth,
|
width: numberLabelWidth,
|
||||||
|
child: Align(
|
||||||
alignment: AlignmentDirectional.centerEnd.resolve(textDirection),
|
alignment: AlignmentDirectional.centerEnd.resolve(textDirection),
|
||||||
child: Text(text, softWrap: false, maxLines: 1, overflow: TextOverflow.visible),
|
child: Text(text, softWrap: false, maxLines: 1, overflow: TextOverflow.visible),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2508,9 +2525,23 @@ class _CupertinoTimerPickerState extends State<CupertinoTimerPicker> {
|
|||||||
),
|
),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget contents = SizedBox(
|
||||||
|
width: totalWidth,
|
||||||
|
height: _kPickerHeight,
|
||||||
|
child: DefaultTextStyle(
|
||||||
|
style: _textStyleFrom(context),
|
||||||
|
child: Row(children: columns.map((Widget child) => Expanded(child: child)).toList(growable: false)),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
final Color? color = CupertinoDynamicColor.maybeResolve(widget.backgroundColor, context);
|
||||||
|
if (color != null) {
|
||||||
|
contents = ColoredBox(color: color, child: contents);
|
||||||
|
}
|
||||||
|
|
||||||
final CupertinoThemeData themeData = CupertinoTheme.of(context);
|
final CupertinoThemeData themeData = CupertinoTheme.of(context);
|
||||||
// The native iOS picker's text scaling is fixed, so we will also fix it
|
|
||||||
// as well in our picker.
|
// Text scaling is fixed to match the native iOS date picker.
|
||||||
return MediaQuery.withNoTextScaling(
|
return MediaQuery.withNoTextScaling(
|
||||||
child: CupertinoTheme(
|
child: CupertinoTheme(
|
||||||
data: themeData.copyWith(
|
data: themeData.copyWith(
|
||||||
@ -2518,18 +2549,7 @@ class _CupertinoTimerPickerState extends State<CupertinoTimerPicker> {
|
|||||||
pickerTextStyle: _textStyleFrom(context, _kTimerPickerMagnification),
|
pickerTextStyle: _textStyleFrom(context, _kTimerPickerMagnification),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Align(
|
child: Align(alignment: widget.alignment, child: contents),
|
||||||
alignment: widget.alignment,
|
|
||||||
child: Container(
|
|
||||||
color: CupertinoDynamicColor.maybeResolve(widget.backgroundColor, context),
|
|
||||||
width: totalWidth,
|
|
||||||
height: _kPickerHeight,
|
|
||||||
child: DefaultTextStyle(
|
|
||||||
style: _textStyleFrom(context),
|
|
||||||
child: Row(children: columns.map((Widget child) => Expanded(child: child)).toList(growable: false)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -309,8 +309,9 @@ class _CupertinoAlertDialogState extends State<CupertinoAlertDialog> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildActions() {
|
Widget _buildActions() {
|
||||||
Widget actionSection = Container(
|
Widget actionSection = const LimitedBox(
|
||||||
height: 0.0,
|
maxWidth: 0,
|
||||||
|
child: SizedBox(width: double.infinity, height: 0),
|
||||||
);
|
);
|
||||||
if (widget.actions.isNotEmpty) {
|
if (widget.actions.isNotEmpty) {
|
||||||
actionSection = _CupertinoAlertActionSection(
|
actionSection = _CupertinoAlertActionSection(
|
||||||
@ -348,8 +349,9 @@ class _CupertinoAlertDialogState extends State<CupertinoAlertDialog> {
|
|||||||
removeBottom: true,
|
removeBottom: true,
|
||||||
context: context,
|
context: context,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Container(
|
child: Padding(
|
||||||
margin: const EdgeInsets.symmetric(vertical: _kDialogEdgePadding),
|
padding: const EdgeInsets.symmetric(vertical: _kDialogEdgePadding),
|
||||||
|
child: SizedBox(
|
||||||
width: isInAccessibilityMode
|
width: isInAccessibilityMode
|
||||||
? _kAccessibilityCupertinoDialogWidth
|
? _kAccessibilityCupertinoDialogWidth
|
||||||
: _kCupertinoDialogWidth,
|
: _kCupertinoDialogWidth,
|
||||||
@ -370,6 +372,7 @@ class _CupertinoAlertDialogState extends State<CupertinoAlertDialog> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -424,14 +427,18 @@ class CupertinoPopupSurface extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
Widget? contents = child;
|
||||||
|
if (isSurfacePainted) {
|
||||||
|
contents = ColoredBox(
|
||||||
|
color: CupertinoDynamicColor.resolve(_kDialogColor, context),
|
||||||
|
child: contents,
|
||||||
|
);
|
||||||
|
}
|
||||||
return ClipRRect(
|
return ClipRRect(
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(_kCornerRadius)),
|
borderRadius: const BorderRadius.all(Radius.circular(_kCornerRadius)),
|
||||||
child: BackdropFilter(
|
child: BackdropFilter(
|
||||||
filter: ImageFilter.blur(sigmaX: _kBlurAmount, sigmaY: _kBlurAmount),
|
filter: ImageFilter.blur(sigmaX: _kBlurAmount, sigmaY: _kBlurAmount),
|
||||||
child: Container(
|
child: contents,
|
||||||
color: isSurfacePainted ? CupertinoDynamicColor.resolve(_kDialogColor, context) : null,
|
|
||||||
child: child,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -596,8 +603,9 @@ class _CupertinoActionSheetState extends State<CupertinoActionSheet> {
|
|||||||
|
|
||||||
Widget _buildActions() {
|
Widget _buildActions() {
|
||||||
if (widget.actions == null || widget.actions!.isEmpty) {
|
if (widget.actions == null || widget.actions!.isEmpty) {
|
||||||
return Container(
|
return const LimitedBox(
|
||||||
height: 0.0,
|
maxWidth: 0,
|
||||||
|
child: SizedBox(width: double.infinity, height: 0),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return _CupertinoAlertActionSection(
|
return _CupertinoAlertActionSection(
|
||||||
@ -655,12 +663,13 @@ class _CupertinoActionSheetState extends State<CupertinoActionSheet> {
|
|||||||
label: 'Alert',
|
label: 'Alert',
|
||||||
child: CupertinoUserInterfaceLevel(
|
child: CupertinoUserInterfaceLevel(
|
||||||
data: CupertinoUserInterfaceLevelData.elevated,
|
data: CupertinoUserInterfaceLevelData.elevated,
|
||||||
child: Container(
|
child: Padding(
|
||||||
width: actionSheetWidth - _kActionSheetEdgeHorizontalPadding * 2,
|
padding: const EdgeInsets.symmetric(
|
||||||
margin: const EdgeInsets.symmetric(
|
|
||||||
horizontal: _kActionSheetEdgeHorizontalPadding,
|
horizontal: _kActionSheetEdgeHorizontalPadding,
|
||||||
vertical: _kActionSheetEdgeVerticalPadding,
|
vertical: _kActionSheetEdgeVerticalPadding,
|
||||||
),
|
),
|
||||||
|
child: SizedBox(
|
||||||
|
width: actionSheetWidth - _kActionSheetEdgeHorizontalPadding * 2,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
@ -670,6 +679,7 @@ class _CupertinoActionSheetState extends State<CupertinoActionSheet> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -731,8 +741,7 @@ class CupertinoActionSheetAction extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
child: Semantics(
|
child: Semantics(
|
||||||
button: true,
|
button: true,
|
||||||
child: Container(
|
child: Padding(
|
||||||
alignment: Alignment.center,
|
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
vertical: 16.0,
|
vertical: 16.0,
|
||||||
horizontal: 10.0,
|
horizontal: 10.0,
|
||||||
@ -740,7 +749,7 @@ class CupertinoActionSheetAction extends StatelessWidget {
|
|||||||
child: DefaultTextStyle(
|
child: DefaultTextStyle(
|
||||||
style: style,
|
style: style,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
child: child,
|
child: Center(child: child),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1752,10 +1761,9 @@ class CupertinoDialogAction extends StatelessWidget {
|
|||||||
constraints: const BoxConstraints(
|
constraints: const BoxConstraints(
|
||||||
minHeight: _kDialogMinButtonHeight,
|
minHeight: _kDialogMinButtonHeight,
|
||||||
),
|
),
|
||||||
child: Container(
|
child: Padding(
|
||||||
alignment: Alignment.center,
|
|
||||||
padding: EdgeInsets.all(padding),
|
padding: EdgeInsets.all(padding),
|
||||||
child: sizedContent,
|
child: Center(child: sizedContent),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -558,7 +558,7 @@ class _CupertinoSliverRefreshControlState extends State<CupertinoSliverRefreshCo
|
|||||||
widget.refreshIndicatorExtent,
|
widget.refreshIndicatorExtent,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return Container();
|
return const LimitedBox(maxWidth: 0.0, maxHeight: 0.0, child: SizedBox.expand());
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -590,8 +590,8 @@ class _PackagesViewState extends State<_PackagesView> {
|
|||||||
child: Material(
|
child: Material(
|
||||||
color: Theme.of(context).cardColor,
|
color: Theme.of(context).cardColor,
|
||||||
elevation: 4.0,
|
elevation: 4.0,
|
||||||
child: Container(
|
child: ConstrainedBox(
|
||||||
constraints: BoxConstraints.loose(const Size.fromWidth(600.0)),
|
constraints: const BoxConstraints(maxWidth: 600.0),
|
||||||
child: _packagesList(context, selectedId, snapshot.data!, widget.isLateral),
|
child: _packagesList(context, selectedId, snapshot.data!, widget.isLateral),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -887,8 +887,8 @@ class _PackageLicensePageState extends State<_PackageLicensePage> {
|
|||||||
child: Material(
|
child: Material(
|
||||||
color: theme.cardColor,
|
color: theme.cardColor,
|
||||||
elevation: 4.0,
|
elevation: 4.0,
|
||||||
child: Container(
|
child: ConstrainedBox(
|
||||||
constraints: BoxConstraints.loose(const Size.fromWidth(600.0)),
|
constraints: const BoxConstraints(maxWidth: 600.0),
|
||||||
child: Localizations.override(
|
child: Localizations.override(
|
||||||
locale: const Locale('en', 'US'),
|
locale: const Locale('en', 'US'),
|
||||||
context: context,
|
context: context,
|
||||||
@ -1361,13 +1361,14 @@ class _MasterDetailScaffoldState extends State<_MasterDetailScaffold>
|
|||||||
preferredSize: const Size.fromHeight(kToolbarHeight),
|
preferredSize: const Size.fromHeight(kToolbarHeight),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
ConstrainedBox(
|
SizedBox(
|
||||||
constraints: BoxConstraints.tightFor(width: masterViewWidth),
|
width: masterViewWidth,
|
||||||
child: IconTheme(
|
child: IconTheme(
|
||||||
data: Theme.of(context).primaryIconTheme,
|
data: Theme.of(context).primaryIconTheme,
|
||||||
child: Container(
|
child: Padding(
|
||||||
alignment: AlignmentDirectional.centerEnd,
|
|
||||||
padding: const EdgeInsets.all(8),
|
padding: const EdgeInsets.all(8),
|
||||||
|
child: Align(
|
||||||
|
alignment: AlignmentDirectional.centerEnd,
|
||||||
child: OverflowBar(
|
child: OverflowBar(
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
overflowAlignment: OverflowBarAlignment.end,
|
overflowAlignment: OverflowBarAlignment.end,
|
||||||
@ -1376,6 +1377,7 @@ class _MasterDetailScaffoldState extends State<_MasterDetailScaffold>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1405,9 +1407,8 @@ class _MasterDetailScaffoldState extends State<_MasterDetailScaffold>
|
|||||||
child,
|
child,
|
||||||
),
|
),
|
||||||
duration: const Duration(milliseconds: 500),
|
duration: const Duration(milliseconds: 500),
|
||||||
child: Container(
|
child: SizedBox.expand(
|
||||||
key: ValueKey<Object?>(value ?? widget.initialArguments),
|
key: ValueKey<Object?>(value ?? widget.initialArguments),
|
||||||
constraints: const BoxConstraints.expand(),
|
|
||||||
child: _DetailView(
|
child: _DetailView(
|
||||||
builder: widget.detailPageBuilder,
|
builder: widget.detailPageBuilder,
|
||||||
arguments: value ?? widget.initialArguments,
|
arguments: value ?? widget.initialArguments,
|
||||||
|
@ -345,15 +345,19 @@ class _MaterialBannerState extends State<MaterialBanner> {
|
|||||||
?? bannerTheme.leadingPadding
|
?? bannerTheme.leadingPadding
|
||||||
?? const EdgeInsetsDirectional.only(end: 16.0);
|
?? const EdgeInsetsDirectional.only(end: 16.0);
|
||||||
|
|
||||||
final Widget actionsBar = Container(
|
final Widget actionsBar = ConstrainedBox(
|
||||||
alignment: AlignmentDirectional.centerEnd,
|
|
||||||
constraints: const BoxConstraints(minHeight: 52.0),
|
constraints: const BoxConstraints(minHeight: 52.0),
|
||||||
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||||
|
child: Align(
|
||||||
|
alignment: AlignmentDirectional.centerEnd,
|
||||||
child: OverflowBar(
|
child: OverflowBar(
|
||||||
overflowAlignment: widget.overflowAlignment,
|
overflowAlignment: widget.overflowAlignment,
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
children: widget.actions,
|
children: widget.actions,
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
final double elevation = widget.elevation ?? bannerTheme.elevation ?? 0.0;
|
final double elevation = widget.elevation ?? bannerTheme.elevation ?? 0.0;
|
||||||
@ -373,8 +377,8 @@ class _MaterialBannerState extends State<MaterialBanner> {
|
|||||||
?? bannerTheme.contentTextStyle
|
?? bannerTheme.contentTextStyle
|
||||||
?? defaults.contentTextStyle;
|
?? defaults.contentTextStyle;
|
||||||
|
|
||||||
Widget materialBanner = Container(
|
Widget materialBanner = Padding(
|
||||||
margin: margin,
|
padding: margin,
|
||||||
child: Material(
|
child: Material(
|
||||||
elevation: elevation,
|
elevation: elevation,
|
||||||
color: backgroundColor,
|
color: backgroundColor,
|
||||||
|
@ -784,7 +784,7 @@ class _Label extends StatelessWidget {
|
|||||||
text = Align(
|
text = Align(
|
||||||
alignment: Alignment.bottomCenter,
|
alignment: Alignment.bottomCenter,
|
||||||
heightFactor: 1.0,
|
heightFactor: 1.0,
|
||||||
child: Container(child: text),
|
child: text,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (item.label != null) {
|
if (item.label != null) {
|
||||||
|
@ -391,7 +391,7 @@ class _RawMaterialButtonState extends State<RawMaterialButton> with MaterialStat
|
|||||||
mouseCursor: effectiveMouseCursor,
|
mouseCursor: effectiveMouseCursor,
|
||||||
child: IconTheme.merge(
|
child: IconTheme.merge(
|
||||||
data: IconThemeData(color: effectiveTextColor),
|
data: IconThemeData(color: effectiveTextColor),
|
||||||
child: Container(
|
child: Padding(
|
||||||
padding: padding,
|
padding: padding,
|
||||||
child: Center(
|
child: Center(
|
||||||
widthFactor: 1.0,
|
widthFactor: 1.0,
|
||||||
|
@ -244,11 +244,12 @@ class ButtonBar extends StatelessWidget {
|
|||||||
child: child,
|
child: child,
|
||||||
);
|
);
|
||||||
case ButtonBarLayoutBehavior.constrained:
|
case ButtonBarLayoutBehavior.constrained:
|
||||||
return Container(
|
return ConstrainedBox(
|
||||||
padding: EdgeInsets.symmetric(horizontal: paddingUnit),
|
|
||||||
constraints: const BoxConstraints(minHeight: 52.0),
|
constraints: const BoxConstraints(minHeight: 52.0),
|
||||||
alignment: Alignment.center,
|
child: Padding(
|
||||||
child: child,
|
padding: EdgeInsets.symmetric(horizontal: paddingUnit),
|
||||||
|
child: Center(child: child),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -393,9 +393,10 @@ class _DatePickerModeToggleButtonState extends State<_DatePickerModeToggleButton
|
|||||||
final TextTheme textTheme = Theme.of(context).textTheme;
|
final TextTheme textTheme = Theme.of(context).textTheme;
|
||||||
final Color controlColor = colorScheme.onSurface.withOpacity(0.60);
|
final Color controlColor = colorScheme.onSurface.withOpacity(0.60);
|
||||||
|
|
||||||
return Container(
|
return SizedBox(
|
||||||
padding: const EdgeInsetsDirectional.only(start: 16, end: 4),
|
|
||||||
height: _subHeaderHeight,
|
height: _subHeaderHeight,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsetsDirectional.only(start: 16, end: 4),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Flexible(
|
Flexible(
|
||||||
@ -440,6 +441,7 @@ class _DatePickerModeToggleButtonState extends State<_DatePickerModeToggleButton
|
|||||||
const SizedBox(width: _monthNavButtonsWidth),
|
const SizedBox(width: _monthNavButtonsWidth),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -755,9 +757,10 @@ class _MonthPickerState extends State<_MonthPicker> {
|
|||||||
return Semantics(
|
return Semantics(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
SizedBox(
|
||||||
padding: const EdgeInsetsDirectional.only(start: 16, end: 4),
|
|
||||||
height: _subHeaderHeight,
|
height: _subHeaderHeight,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsetsDirectional.only(start: 16, end: 4),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
@ -776,6 +779,7 @@ class _MonthPickerState extends State<_MonthPicker> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: FocusableActionDetector(
|
child: FocusableActionDetector(
|
||||||
shortcuts: _shortcutMap,
|
shortcuts: _shortcutMap,
|
||||||
@ -954,7 +958,7 @@ class _DayPickerState extends State<_DayPicker> {
|
|||||||
while (day < daysInMonth) {
|
while (day < daysInMonth) {
|
||||||
day++;
|
day++;
|
||||||
if (day < 1) {
|
if (day < 1) {
|
||||||
dayItems.add(Container());
|
dayItems.add(const SizedBox.shrink());
|
||||||
} else {
|
} else {
|
||||||
final DateTime dayToBuild = DateTime(year, month, day);
|
final DateTime dayToBuild = DateTime(year, month, day);
|
||||||
final bool isDisabled =
|
final bool isDisabled =
|
||||||
@ -1291,14 +1295,13 @@ class _YearPickerState extends State<YearPicker> {
|
|||||||
decoration: decoration,
|
decoration: decoration,
|
||||||
height: decorationHeight,
|
height: decorationHeight,
|
||||||
width: decorationWidth,
|
width: decorationWidth,
|
||||||
child: Center(
|
alignment: Alignment.center,
|
||||||
child: Semantics(
|
child: Semantics(
|
||||||
selected: isSelected,
|
selected: isSelected,
|
||||||
button: true,
|
button: true,
|
||||||
child: Text(year.toString(), style: itemStyle),
|
child: Text(year.toString(), style: itemStyle),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isDisabled) {
|
if (isDisabled) {
|
||||||
|
@ -224,8 +224,8 @@ class Card extends StatelessWidget {
|
|||||||
|
|
||||||
return Semantics(
|
return Semantics(
|
||||||
container: semanticContainer,
|
container: semanticContainer,
|
||||||
child: Container(
|
child: Padding(
|
||||||
margin: margin ?? cardTheme.margin ?? defaults.margin!,
|
padding: margin ?? cardTheme.margin ?? defaults.margin!,
|
||||||
child: Material(
|
child: Material(
|
||||||
type: MaterialType.card,
|
type: MaterialType.card,
|
||||||
color: color ?? cardTheme.color ?? defaults.color,
|
color: color ?? cardTheme.color ?? defaults.color,
|
||||||
|
@ -536,10 +536,12 @@ class _DatePickerDialogState extends State<DatePickerDialog> with RestorationMix
|
|||||||
final Color? headerForegroundColor = datePickerTheme.headerForegroundColor ?? defaults.headerForegroundColor;
|
final Color? headerForegroundColor = datePickerTheme.headerForegroundColor ?? defaults.headerForegroundColor;
|
||||||
headlineStyle = headlineStyle?.copyWith(color: headerForegroundColor);
|
headlineStyle = headlineStyle?.copyWith(color: headerForegroundColor);
|
||||||
|
|
||||||
final Widget actions = Container(
|
final Widget actions = ConstrainedBox(
|
||||||
alignment: AlignmentDirectional.centerEnd,
|
|
||||||
constraints: const BoxConstraints(minHeight: 52.0),
|
constraints: const BoxConstraints(minHeight: 52.0),
|
||||||
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||||
|
child: Align(
|
||||||
|
alignment: AlignmentDirectional.centerEnd,
|
||||||
child: OverflowBar(
|
child: OverflowBar(
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@ -559,6 +561,8 @@ class _DatePickerDialogState extends State<DatePickerDialog> with RestorationMix
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
CalendarDatePicker calendarDatePicker() {
|
CalendarDatePicker calendarDatePicker() {
|
||||||
@ -578,9 +582,10 @@ class _DatePickerDialogState extends State<DatePickerDialog> with RestorationMix
|
|||||||
return Form(
|
return Form(
|
||||||
key: _formKey,
|
key: _formKey,
|
||||||
autovalidateMode: _autovalidateMode.value,
|
autovalidateMode: _autovalidateMode.value,
|
||||||
child: Container(
|
child: SizedBox(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 24),
|
|
||||||
height: orientation == Orientation.portrait ? _inputFormPortraitHeight : _inputFormLandscapeHeight,
|
height: orientation == Orientation.portrait ? _inputFormPortraitHeight : _inputFormLandscapeHeight,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 24),
|
||||||
child: Shortcuts(
|
child: Shortcuts(
|
||||||
shortcuts: _formShortcutMap,
|
shortcuts: _formShortcutMap,
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -605,6 +610,7 @@ class _DatePickerDialogState extends State<DatePickerDialog> with RestorationMix
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1508,11 +1514,12 @@ class _DateRangePickerDialogState extends State<DateRangePickerDialog> with Rest
|
|||||||
selectedStartDate: _selectedStart.value,
|
selectedStartDate: _selectedStart.value,
|
||||||
selectedEndDate: _selectedEnd.value,
|
selectedEndDate: _selectedEnd.value,
|
||||||
currentDate: widget.currentDate,
|
currentDate: widget.currentDate,
|
||||||
picker: Container(
|
picker: SizedBox(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 24),
|
|
||||||
height: orientation == Orientation.portrait
|
height: orientation == Orientation.portrait
|
||||||
? _inputFormPortraitHeight
|
? _inputFormPortraitHeight
|
||||||
: _inputFormLandscapeHeight,
|
: _inputFormLandscapeHeight,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 24),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
@ -1540,6 +1547,7 @@ class _DateRangePickerDialogState extends State<DateRangePickerDialog> with Rest
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
onConfirm: _handleOk,
|
onConfirm: _handleOk,
|
||||||
onCancel: _handleCancel,
|
onCancel: _handleCancel,
|
||||||
entryModeButton: showEntryModeButton
|
entryModeButton: showEntryModeButton
|
||||||
@ -2157,11 +2165,11 @@ class _DayHeaders extends StatelessWidget {
|
|||||||
final MaterialLocalizations localizations = MaterialLocalizations.of(context);
|
final MaterialLocalizations localizations = MaterialLocalizations.of(context);
|
||||||
final List<Widget> labels = _getDayHeaders(textStyle, localizations);
|
final List<Widget> labels = _getDayHeaders(textStyle, localizations);
|
||||||
|
|
||||||
// Add leading and trailing containers for edges of the custom grid layout.
|
// Add leading and trailing boxes for edges of the custom grid layout.
|
||||||
labels.insert(0, Container());
|
labels.insert(0, const SizedBox.shrink());
|
||||||
labels.add(Container());
|
labels.add(const SizedBox.shrink());
|
||||||
|
|
||||||
return Container(
|
return ConstrainedBox(
|
||||||
constraints: BoxConstraints(
|
constraints: BoxConstraints(
|
||||||
maxWidth: MediaQuery.orientationOf(context) == Orientation.landscape
|
maxWidth: MediaQuery.orientationOf(context) == Orientation.landscape
|
||||||
? _maxCalendarWidthLandscape
|
? _maxCalendarWidthLandscape
|
||||||
@ -2428,8 +2436,9 @@ class _MonthItemState extends State<_MonthItem> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildEdgeContainer(BuildContext context, bool isHighlighted) {
|
Widget _buildEdgeBox(BuildContext context, bool isHighlighted) {
|
||||||
return Container(color: isHighlighted ? _highlightColor(context) : null);
|
const Widget empty = LimitedBox(maxWidth: 0.0, maxHeight: 0.0, child: SizedBox.expand());
|
||||||
|
return isHighlighted ? ColoredBox(color: _highlightColor(context), child: empty) : empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -2449,7 +2458,7 @@ class _MonthItemState extends State<_MonthItem> {
|
|||||||
// a leap year.
|
// a leap year.
|
||||||
for (int day = 0 - dayOffset + 1; day <= daysInMonth; day += 1) {
|
for (int day = 0 - dayOffset + 1; day <= daysInMonth; day += 1) {
|
||||||
if (day < 1) {
|
if (day < 1) {
|
||||||
dayItems.add(Container());
|
dayItems.add(const LimitedBox(maxWidth: 0.0, maxHeight: 0.0, child: SizedBox.expand()));
|
||||||
} else {
|
} else {
|
||||||
final DateTime dayToBuild = DateTime(year, month, day);
|
final DateTime dayToBuild = DateTime(year, month, day);
|
||||||
final Widget dayItem = _buildDayItem(
|
final Widget dayItem = _buildDayItem(
|
||||||
@ -2482,7 +2491,7 @@ class _MonthItemState extends State<_MonthItem> {
|
|||||||
widget.selectedDateEnd != null &&
|
widget.selectedDateEnd != null &&
|
||||||
dateAfterLeadingPadding.isAfter(widget.selectedDateStart!) &&
|
dateAfterLeadingPadding.isAfter(widget.selectedDateStart!) &&
|
||||||
!dateAfterLeadingPadding.isAfter(widget.selectedDateEnd!);
|
!dateAfterLeadingPadding.isAfter(widget.selectedDateEnd!);
|
||||||
weekList.insert(0, _buildEdgeContainer(context, isLeadingInRange));
|
weekList.insert(0, _buildEdgeBox(context, isLeadingInRange));
|
||||||
|
|
||||||
// Only add a trailing edge container if it is for a full week and not a
|
// Only add a trailing edge container if it is for a full week and not a
|
||||||
// partial week.
|
// partial week.
|
||||||
@ -2496,7 +2505,7 @@ class _MonthItemState extends State<_MonthItem> {
|
|||||||
widget.selectedDateEnd != null &&
|
widget.selectedDateEnd != null &&
|
||||||
!dateBeforeTrailingPadding.isBefore(widget.selectedDateStart!) &&
|
!dateBeforeTrailingPadding.isBefore(widget.selectedDateStart!) &&
|
||||||
dateBeforeTrailingPadding.isBefore(widget.selectedDateEnd!);
|
dateBeforeTrailingPadding.isBefore(widget.selectedDateEnd!);
|
||||||
weekList.add(_buildEdgeContainer(context, isTrailingInRange));
|
weekList.add(_buildEdgeBox(context, isTrailingInRange));
|
||||||
}
|
}
|
||||||
|
|
||||||
paddedDayItems.addAll(weekList);
|
paddedDayItems.addAll(weekList);
|
||||||
@ -2507,10 +2516,11 @@ class _MonthItemState extends State<_MonthItem> {
|
|||||||
: _maxCalendarWidthPortrait;
|
: _maxCalendarWidthPortrait;
|
||||||
return Column(
|
return Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
ConstrainedBox(
|
||||||
constraints: BoxConstraints(maxWidth: maxWidth),
|
constraints: BoxConstraints(maxWidth: maxWidth).tighten(height: _monthItemHeaderHeight),
|
||||||
height: _monthItemHeaderHeight,
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||||
|
child: Align(
|
||||||
alignment: AlignmentDirectional.centerStart,
|
alignment: AlignmentDirectional.centerStart,
|
||||||
child: ExcludeSemantics(
|
child: ExcludeSemantics(
|
||||||
child: Text(
|
child: Text(
|
||||||
@ -2519,7 +2529,9 @@ class _MonthItemState extends State<_MonthItem> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
),
|
||||||
|
),
|
||||||
|
ConstrainedBox(
|
||||||
constraints: BoxConstraints(
|
constraints: BoxConstraints(
|
||||||
maxWidth: maxWidth,
|
maxWidth: maxWidth,
|
||||||
maxHeight: gridHeight,
|
maxHeight: gridHeight,
|
||||||
@ -2693,7 +2705,7 @@ class _DayItemState extends State<_DayItem> {
|
|||||||
|
|
||||||
Widget dayWidget = Container(
|
Widget dayWidget = Container(
|
||||||
decoration: decoration,
|
decoration: decoration,
|
||||||
child: Center(
|
alignment: Alignment.center,
|
||||||
child: Semantics(
|
child: Semantics(
|
||||||
label: semanticLabel,
|
label: semanticLabel,
|
||||||
selected: widget.isSelectedDayStart || widget.isSelectedDayEnd,
|
selected: widget.isSelectedDayStart || widget.isSelectedDayEnd,
|
||||||
@ -2701,7 +2713,6 @@ class _DayItemState extends State<_DayItem> {
|
|||||||
child: Text(dayText, style: itemStyle),
|
child: Text(dayText, style: itemStyle),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (highlightPainter != null) {
|
if (highlightPainter != null) {
|
||||||
@ -2868,10 +2879,12 @@ class _InputDateRangePickerDialog extends StatelessWidget {
|
|||||||
entryModeButton: entryModeButton,
|
entryModeButton: entryModeButton,
|
||||||
);
|
);
|
||||||
|
|
||||||
final Widget actions = Container(
|
final Widget actions = ConstrainedBox(
|
||||||
alignment: AlignmentDirectional.centerEnd,
|
|
||||||
constraints: const BoxConstraints(minHeight: 52.0),
|
constraints: const BoxConstraints(minHeight: 52.0),
|
||||||
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||||
|
child: Align(
|
||||||
|
alignment: AlignmentDirectional.centerEnd,
|
||||||
child: OverflowBar(
|
child: OverflowBar(
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@ -2889,6 +2902,8 @@ class _InputDateRangePickerDialog extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
// 14 is a common font size used to compute the effective text scale.
|
// 14 is a common font size used to compute the effective text scale.
|
||||||
|
@ -682,7 +682,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
|
|||||||
behavior: HitTestBehavior.translucent,
|
behavior: HitTestBehavior.translucent,
|
||||||
excludeFromSemantics: true,
|
excludeFromSemantics: true,
|
||||||
dragStartBehavior: widget.dragStartBehavior,
|
dragStartBehavior: widget.dragStartBehavior,
|
||||||
child: Container(width: dragAreaWidth),
|
child: LimitedBox(maxHeight: 0.0, child: SizedBox(width: dragAreaWidth, height: double.infinity)),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -701,6 +701,11 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
|
|||||||
platformHasBackButton = false;
|
platformHasBackButton = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget drawerScrim = const LimitedBox(maxWidth: 0.0, maxHeight: 0.0, child: SizedBox.expand());
|
||||||
|
if (_scrimColorTween.evaluate(_controller) case final Color color) {
|
||||||
|
drawerScrim = ColoredBox(color: color, child: drawerScrim);
|
||||||
|
}
|
||||||
|
|
||||||
final Widget child = _DrawerControllerScope(
|
final Widget child = _DrawerControllerScope(
|
||||||
controller: widget,
|
controller: widget,
|
||||||
child: RepaintBoundary(
|
child: RepaintBoundary(
|
||||||
@ -714,9 +719,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
|
|||||||
onTap: close,
|
onTap: close,
|
||||||
child: Semantics(
|
child: Semantics(
|
||||||
label: MaterialLocalizations.of(context).modalBarrierDismissLabel,
|
label: MaterialLocalizations.of(context).modalBarrierDismissLabel,
|
||||||
child: Container( // The drawer's "scrim"
|
child: drawerScrim,
|
||||||
color: _scrimColorTween.evaluate(_controller),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -200,11 +200,11 @@ class _DropdownMenuItemButtonState<T> extends State<_DropdownMenuItemButton<T>>
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final DropdownMenuItem<T> dropdownMenuItem =
|
final DropdownMenuItem<T> dropdownMenuItem =
|
||||||
widget.route.items[widget.itemIndex].item!;
|
widget.route.items[widget.itemIndex].item!;
|
||||||
Widget child = Container(
|
Widget child = widget.route.items[widget.itemIndex];
|
||||||
padding: widget.padding,
|
if (widget.padding case final EdgeInsetsGeometry padding) {
|
||||||
height: widget.route.itemHeight,
|
child = Padding(padding: padding, child: child);
|
||||||
child: widget.route.items[widget.itemIndex],
|
}
|
||||||
);
|
child = SizedBox(height: widget.route.itemHeight, child: child);
|
||||||
// An [InkWell] is added to the item only if it is enabled
|
// An [InkWell] is added to the item only if it is enabled
|
||||||
if (dropdownMenuItem.enabled) {
|
if (dropdownMenuItem.enabled) {
|
||||||
child = InkWell(
|
child = InkWell(
|
||||||
@ -775,10 +775,9 @@ class _DropdownMenuItemContainer extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return ConstrainedBox(
|
||||||
constraints: const BoxConstraints(minHeight: _kMenuItemHeight),
|
constraints: const BoxConstraints(minHeight: _kMenuItemHeight),
|
||||||
alignment: alignment,
|
child: Align(alignment: alignment, child: child),
|
||||||
child: child,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1500,9 +1499,10 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> with WidgetsBindi
|
|||||||
|
|
||||||
Widget result = DefaultTextStyle(
|
Widget result = DefaultTextStyle(
|
||||||
style: _enabled ? _textStyle! : _textStyle!.copyWith(color: Theme.of(context).disabledColor),
|
style: _enabled ? _textStyle! : _textStyle!.copyWith(color: Theme.of(context).disabledColor),
|
||||||
child: Container(
|
child: SizedBox(
|
||||||
padding: padding.resolve(Directionality.of(context)),
|
|
||||||
height: widget.isDense ? _denseButtonHeight : null,
|
height: widget.isDense ? _denseButtonHeight : null,
|
||||||
|
child: Padding(
|
||||||
|
padding: padding.resolve(Directionality.of(context)),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
@ -1521,6 +1521,7 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> with WidgetsBindi
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!DropdownButtonHideUnderline.at(context)) {
|
if (!DropdownButtonHideUnderline.at(context)) {
|
||||||
|
@ -789,7 +789,7 @@ class _DropdownMenuState<T> extends State<DropdownMenu<T>> {
|
|||||||
hintText: widget.hintText,
|
hintText: widget.hintText,
|
||||||
helperText: widget.helperText,
|
helperText: widget.helperText,
|
||||||
errorText: widget.errorText,
|
errorText: widget.errorText,
|
||||||
prefixIcon: widget.leadingIcon != null ? Container(
|
prefixIcon: widget.leadingIcon != null ? SizedBox(
|
||||||
key: _leadingKey,
|
key: _leadingKey,
|
||||||
child: widget.leadingIcon
|
child: widget.leadingIcon
|
||||||
) : null,
|
) : null,
|
||||||
@ -816,11 +816,13 @@ class _DropdownMenuState<T> extends State<DropdownMenu<T>> {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (widget.expandedInsets != null) {
|
if (widget.expandedInsets case final EdgeInsets padding) {
|
||||||
menuAnchor = Container(
|
menuAnchor = Padding(
|
||||||
|
padding: padding.copyWith(top: 0.0, bottom: 0.0),
|
||||||
|
child: Align(
|
||||||
alignment: AlignmentDirectional.topStart,
|
alignment: AlignmentDirectional.topStart,
|
||||||
padding: widget.expandedInsets?.copyWith(top: 0.0, bottom: 0.0),
|
|
||||||
child: menuAnchor,
|
child: menuAnchor,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,10 +99,12 @@ void main() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Finder findStaticChildDecoration(WidgetTester tester) {
|
Finder findStaticChildColor(WidgetTester tester) {
|
||||||
return find.descendant(
|
return find.descendant(
|
||||||
of: findStatic(),
|
of: findStatic(),
|
||||||
matching: find.byType(DecoratedBox),
|
matching: find.byWidgetPredicate(
|
||||||
|
(Widget widget) => widget is ColoredBox && widget.color != CupertinoColors.activeOrange,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -496,7 +498,7 @@ void main() {
|
|||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(findStatic(), findsOneWidget);
|
expect(findStatic(), findsOneWidget);
|
||||||
|
|
||||||
expect(findStaticChildDecoration(tester), findsNWidgets(1));
|
expect(findStaticChildColor(tester), findsNWidgets(1));
|
||||||
|
|
||||||
// Close the CupertinoContextMenu.
|
// Close the CupertinoContextMenu.
|
||||||
await tester.tapAt(const Offset(1.0, 1.0));
|
await tester.tapAt(const Offset(1.0, 1.0));
|
||||||
@ -528,7 +530,7 @@ void main() {
|
|||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(findStatic(), findsOneWidget);
|
expect(findStatic(), findsOneWidget);
|
||||||
|
|
||||||
expect(findStaticChildDecoration(tester), findsNWidgets(3));
|
expect(findStaticChildColor(tester), findsNWidgets(2));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Can close CupertinoContextMenu by background tap', (WidgetTester tester) async {
|
testWidgets('Can close CupertinoContextMenu by background tap', (WidgetTester tester) async {
|
||||||
|
@ -18,12 +18,12 @@ void main() {
|
|||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
final Container container = _getCardContainer(tester);
|
final Padding padding = _getCardPadding(tester);
|
||||||
final Material material = _getCardMaterial(tester);
|
final Material material = _getCardMaterial(tester);
|
||||||
|
|
||||||
expect(material.clipBehavior, Clip.none);
|
expect(material.clipBehavior, Clip.none);
|
||||||
expect(material.elevation, 1.0);
|
expect(material.elevation, 1.0);
|
||||||
expect(container.margin, const EdgeInsets.all(4.0));
|
expect(padding.padding, const EdgeInsets.all(4.0));
|
||||||
expect(material.color, colors.surfaceContainerLow);
|
expect(material.color, colors.surfaceContainerLow);
|
||||||
expect(material.shadowColor, colors.shadow);
|
expect(material.shadowColor, colors.shadow);
|
||||||
expect(material.surfaceTintColor, Colors.transparent); // Don't use surface tint. Toned surface container is used instead.
|
expect(material.surfaceTintColor, Colors.transparent); // Don't use surface tint. Toned surface container is used instead.
|
||||||
@ -42,12 +42,12 @@ void main() {
|
|||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
final Container container = _getCardContainer(tester);
|
final Padding padding = _getCardPadding(tester);
|
||||||
final Material material = _getCardMaterial(tester);
|
final Material material = _getCardMaterial(tester);
|
||||||
|
|
||||||
expect(material.clipBehavior, Clip.none);
|
expect(material.clipBehavior, Clip.none);
|
||||||
expect(material.elevation, 0.0);
|
expect(material.elevation, 0.0);
|
||||||
expect(container.margin, const EdgeInsets.all(4.0));
|
expect(padding.padding, const EdgeInsets.all(4.0));
|
||||||
expect(material.color, colors.surfaceContainerHighest);
|
expect(material.color, colors.surfaceContainerHighest);
|
||||||
expect(material.shadowColor, colors.shadow);
|
expect(material.shadowColor, colors.shadow);
|
||||||
expect(material.surfaceTintColor, Colors.transparent);
|
expect(material.surfaceTintColor, Colors.transparent);
|
||||||
@ -66,12 +66,12 @@ void main() {
|
|||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
final Container container = _getCardContainer(tester);
|
final Padding padding = _getCardPadding(tester);
|
||||||
final Material material = _getCardMaterial(tester);
|
final Material material = _getCardMaterial(tester);
|
||||||
|
|
||||||
expect(material.clipBehavior, Clip.none);
|
expect(material.clipBehavior, Clip.none);
|
||||||
expect(material.elevation, 0.0);
|
expect(material.elevation, 0.0);
|
||||||
expect(container.margin, const EdgeInsets.all(4.0));
|
expect(padding.padding, const EdgeInsets.all(4.0));
|
||||||
expect(material.color, colors.surface);
|
expect(material.color, colors.surface);
|
||||||
expect(material.shadowColor, colors.shadow);
|
expect(material.shadowColor, colors.shadow);
|
||||||
expect(material.surfaceTintColor, Colors.transparent);
|
expect(material.surfaceTintColor, Colors.transparent);
|
||||||
@ -301,11 +301,11 @@ Material _getCardMaterial(WidgetTester tester) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Container _getCardContainer(WidgetTester tester) {
|
Padding _getCardPadding(WidgetTester tester) {
|
||||||
return tester.widget<Container>(
|
return tester.widget<Padding>(
|
||||||
find.descendant(
|
find.descendant(
|
||||||
of: find.byType(Card),
|
of: find.byType(Card),
|
||||||
matching: find.byType(Container),
|
matching: find.byType(Padding),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ void main() {
|
|||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
final Container container = _getCardContainer(tester);
|
final Padding padding = _getCardPadding(tester);
|
||||||
final Material material = _getCardMaterial(tester);
|
final Material material = _getCardMaterial(tester);
|
||||||
|
|
||||||
expect(material.clipBehavior, Clip.none);
|
expect(material.clipBehavior, Clip.none);
|
||||||
@ -39,7 +39,7 @@ void main() {
|
|||||||
expect(material.shadowColor, theme.colorScheme.shadow);
|
expect(material.shadowColor, theme.colorScheme.shadow);
|
||||||
expect(material.surfaceTintColor, Colors.transparent); // Default primary color
|
expect(material.surfaceTintColor, Colors.transparent); // Default primary color
|
||||||
expect(material.elevation, 1.0);
|
expect(material.elevation, 1.0);
|
||||||
expect(container.margin, const EdgeInsets.all(4.0));
|
expect(padding.padding, const EdgeInsets.all(4.0));
|
||||||
expect(material.shape, const RoundedRectangleBorder(
|
expect(material.shape, const RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(12.0)),
|
borderRadius: BorderRadius.all(Radius.circular(12.0)),
|
||||||
));
|
));
|
||||||
@ -55,7 +55,7 @@ void main() {
|
|||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
final Container container = _getCardContainer(tester);
|
final Padding padding = _getCardPadding(tester);
|
||||||
final Material material = _getCardMaterial(tester);
|
final Material material = _getCardMaterial(tester);
|
||||||
|
|
||||||
expect(material.clipBehavior, cardTheme.clipBehavior);
|
expect(material.clipBehavior, cardTheme.clipBehavior);
|
||||||
@ -63,7 +63,7 @@ void main() {
|
|||||||
expect(material.shadowColor, cardTheme.shadowColor);
|
expect(material.shadowColor, cardTheme.shadowColor);
|
||||||
expect(material.surfaceTintColor, cardTheme.surfaceTintColor);
|
expect(material.surfaceTintColor, cardTheme.surfaceTintColor);
|
||||||
expect(material.elevation, cardTheme.elevation);
|
expect(material.elevation, cardTheme.elevation);
|
||||||
expect(container.margin, cardTheme.margin);
|
expect(padding.padding, cardTheme.margin);
|
||||||
expect(material.shape, cardTheme.shape);
|
expect(material.shape, cardTheme.shape);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -91,14 +91,14 @@ void main() {
|
|||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
final Container container = _getCardContainer(tester);
|
final Padding padding = _getCardPadding(tester);
|
||||||
final Material material = _getCardMaterial(tester);
|
final Material material = _getCardMaterial(tester);
|
||||||
|
|
||||||
expect(material.clipBehavior, clip);
|
expect(material.clipBehavior, clip);
|
||||||
expect(material.color, color);
|
expect(material.color, color);
|
||||||
expect(material.shadowColor, shadowColor);
|
expect(material.shadowColor, shadowColor);
|
||||||
expect(material.elevation, elevation);
|
expect(material.elevation, elevation);
|
||||||
expect(container.margin, margin);
|
expect(padding.padding, margin);
|
||||||
expect(material.shape, shape);
|
expect(material.shape, shape);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ void main() {
|
|||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
final Container container = _getCardContainer(tester);
|
final Padding padding = _getCardPadding(tester);
|
||||||
final Material material = _getCardMaterial(tester);
|
final Material material = _getCardMaterial(tester);
|
||||||
|
|
||||||
expect(material.clipBehavior, Clip.none);
|
expect(material.clipBehavior, Clip.none);
|
||||||
@ -195,7 +195,7 @@ void main() {
|
|||||||
expect(material.shadowColor, Colors.black);
|
expect(material.shadowColor, Colors.black);
|
||||||
expect(material.surfaceTintColor, null);
|
expect(material.surfaceTintColor, null);
|
||||||
expect(material.elevation, 1.0);
|
expect(material.elevation, 1.0);
|
||||||
expect(container.margin, const EdgeInsets.all(4.0));
|
expect(padding.padding, const EdgeInsets.all(4.0));
|
||||||
expect(material.shape, const RoundedRectangleBorder(
|
expect(material.shape, const RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(4.0)),
|
borderRadius: BorderRadius.all(Radius.circular(4.0)),
|
||||||
));
|
));
|
||||||
@ -261,11 +261,11 @@ Material _getCardMaterial(WidgetTester tester) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Container _getCardContainer(WidgetTester tester) {
|
Padding _getCardPadding(WidgetTester tester) {
|
||||||
return tester.widget<Container>(
|
return tester.widget<Padding>(
|
||||||
find.descendant(
|
find.descendant(
|
||||||
of: find.byType(Card),
|
of: find.byType(Card),
|
||||||
matching: find.byType(Container),
|
matching: find.byType(Padding),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -154,21 +154,18 @@ void main() {
|
|||||||
}, variant: TargetPlatformVariant.only(TargetPlatform.android));
|
}, variant: TargetPlatformVariant.only(TargetPlatform.android));
|
||||||
|
|
||||||
testWidgets('Scaffold drawerScrimColor', (WidgetTester tester) async {
|
testWidgets('Scaffold drawerScrimColor', (WidgetTester tester) async {
|
||||||
// The scrim is a Container within a Semantics node labeled "Dismiss",
|
// The scrim is a ColoredBox within a Semantics node labeled "Dismiss",
|
||||||
// within a DrawerController. Sorry.
|
// within a DrawerController. Sorry.
|
||||||
Container getScrim() {
|
Widget getScrim() {
|
||||||
return tester.widget<Container>(
|
return tester.widget<Semantics>(
|
||||||
find.descendant(
|
find.descendant(
|
||||||
of: find.descendant(
|
|
||||||
of: find.byType(DrawerController),
|
of: find.byType(DrawerController),
|
||||||
matching: find.byWidgetPredicate((Widget widget) {
|
matching: find.byWidgetPredicate((Widget widget) {
|
||||||
return widget is Semantics
|
return widget is Semantics
|
||||||
&& widget.properties.label == 'Dismiss';
|
&& widget.properties.label == 'Dismiss';
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
matching: find.byType(Container),
|
).child!;
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
|
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
|
||||||
@ -196,7 +193,8 @@ void main() {
|
|||||||
scaffoldKey.currentState!.openDrawer();
|
scaffoldKey.currentState!.openDrawer();
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
expect(getScrim().color, Colors.black54);
|
ColoredBox scrim = getScrim() as ColoredBox;
|
||||||
|
expect(scrim.color, Colors.black54);
|
||||||
|
|
||||||
await tester.tap(find.byType(Drawer));
|
await tester.tap(find.byType(Drawer));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
@ -208,7 +206,8 @@ void main() {
|
|||||||
scaffoldKey.currentState!.openDrawer();
|
scaffoldKey.currentState!.openDrawer();
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
expect(getScrim().color, const Color(0xFF323232));
|
scrim = getScrim() as ColoredBox;
|
||||||
|
expect(scrim.color, const Color(0xFF323232));
|
||||||
|
|
||||||
await tester.tap(find.byType(Drawer));
|
await tester.tap(find.byType(Drawer));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
@ -312,8 +312,8 @@ Material _drawerMaterial(WidgetTester tester) {
|
|||||||
|
|
||||||
// The scrim is a Container within a Semantics node labeled "Dismiss",
|
// The scrim is a Container within a Semantics node labeled "Dismiss",
|
||||||
// within a DrawerController.
|
// within a DrawerController.
|
||||||
Container _scrim(WidgetTester tester) {
|
ColoredBox _scrim(WidgetTester tester) {
|
||||||
return tester.widget<Container>(
|
return tester.widget<ColoredBox>(
|
||||||
find.descendant(
|
find.descendant(
|
||||||
of: find.descendant(
|
of: find.descendant(
|
||||||
of: find.byType(DrawerController),
|
of: find.byType(DrawerController),
|
||||||
@ -322,7 +322,7 @@ Container _scrim(WidgetTester tester) {
|
|||||||
&& widget.properties.label == 'Dismiss';
|
&& widget.properties.label == 'Dismiss';
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
matching: find.byType(Container),
|
matching: find.byType(ColoredBox),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -442,7 +442,7 @@ void main() {
|
|||||||
label: const Text('label'),
|
label: const Text('label'),
|
||||||
));
|
));
|
||||||
|
|
||||||
final Finder leadingIcon = find.widgetWithIcon(Container, Icons.search);
|
final Finder leadingIcon = find.widgetWithIcon(SizedBox, Icons.search).last;
|
||||||
final double iconWidth = tester.getSize(leadingIcon).width;
|
final double iconWidth = tester.getSize(leadingIcon).width;
|
||||||
final Finder updatedLabel = find.text('label');
|
final Finder updatedLabel = find.text('label');
|
||||||
final Offset updatedLabelTopLeft = tester.getTopLeft(updatedLabel);
|
final Offset updatedLabelTopLeft = tester.getTopLeft(updatedLabel);
|
||||||
@ -465,7 +465,7 @@ void main() {
|
|||||||
label: const Text('label'),
|
label: const Text('label'),
|
||||||
));
|
));
|
||||||
|
|
||||||
final Finder largeLeadingIcon = find.widgetWithIcon(Container, Icons.search);
|
final Finder largeLeadingIcon = find.widgetWithIcon(SizedBox, Icons.search).last;
|
||||||
final double largeIconWidth = tester.getSize(largeLeadingIcon).width;
|
final double largeIconWidth = tester.getSize(largeLeadingIcon).width;
|
||||||
final Finder updatedLabel1 = find.text('label');
|
final Finder updatedLabel1 = find.text('label');
|
||||||
final Offset updatedLabelTopLeft1 = tester.getTopLeft(updatedLabel1);
|
final Offset updatedLabelTopLeft1 = tester.getTopLeft(updatedLabel1);
|
||||||
@ -524,7 +524,7 @@ void main() {
|
|||||||
));
|
));
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
|
|
||||||
final Finder leadingIcon = find.widgetWithIcon(Container, Icons.search);
|
final Finder leadingIcon = find.widgetWithIcon(SizedBox, Icons.search).last;
|
||||||
final double iconWidth = tester.getSize(leadingIcon).width;
|
final double iconWidth = tester.getSize(leadingIcon).width;
|
||||||
final Offset dropdownMenuTopRight = tester.getTopRight(find.byType(DropdownMenu<TestMenu>));
|
final Offset dropdownMenuTopRight = tester.getTopRight(find.byType(DropdownMenu<TestMenu>));
|
||||||
final Finder updatedLabel = find.text('label');
|
final Finder updatedLabel = find.text('label');
|
||||||
@ -556,7 +556,7 @@ void main() {
|
|||||||
));
|
));
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
|
|
||||||
final Finder largeLeadingIcon = find.widgetWithIcon(Container, Icons.search);
|
final Finder largeLeadingIcon = find.widgetWithIcon(SizedBox, Icons.search).last;
|
||||||
final double largeIconWidth = tester.getSize(largeLeadingIcon).width;
|
final double largeIconWidth = tester.getSize(largeLeadingIcon).width;
|
||||||
final Offset updatedDropdownMenuTopRight = tester.getTopRight(find.byType(DropdownMenu<TestMenu>));
|
final Offset updatedDropdownMenuTopRight = tester.getTopRight(find.byType(DropdownMenu<TestMenu>));
|
||||||
final Finder updatedLabel1 = find.text('label');
|
final Finder updatedLabel1 = find.text('label');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user