Unverified Commit 6a540592 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Make MultiChildRenderObjectWidget const (#119195)

parent 9b3b9cf0
......@@ -55,8 +55,8 @@ class PlatformViewLayout extends StatelessWidget {
child: Material(
elevation: (index % 5 + 1).toDouble(),
color: Colors.white,
child: Stack(
children: const <Widget> [
child: const Stack(
children: <Widget> [
DummyPlatformView(),
RotationContainer(),
],
......
......@@ -59,8 +59,8 @@ class PlatformViewLayout extends StatelessWidget {
child: Material(
elevation: (index % 5 + 1).toDouble(),
color: Colors.white,
child: Stack(
children: const <Widget> [
child: const Stack(
children: <Widget> [
DummyPlatformView(),
RotationContainer(),
],
......
......@@ -77,9 +77,9 @@ class _PopupControlsPageState extends State<PopupControlsPage> {
return AlertDialog(
key: const ValueKey<String>(alertKeyValue),
title: const Text('Title text', key: ValueKey<String>('$alertKeyValue.Title')),
content: SingleChildScrollView(
content: const SingleChildScrollView(
child: ListBody(
children: const <Widget>[
children: <Widget>[
Text('Body text line 1.', key: ValueKey<String>('$alertKeyValue.Body1')),
Text('Body text line 2.', key: ValueKey<String>('$alertKeyValue.Body2')),
],
......
......@@ -1763,7 +1763,7 @@ class CupertinoDialogAction extends StatelessWidget {
//
// See [_RenderCupertinoDialogActions] for specific layout policy details.
class _CupertinoDialogActionsRenderWidget extends MultiChildRenderObjectWidget {
_CupertinoDialogActionsRenderWidget({
const _CupertinoDialogActionsRenderWidget({
required List<Widget> actionButtons,
double dividerThickness = 0.0,
bool hasCancelButton = false,
......
......@@ -405,7 +405,7 @@ class _SegmentedControlState<T extends Object> extends State<CupertinoSegmentedC
}
class _SegmentedControlRenderWidget<T> extends MultiChildRenderObjectWidget {
_SegmentedControlRenderWidget({
const _SegmentedControlRenderWidget({
super.key,
super.children,
required this.selectedIndex,
......
......@@ -711,7 +711,7 @@ class _SegmentedControlState<T> extends State<CupertinoSlidingSegmentedControl<T
}
class _SegmentedControlRenderWidget<T> extends MultiChildRenderObjectWidget {
_SegmentedControlRenderWidget({
const _SegmentedControlRenderWidget({
super.key,
super.children,
required this.highlightedIndex,
......
......@@ -233,7 +233,7 @@ class ButtonBar extends StatelessWidget {
class _ButtonBarRow extends Flex {
/// Creates a button bar that attempts to display in a row, but displays in
/// a column if there is insufficient horizontal space.
_ButtonBarRow({
const _ButtonBarRow({
required super.children,
super.mainAxisSize,
super.mainAxisAlignment,
......
......@@ -302,9 +302,9 @@ class Dialog extends StatelessWidget {
/// builder: (BuildContext context) {
/// return AlertDialog(
/// title: const Text('AlertDialog Title'),
/// content: SingleChildScrollView(
/// content: const SingleChildScrollView(
/// child: ListBody(
/// children: const <Widget>[
/// children: <Widget>[
/// Text('This is a demo alert dialog.'),
/// Text('Would you like to approve of this message?'),
/// ],
......
......@@ -605,7 +605,7 @@ class _ArrowDownIntent extends Intent {
}
class _DropdownMenuBody extends MultiChildRenderObjectWidget {
_DropdownMenuBody({
const _DropdownMenuBody({
super.key,
super.children,
this.width,
......
......@@ -655,7 +655,7 @@ class _MergeableMaterialSliceKey extends GlobalKey {
}
class _MergeableMaterialListBody extends ListBody {
_MergeableMaterialListBody({
const _MergeableMaterialListBody({
required super.children,
super.mainAxis,
required this.items,
......
......@@ -372,7 +372,7 @@ class SegmentedButton<T> extends StatelessWidget {
}
}
class _SegmentedButtonRenderWidget<T> extends MultiChildRenderObjectWidget {
_SegmentedButtonRenderWidget({
const _SegmentedButtonRenderWidget({
super.key,
required this.segments,
required this.enabledBorder,
......
......@@ -275,7 +275,7 @@ class _TabLabelBarRenderer extends RenderFlex {
// upon layout. The tab widths are only used at paint time (see _IndicatorPainter)
// or in response to input.
class _TabLabelBar extends Flex {
_TabLabelBar({
const _TabLabelBar({
super.children,
required this.onPerformLayout,
}) : super(
......
......@@ -373,7 +373,7 @@ class _TextSelectionToolbarTrailingEdgeAlignRenderBox extends RenderProxyBox {
// Renders the menu items in the correct positions in the menu and its overflow
// submenu based on calculating which item would first overflow.
class _TextSelectionToolbarItemsLayout extends MultiChildRenderObjectWidget {
_TextSelectionToolbarItemsLayout({
const _TextSelectionToolbarItemsLayout({
required this.isAbove,
required this.overflowOpen,
required super.children,
......
......@@ -2304,7 +2304,7 @@ class CustomMultiChildLayout extends MultiChildRenderObjectWidget {
/// Creates a custom multi-child layout.
///
/// The [delegate] argument must not be null.
CustomMultiChildLayout({
const CustomMultiChildLayout({
super.key,
required this.delegate,
super.children,
......@@ -3666,7 +3666,7 @@ class ListBody extends MultiChildRenderObjectWidget {
/// given axis.
///
/// By default, the [mainAxis] is [Axis.vertical].
ListBody({
const ListBody({
super.key,
this.mainAxis = Axis.vertical,
this.reverse = false,
......@@ -3825,7 +3825,7 @@ class Stack extends MultiChildRenderObjectWidget {
///
/// By default, the non-positioned children of the stack are aligned by their
/// top left corners.
Stack({
const Stack({
super.key,
this.alignment = AlignmentDirectional.topStart,
this.textDirection,
......@@ -3941,7 +3941,7 @@ class IndexedStack extends Stack {
/// Creates a [Stack] widget that paints a single child.
///
/// The [index] argument must not be null.
IndexedStack({
const IndexedStack({
super.key,
super.alignment,
super.textDirection,
......@@ -4445,7 +4445,7 @@ class Flex extends MultiChildRenderObjectWidget {
/// to be necessary to decide which direction to lay the children in or to
/// disambiguate `start` or `end` values for the main or cross axis
/// directions, the [textDirection] must not be null.
Flex({
const Flex({
super.key,
required this.direction,
this.mainAxisAlignment = MainAxisAlignment.start,
......@@ -4812,7 +4812,7 @@ class Row extends Flex {
/// unless the row has no children or only one child) or to disambiguate
/// `start` or `end` values for the [mainAxisAlignment], the [textDirection]
/// must not be null.
Row({
const Row({
super.key,
super.mainAxisAlignment,
super.mainAxisSize,
......@@ -5005,7 +5005,7 @@ class Column extends Flex {
/// any. If there is no ambient directionality, and a text direction is going
/// to be necessary to disambiguate `start` or `end` values for the
/// [crossAxisAlignment], the [textDirection] must not be null.
Column({
const Column({
super.key,
super.mainAxisAlignment,
super.mainAxisSize,
......@@ -5212,7 +5212,7 @@ class Wrap extends MultiChildRenderObjectWidget {
/// to be necessary to decide which direction to lay the children in or to
/// disambiguate `start` or `end` values for the main or cross axis
/// directions, the [textDirection] must not be null.
Wrap({
const Wrap({
super.key,
this.direction = Axis.horizontal,
this.alignment = WrapAlignment.start,
......@@ -5474,7 +5474,7 @@ class Flow extends MultiChildRenderObjectWidget {
/// a repaint boundary.
///
/// The [delegate] argument must not be null.
Flow.unwrapped({
const Flow.unwrapped({
super.key,
required this.delegate,
super.children,
......
......@@ -1855,9 +1855,7 @@ abstract class MultiChildRenderObjectWidget extends RenderObjectWidget {
///
/// The [children] argument must not be null and must not contain any null
/// objects.
// TODO(goderbauer): Make this const and fix fallout, https://github.com/flutter/flutter/issues/108248
// ignore: prefer_const_constructors_in_immutables
MultiChildRenderObjectWidget({ super.key, this.children = const <Widget>[] });
const MultiChildRenderObjectWidget({ super.key, this.children = const <Widget>[] });
/// The widgets below this widget in the tree.
///
......
......@@ -59,7 +59,7 @@ class OverflowBar extends MultiChildRenderObjectWidget {
/// [overflowDirection], and [clipBehavior] parameters must not be
/// null. The [children] argument must not be null and must not contain
/// any null objects.
OverflowBar({
const OverflowBar({
super.key,
this.spacing = 0.0,
this.alignment,
......
......@@ -637,7 +637,7 @@ class OverlayState extends State<Overlay> with TickerProviderStateMixin {
///
/// The first [skipCount] children are considered "offstage".
class _Theatre extends MultiChildRenderObjectWidget {
_Theatre({
const _Theatre({
this.skipCount = 0,
this.clipBehavior = Clip.hardEdge,
super.children,
......
......@@ -324,7 +324,7 @@ class ShrinkWrappingViewport extends MultiChildRenderObjectWidget {
/// rebuild this widget when the [offset] changes.
///
/// The [offset] argument must not be null.
ShrinkWrappingViewport({
const ShrinkWrappingViewport({
super.key,
this.axisDirection = AxisDirection.down,
this.crossAxisDirection,
......
......@@ -227,7 +227,7 @@ void main() {
),
child: page1Center,
)
: Stack();
: const Stack();
},
),
),
......@@ -270,7 +270,7 @@ void main() {
],
),
)
: Stack();
: const Stack();
},
),
),
......
......@@ -341,9 +341,9 @@ void main() {
testWidgets('ButtonBar has a min height of 52 when using ButtonBarLayoutBehavior.constrained', (WidgetTester tester) async {
await tester.pumpWidget(
SingleChildScrollView(
const SingleChildScrollView(
child: ListBody(
children: const <Widget>[
children: <Widget>[
Directionality(
textDirection: TextDirection.ltr,
child: ButtonBar(
......@@ -364,9 +364,9 @@ void main() {
testWidgets('ButtonBar has padding applied when using ButtonBarLayoutBehavior.padded', (WidgetTester tester) async {
await tester.pumpWidget(
SingleChildScrollView(
const SingleChildScrollView(
child: ListBody(
children: const <Widget>[
children: <Widget>[
Directionality(
textDirection: TextDirection.ltr,
child: ButtonBar(
......
......@@ -63,11 +63,11 @@ void main() {
testWidgets('A sample of icons look as expected', (WidgetTester tester) async {
await _loadIconFont();
await tester.pumpWidget(MaterialApp(
await tester.pumpWidget(const MaterialApp(
home: IconTheme(
data: const IconThemeData(size: 200),
data: IconThemeData(size: 200),
child: Wrap(
children: const <Icon>[
children: <Icon>[
Icon(Icons.ten_k),
Icon(Icons.ac_unit),
Icon(Icons.local_taxi),
......@@ -87,11 +87,11 @@ void main() {
testWidgets('Another sample of icons look as expected', (WidgetTester tester) async {
await _loadIconFont();
await tester.pumpWidget(MaterialApp(
await tester.pumpWidget(const MaterialApp(
home: IconTheme(
data: const IconThemeData(size: 200),
data: IconThemeData(size: 200),
child: Wrap(
children: const <Icon>[
children: <Icon>[
Icon(Icons.water_drop),
Icon(Icons.water_drop_outlined),
Icon(Icons.water_drop_rounded),
......@@ -107,11 +107,11 @@ void main() {
testWidgets('Another sample of icons look as expected', (WidgetTester tester) async {
await _loadIconFont();
await tester.pumpWidget(MaterialApp(
await tester.pumpWidget(const MaterialApp(
home: IconTheme(
data: const IconThemeData(size: 200),
data: IconThemeData(size: 200),
child: Wrap(
children: const <Icon>[
children: <Icon>[
Icon(Icons.electric_bolt),
Icon(Icons.electric_bolt_outlined),
Icon(Icons.electric_bolt_rounded),
......@@ -128,11 +128,11 @@ void main() {
testWidgets('Another sample of icons look as expected', (WidgetTester tester) async {
await _loadIconFont();
await tester.pumpWidget(MaterialApp(
await tester.pumpWidget(const MaterialApp(
home: IconTheme(
data: const IconThemeData(size: 200),
data: IconThemeData(size: 200),
child: Wrap(
children: const <Icon>[
children: <Icon>[
Icon(Icons.repeat_on),
Icon(Icons.repeat_on_outlined),
Icon(Icons.repeat_on_rounded),
......
......@@ -5903,14 +5903,14 @@ void main() {
};
try {
await tester.pumpWidget(
MaterialApp(
const MaterialApp(
home: Center(
child: Directionality(
textDirection: TextDirection.ltr,
child: InputDecorator(
decoration: const InputDecoration(),
decoration: InputDecoration(),
child: Stack(
children: const <Widget>[
children: <Widget>[
SizedBox(height: 0),
Positioned(
bottom: 5,
......
......@@ -2652,10 +2652,10 @@ void main() {
navigationRail: NavigationRail(
labelType: NavigationRailLabelType.none,
selectedIndex: 0,
destinations: <NavigationRailDestination>[
destinations: const <NavigationRailDestination>[
NavigationRailDestination(
icon: Stack(
children: const <Widget>[
children: <Widget>[
Icon(Icons.umbrella),
Positioned(
top: 0,
......@@ -2667,13 +2667,13 @@ void main() {
),
],
),
label: const Text('Abc'),
label: Text('Abc'),
),
const NavigationRailDestination(
NavigationRailDestination(
icon: Icon(Icons.umbrella),
label: Text('Def'),
),
const NavigationRailDestination(
NavigationRailDestination(
icon: Icon(Icons.bookmark_border),
label: Text('Ghi'),
),
......@@ -4867,10 +4867,10 @@ void main() {
navigationRail: NavigationRail(
labelType: NavigationRailLabelType.none,
selectedIndex: 0,
destinations: <NavigationRailDestination>[
destinations: const <NavigationRailDestination>[
NavigationRailDestination(
icon: Stack(
children: const <Widget>[
children: <Widget>[
Icon(Icons.umbrella),
Positioned(
top: 0,
......@@ -4882,13 +4882,13 @@ void main() {
),
],
),
label: const Text('Abc'),
label: Text('Abc'),
),
const NavigationRailDestination(
NavigationRailDestination(
icon: Icon(Icons.umbrella),
label: Text('Def'),
),
const NavigationRailDestination(
NavigationRailDestination(
icon: Icon(Icons.bookmark_border),
label: Text('Ghi'),
),
......
......@@ -230,23 +230,23 @@ void main() {
addRepaintBoundaries: false,
addSemanticIndexes: false,
cacheExtent: 0.0,
children: <Widget>[
children: const <Widget>[
AutomaticKeepAlive(
child: SizedBox(
height: 400.0,
child: Stack(children: const <Widget>[
child: Stack(children: <Widget>[
Leaf(key: GlobalObjectKey<_LeafState>(0), child: Placeholder()),
Leaf(key: GlobalObjectKey<_LeafState>(1), child: Placeholder()),
]),
),
),
const AutomaticKeepAlive(
AutomaticKeepAlive(
child: SizedBox(
key: GlobalObjectKey<_LeafState>(2),
height: 400.0,
),
),
const AutomaticKeepAlive(
AutomaticKeepAlive(
child: SizedBox(
key: GlobalObjectKey<_LeafState>(3),
height: 400.0,
......@@ -314,11 +314,11 @@ void main() {
addRepaintBoundaries: false,
addSemanticIndexes: false,
cacheExtent: 0.0,
children: <Widget>[
children: const <Widget>[
AutomaticKeepAlive(
child: SizedBox(
height: 400.0,
child: Stack(children: const <Widget>[
child: Stack(children: <Widget>[
Leaf(key: GlobalObjectKey<_LeafState>(0), child: Placeholder()),
Leaf(key: GlobalObjectKey<_LeafState>(1), child: Placeholder()),
]),
......@@ -327,7 +327,7 @@ void main() {
AutomaticKeepAlive(
child: SizedBox(
height: 400.0,
child: Stack(children: const <Widget>[
child: Stack(children: <Widget>[
Leaf(key: GlobalObjectKey<_LeafState>(2), child: Placeholder()),
Leaf(key: GlobalObjectKey<_LeafState>(3), child: Placeholder()),
]),
......@@ -336,7 +336,7 @@ void main() {
AutomaticKeepAlive(
child: SizedBox(
height: 400.0,
child: Stack(children: const <Widget>[
child: Stack(children: <Widget>[
Leaf(key: GlobalObjectKey<_LeafState>(4), child: Placeholder()),
Leaf(key: GlobalObjectKey<_LeafState>(5), child: Placeholder()),
]),
......@@ -370,11 +370,11 @@ void main() {
addRepaintBoundaries: false,
addSemanticIndexes: false,
cacheExtent: 0.0,
children: <Widget>[
children: const <Widget>[
AutomaticKeepAlive(
child: SizedBox(
height: 400.0,
child: Stack(children: const <Widget>[
child: Stack(children: <Widget>[
Leaf(key: GlobalObjectKey<_LeafState>(1), child: Placeholder()),
]),
),
......@@ -382,7 +382,7 @@ void main() {
AutomaticKeepAlive(
child: SizedBox(
height: 400.0,
child: Stack(children: const <Widget>[
child: Stack(children: <Widget>[
Leaf(key: GlobalObjectKey<_LeafState>(2), child: Placeholder()),
Leaf(key: GlobalObjectKey<_LeafState>(3), child: Placeholder()),
]),
......@@ -391,7 +391,7 @@ void main() {
AutomaticKeepAlive(
child: SizedBox(
height: 400.0,
child: Stack(children: const <Widget>[
child: Stack(children: <Widget>[
Leaf(key: GlobalObjectKey<_LeafState>(4), child: Placeholder()),
Leaf(key: GlobalObjectKey<_LeafState>(5), child: Placeholder()),
Leaf(key: GlobalObjectKey<_LeafState>(0), child: Placeholder()),
......@@ -434,11 +434,11 @@ void main() {
addRepaintBoundaries: false,
addSemanticIndexes: false,
cacheExtent: 0.0,
children: <Widget>[
children: const <Widget>[
AutomaticKeepAlive(
child: SizedBox(
height: 400.0,
child: Stack(children: const <Widget>[
child: Stack(children: <Widget>[
Leaf(key: GlobalObjectKey<_LeafState>(1), child: Placeholder()),
Leaf(key: GlobalObjectKey<_LeafState>(2), child: Placeholder()),
]),
......@@ -453,7 +453,7 @@ void main() {
AutomaticKeepAlive(
child: SizedBox(
height: 400.0,
child: Stack(children: const <Widget>[
child: Stack(children: <Widget>[
Leaf(key: GlobalObjectKey<_LeafState>(3), child: Placeholder()),
Leaf(key: GlobalObjectKey<_LeafState>(4), child: Placeholder()),
Leaf(key: GlobalObjectKey<_LeafState>(5), child: Placeholder()),
......
......@@ -911,12 +911,12 @@ void main() {
testWidgets('Wrap implements debugFillProperties', (WidgetTester tester) async {
final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder();
Wrap(
const Wrap(
spacing: 8.0, // gap between adjacent Text widget
runSpacing: 4.0, // gap between lines
textDirection: TextDirection.ltr,
verticalDirection: VerticalDirection.up,
children: const <Widget>[
children: <Widget>[
Text('Hamilton'),
Text('Lafayette'),
Text('Mulligan'),
......
......@@ -12,7 +12,7 @@ void main() {
testWidgets('GlobalKey children of one node', (WidgetTester tester) async {
// This is actually a test of the regular duplicate key logic, which
// happens before the duplicate GlobalKey logic.
await tester.pumpWidget(Stack(children: const <Widget>[
await tester.pumpWidget(const Stack(children: <Widget>[
DummyWidget(key: GlobalObjectKey(0)),
DummyWidget(key: GlobalObjectKey(0)),
]));
......@@ -24,9 +24,9 @@ void main() {
});
testWidgets('GlobalKey children of two nodes - A', (WidgetTester tester) async {
await tester.pumpWidget(Stack(
await tester.pumpWidget(const Stack(
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
DummyWidget(child: DummyWidget(key: GlobalObjectKey(0))),
DummyWidget(
child: DummyWidget(key: GlobalObjectKey(0),
......@@ -44,9 +44,9 @@ void main() {
});
testWidgets('GlobalKey children of two different nodes - B', (WidgetTester tester) async {
await tester.pumpWidget(Stack(
await tester.pumpWidget(const Stack(
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
DummyWidget(child: DummyWidget(key: GlobalObjectKey(0))),
DummyWidget(key: Key('x'), child: DummyWidget(key: GlobalObjectKey(0))),
],
......
......@@ -31,7 +31,7 @@ void main() {
testWidgets('ListBody down', (WidgetTester tester) async {
await tester.pumpWidget(Flex(
direction: Axis.vertical,
children: <Widget>[ ListBody(children: children) ],
children: const <Widget>[ ListBody(children: children) ],
));
expectRects(
......@@ -48,7 +48,7 @@ void main() {
testWidgets('ListBody up', (WidgetTester tester) async {
await tester.pumpWidget(Flex(
direction: Axis.vertical,
children: <Widget>[ ListBody(reverse: true, children: children) ],
children: const <Widget>[ ListBody(reverse: true, children: children) ],
));
expectRects(
......@@ -66,7 +66,7 @@ void main() {
await tester.pumpWidget(Flex(
textDirection: TextDirection.ltr,
direction: Axis.horizontal,
children: <Widget>[
children: const <Widget>[
Directionality(
textDirection: TextDirection.ltr,
child: ListBody(mainAxis: Axis.horizontal, children: children),
......@@ -89,7 +89,7 @@ void main() {
await tester.pumpWidget(Flex(
textDirection: TextDirection.ltr,
direction: Axis.horizontal,
children: <Widget>[
children: const <Widget>[
Directionality(
textDirection: TextDirection.rtl,
child: ListBody(mainAxis: Axis.horizontal, children: children),
......@@ -114,7 +114,7 @@ void main() {
FlutterError.onError = (FlutterErrorDetails error) => errors.add(error);
try {
await tester.pumpWidget(
SizedBox(
const SizedBox(
width: 100,
height: 100,
child: Directionality(
......@@ -159,7 +159,7 @@ void main() {
Flex(
textDirection: TextDirection.ltr,
direction: Axis.vertical,
children: <Widget>[
children: const <Widget>[
Directionality(
textDirection: TextDirection.ltr,
child: ListBody(
......
......@@ -910,9 +910,9 @@ void main() {
});
testWidgets('uses default mouse cursor', (WidgetTester tester) async {
await tester.pumpWidget(Stack(
await tester.pumpWidget(const Stack(
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
MouseRegion(cursor: SystemMouseCursors.click),
ModalBarrier(dismissible: false),
],
......
......@@ -35,9 +35,9 @@ void main() {
testWidgets('MultiChildRenderObjectElement control test', (WidgetTester tester) async {
await tester.pumpWidget(
Stack(
const Stack(
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
DecoratedBox(decoration: kBoxDecorationA),
DecoratedBox(decoration: kBoxDecorationB),
DecoratedBox(decoration: kBoxDecorationC),
......@@ -48,9 +48,9 @@ void main() {
checkTree(tester, <BoxDecoration>[kBoxDecorationA, kBoxDecorationB, kBoxDecorationC]);
await tester.pumpWidget(
Stack(
const Stack(
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
DecoratedBox(decoration: kBoxDecorationA),
DecoratedBox(decoration: kBoxDecorationC),
],
......@@ -60,9 +60,9 @@ void main() {
checkTree(tester, <BoxDecoration>[kBoxDecorationA, kBoxDecorationC]);
await tester.pumpWidget(
Stack(
const Stack(
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
DecoratedBox(decoration: kBoxDecorationA),
DecoratedBox(key: Key('b'), decoration: kBoxDecorationB),
DecoratedBox(decoration: kBoxDecorationC),
......@@ -73,9 +73,9 @@ void main() {
checkTree(tester, <BoxDecoration>[kBoxDecorationA, kBoxDecorationB, kBoxDecorationC]);
await tester.pumpWidget(
Stack(
const Stack(
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
DecoratedBox(key: Key('b'), decoration: kBoxDecorationB),
DecoratedBox(decoration: kBoxDecorationC),
DecoratedBox(key: Key('a'), decoration: kBoxDecorationA),
......@@ -86,9 +86,9 @@ void main() {
checkTree(tester, <BoxDecoration>[kBoxDecorationB, kBoxDecorationC, kBoxDecorationA]);
await tester.pumpWidget(
Stack(
const Stack(
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
DecoratedBox(key: Key('a'), decoration: kBoxDecorationA),
DecoratedBox(decoration: kBoxDecorationC),
DecoratedBox(key: Key('b'), decoration: kBoxDecorationB),
......@@ -99,9 +99,9 @@ void main() {
checkTree(tester, <BoxDecoration>[kBoxDecorationA, kBoxDecorationC, kBoxDecorationB]);
await tester.pumpWidget(
Stack(
const Stack(
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
DecoratedBox(decoration: kBoxDecorationC),
],
),
......@@ -110,7 +110,7 @@ void main() {
checkTree(tester, <BoxDecoration>[kBoxDecorationC]);
await tester.pumpWidget(
Stack(textDirection: TextDirection.ltr),
const Stack(textDirection: TextDirection.ltr),
);
checkTree(tester, <BoxDecoration>[]);
......@@ -120,9 +120,9 @@ void main() {
testWidgets('MultiChildRenderObjectElement with stateless widgets', (WidgetTester tester) async {
await tester.pumpWidget(
Stack(
const Stack(
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
DecoratedBox(decoration: kBoxDecorationA),
DecoratedBox(decoration: kBoxDecorationB),
DecoratedBox(decoration: kBoxDecorationC),
......@@ -133,9 +133,9 @@ void main() {
checkTree(tester, <BoxDecoration>[kBoxDecorationA, kBoxDecorationB, kBoxDecorationC]);
await tester.pumpWidget(
Stack(
const Stack(
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
DecoratedBox(decoration: kBoxDecorationA),
DummyWidget(
child: DecoratedBox(decoration: kBoxDecorationB),
......@@ -148,9 +148,9 @@ void main() {
checkTree(tester, <BoxDecoration>[kBoxDecorationA, kBoxDecorationB, kBoxDecorationC]);
await tester.pumpWidget(
Stack(
const Stack(
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
DecoratedBox(decoration: kBoxDecorationA),
DummyWidget(
child: DummyWidget(
......@@ -165,9 +165,9 @@ void main() {
checkTree(tester, <BoxDecoration>[kBoxDecorationA, kBoxDecorationB, kBoxDecorationC]);
await tester.pumpWidget(
Stack(
const Stack(
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
DummyWidget(
child: DummyWidget(
child: DecoratedBox(decoration: kBoxDecorationB),
......@@ -184,9 +184,9 @@ void main() {
checkTree(tester, <BoxDecoration>[kBoxDecorationB, kBoxDecorationA, kBoxDecorationC]);
await tester.pumpWidget(
Stack(
const Stack(
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
DummyWidget(
child: DecoratedBox(decoration: kBoxDecorationB),
),
......@@ -201,9 +201,9 @@ void main() {
checkTree(tester, <BoxDecoration>[kBoxDecorationB, kBoxDecorationA, kBoxDecorationC]);
await tester.pumpWidget(
Stack(
const Stack(
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
DummyWidget(
key: Key('b'),
child: DecoratedBox(decoration: kBoxDecorationB),
......@@ -219,9 +219,9 @@ void main() {
checkTree(tester, <BoxDecoration>[kBoxDecorationB, kBoxDecorationA]);
await tester.pumpWidget(
Stack(
const Stack(
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
DummyWidget(
key: Key('a'),
child: DecoratedBox(decoration: kBoxDecorationA),
......@@ -237,7 +237,7 @@ void main() {
checkTree(tester, <BoxDecoration>[kBoxDecorationA, kBoxDecorationB]);
await tester.pumpWidget(
Stack(textDirection: TextDirection.ltr),
const Stack(textDirection: TextDirection.ltr),
);
checkTree(tester, <BoxDecoration>[]);
......@@ -245,9 +245,9 @@ void main() {
testWidgets('MultiChildRenderObjectElement with stateful widgets', (WidgetTester tester) async {
await tester.pumpWidget(
Stack(
const Stack(
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
DecoratedBox(decoration: kBoxDecorationA),
DecoratedBox(decoration: kBoxDecorationB),
],
......@@ -257,9 +257,9 @@ void main() {
checkTree(tester, <BoxDecoration>[kBoxDecorationA, kBoxDecorationB]);
await tester.pumpWidget(
Stack(
const Stack(
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
FlipWidget(
left: DecoratedBox(decoration: kBoxDecorationA),
right: DecoratedBox(decoration: kBoxDecorationB),
......@@ -277,9 +277,9 @@ void main() {
checkTree(tester, <BoxDecoration>[kBoxDecorationB, kBoxDecorationC]);
await tester.pumpWidget(
Stack(
const Stack(
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
FlipWidget(
left: DecoratedBox(decoration: kBoxDecorationA),
right: DecoratedBox(decoration: kBoxDecorationB),
......@@ -296,9 +296,9 @@ void main() {
checkTree(tester, <BoxDecoration>[kBoxDecorationA]);
await tester.pumpWidget(
Stack(
const Stack(
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
FlipWidget(
key: Key('flip'),
left: DecoratedBox(decoration: kBoxDecorationA),
......@@ -309,9 +309,9 @@ void main() {
);
await tester.pumpWidget(
Stack(
const Stack(
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
DecoratedBox(key: Key('c'), decoration: kBoxDecorationC),
FlipWidget(
key: Key('flip'),
......@@ -330,9 +330,9 @@ void main() {
checkTree(tester, <BoxDecoration>[kBoxDecorationC, kBoxDecorationB]);
await tester.pumpWidget(
Stack(
const Stack(
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
FlipWidget(
key: Key('flip'),
left: DecoratedBox(decoration: kBoxDecorationA),
......
......@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('OverflowBar documented defaults', (WidgetTester tester) async {
final OverflowBar bar = OverflowBar();
const OverflowBar bar = OverflowBar();
expect(bar.spacing, 0);
expect(bar.alignment, null);
expect(bar.overflowSpacing, 0);
......@@ -26,7 +26,7 @@ void main() {
child: Center(
child: ConstrainedBox(
constraints: BoxConstraints.tight(size),
child: OverflowBar(),
child: const OverflowBar(),
),
),
),
......@@ -35,7 +35,7 @@ void main() {
expect(tester.getSize(find.byType(OverflowBar)), size);
await tester.pumpWidget(
Directionality(
const Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: OverflowBar(),
......@@ -182,11 +182,11 @@ void main() {
child: Container(
width: width,
alignment: Alignment.topLeft,
child: IntrinsicWidth(
child: const IntrinsicWidth(
child: OverflowBar(
spacing: 4,
overflowSpacing: 8,
children: const <Widget>[
children: <Widget>[
SizedBox(width: 48, height: 50),
SizedBox(width: 64, height: 25),
SizedBox(width: 32, height: 75),
......@@ -213,11 +213,11 @@ void main() {
child: Container(
width: maxWidth,
alignment: Alignment.topLeft,
child: IntrinsicHeight(
child: const IntrinsicHeight(
child: OverflowBar(
spacing: 4,
overflowSpacing: 8,
children: const <Widget>[
children: <Widget>[
SizedBox(width: 48, height: 50),
SizedBox(width: 64, height: 25),
SizedBox(width: 32, height: 75),
......
......@@ -51,9 +51,9 @@ final TestParentData kNonPositioned = TestParentData();
void main() {
testWidgets('ParentDataWidget control test', (WidgetTester tester) async {
await tester.pumpWidget(
Stack(
const Stack(
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
DecoratedBox(decoration: kBoxDecorationA),
Positioned(
top: 10.0,
......@@ -72,9 +72,9 @@ void main() {
]);
await tester.pumpWidget(
Stack(
const Stack(
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
Positioned(
bottom: 5.0,
right: 7.0,
......@@ -101,9 +101,9 @@ void main() {
const DecoratedBox kDecoratedBoxC = DecoratedBox(decoration: kBoxDecorationC);
await tester.pumpWidget(
Stack(
const Stack(
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
Positioned(
bottom: 5.0,
right: 7.0,
......@@ -126,9 +126,9 @@ void main() {
]);
await tester.pumpWidget(
Stack(
const Stack(
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
Positioned(
bottom: 6.0,
right: 8.0,
......@@ -197,9 +197,9 @@ void main() {
]);
await tester.pumpWidget(
Stack(
const Stack(
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
Positioned(
right: 10.0,
child: FlipWidget(left: kDecoratedBoxA, right: kDecoratedBoxB),
......@@ -220,9 +220,9 @@ void main() {
]);
await tester.pumpWidget(
Stack(
const Stack(
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
Positioned(
top: 7.0,
child: FlipWidget(left: kDecoratedBoxA, right: kDecoratedBoxB),
......@@ -243,7 +243,7 @@ void main() {
]);
await tester.pumpWidget(
Stack(textDirection: TextDirection.ltr),
const Stack(textDirection: TextDirection.ltr),
);
checkTree(tester, <TestParentData>[]);
......@@ -251,11 +251,11 @@ void main() {
testWidgets('ParentDataWidget conflicting data', (WidgetTester tester) async {
await tester.pumpWidget(
Directionality(
const Directionality(
textDirection: TextDirection.ltr,
child: Stack(
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
Positioned(
top: 5.0,
bottom: 8.0,
......@@ -287,7 +287,7 @@ void main() {
),
);
await tester.pumpWidget(Stack(textDirection: TextDirection.ltr));
await tester.pumpWidget(const Stack(textDirection: TextDirection.ltr));
checkTree(tester, <TestParentData>[]);
......@@ -325,7 +325,7 @@ void main() {
);
await tester.pumpWidget(
Stack(textDirection: TextDirection.ltr),
const Stack(textDirection: TextDirection.ltr),
);
checkTree(tester, <TestParentData>[]);
......
......@@ -13,11 +13,11 @@ void main() {
expect(tester.renderObject<RenderBox>(find.byType(Placeholder)).size, const Size(800.0, 600.0));
await tester.pumpWidget(const Center(child: Placeholder()));
expect(tester.renderObject<RenderBox>(find.byType(Placeholder)).size, const Size(800.0, 600.0));
await tester.pumpWidget(Stack(textDirection: TextDirection.ltr, children: const <Widget>[Positioned(top: 0.0, bottom: 0.0, child: Placeholder())]));
await tester.pumpWidget(const Stack(textDirection: TextDirection.ltr, children: <Widget>[Positioned(top: 0.0, bottom: 0.0, child: Placeholder())]));
expect(tester.renderObject<RenderBox>(find.byType(Placeholder)).size, const Size(400.0, 600.0));
await tester.pumpWidget(Stack(textDirection: TextDirection.ltr, children: const <Widget>[Positioned(left: 0.0, right: 0.0, child: Placeholder())]));
await tester.pumpWidget(const Stack(textDirection: TextDirection.ltr, children: <Widget>[Positioned(left: 0.0, right: 0.0, child: Placeholder())]));
expect(tester.renderObject<RenderBox>(find.byType(Placeholder)).size, const Size(800.0, 400.0));
await tester.pumpWidget(Stack(textDirection: TextDirection.ltr, children: const <Widget>[Positioned(top: 0.0, child: Placeholder(fallbackWidth: 200.0, fallbackHeight: 300.0))]));
await tester.pumpWidget(const Stack(textDirection: TextDirection.ltr, children: <Widget>[Positioned(top: 0.0, child: Placeholder(fallbackWidth: 200.0, fallbackHeight: 300.0))]));
expect(tester.renderObject<RenderBox>(find.byType(Placeholder)).size, const Size(200.0, 300.0));
});
......
......@@ -210,7 +210,7 @@ void main() {
onTapInside: (PointerEvent event) {
tappedInside.add(noGroupKey.value);
},
child: Stack(key: noGroupKey),
child: const Stack(key: noGroupKey),
),
),
ConstrainedBox(
......@@ -221,7 +221,7 @@ void main() {
onTapInside: (PointerEvent event) {
tappedInside.add(group1AKey.value);
},
child: Stack(key: group1AKey),
child: const Stack(key: group1AKey),
),
),
ConstrainedBox(
......@@ -232,7 +232,7 @@ void main() {
onTapInside: (PointerEvent event) {
tappedInside.add(group1BKey.value);
},
child: Stack(key: group1BKey),
child: const Stack(key: group1BKey),
),
),
],
......
......@@ -1332,21 +1332,21 @@ void main() {
height: 100,
child: IntrinsicWidth(
child: RichText(
text: TextSpan(
style: const TextStyle(fontSize: 16, height: 1),
text: const TextSpan(
style: TextStyle(fontSize: 16, height: 1),
children: <InlineSpan>[
const TextSpan(text: 'S '),
TextSpan(text: 'S '),
WidgetSpan(
alignment: PlaceholderAlignment.top,
child: Wrap(
direction: Axis.vertical,
children: const <Widget>[
children: <Widget>[
SizedBox(width: 200, height: 100),
SizedBox(width: 200, height: 30),
],
),
),
const TextSpan(text: ' E'),
TextSpan(text: ' E'),
],
),
),
......
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