Make Flex,Row,Column const for real (#119673)

* Make Flex,Row,Column const for real

* dart fix --apply

* fix snippets

* fix integration test

* add comment
This commit is contained in:
Michael Goderbauer 2023-02-02 11:33:57 -08:00 committed by GitHub
parent 3f986e4238
commit b0f1714b7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
107 changed files with 520 additions and 515 deletions

View File

@ -14,15 +14,15 @@ void main() {
appBar: AppBar(
title: const Text('RenderFlex OverFlow'),
),
body: SizedBox(
body: const SizedBox(
width: 400.0,
child: Row(
children: <Widget>[
const Icon(Icons.message),
Icon(Icons.message),
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: const <Widget>[
children: <Widget>[
Text('Title'),
Text(
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed '

View File

@ -279,11 +279,11 @@ class IconBar extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(left: 16.0, right: 16.0),
return const Padding(
padding: EdgeInsets.only(left: 16.0, right: 16.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: const <Widget>[
children: <Widget>[
IconWithText(Icons.thumb_up, 'Like'),
IconWithText(Icons.comment, 'Comment'),
IconWithText(Icons.share, 'Share'),
@ -578,9 +578,9 @@ class BottomBar extends StatelessWidget {
),
),
),
child: Row(
child: const Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: const <Widget>[
children: <Widget>[
BottomBarButton(Icons.new_releases, 'News'),
BottomBarButton(Icons.people, 'Requests'),
BottomBarButton(Icons.chat, 'Messenger'),

View File

@ -12,10 +12,10 @@ class CubicBezierPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(
return const Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
Bezier(Colors.amber, 1.0),
],
),

View File

@ -88,9 +88,9 @@ class StackSizePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Material(
return const Material(
child: Column(
children: const <Widget>[
children: <Widget>[
SizedBox(
width: 200,
height: 100,

View File

@ -9,10 +9,10 @@ class TextPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Material(
return const Material(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
SizedBox(
width: 200,
height: 100,

View File

@ -20,10 +20,10 @@ class BenchSimpleLazyTextScroll extends WidgetRecorder {
@override
Widget createWidget() {
return Directionality(
return const Directionality(
textDirection: TextDirection.ltr,
child: Row(
children: const <Widget>[
children: <Widget>[
Flexible(
child: _TestScrollingWidget(
initialScrollOffset: 0,

View File

@ -28,8 +28,8 @@ Future<void> main() async {
Icon(Icons.ac_unit),
],
),
body: Column(
children: const <Widget>[
body: const Column(
children: <Widget>[
Text('Item 1'),
Text('Item 2'),
Text('Item 3'),

View File

@ -345,8 +345,8 @@ class _CreateCompanySheet extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Column(
children: const <Widget>[
return const Column(
children: <Widget>[
TextField(
autofocus: true,
decoration: InputDecoration(

View File

@ -59,9 +59,9 @@ class SecondPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
return const Scaffold(
body: Column(
children: const <Widget>[
children: <Widget>[
Expanded(
child: AndroidView(viewType: 'simple')
),

View File

@ -57,8 +57,8 @@ class _CupertinoSwitchDemoState extends State<CupertinoSwitchDemo> {
),
Semantics(
container: true,
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
CupertinoSwitch(
value: true,
onChanged: null,
@ -71,8 +71,8 @@ class _CupertinoSwitchDemoState extends State<CupertinoSwitchDemo> {
),
Semantics(
container: true,
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
CupertinoSwitch(
value: false,
onChanged: null,

View File

@ -402,9 +402,9 @@ class _DemoDrawer extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Drawer(
return const Drawer(
child: Column(
children: const <Widget>[
children: <Widget>[
ListTile(
leading: Icon(Icons.search),
title: Text('Search'),

View File

@ -70,13 +70,13 @@ class _SearchDemoState extends State<SearchDemo> {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
MergeSemantics(
const MergeSemantics(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
Text('Press the '),
Tooltip(
message: 'search',
@ -88,7 +88,7 @@ class _SearchDemoState extends State<SearchDemo> {
Text(' icon in the AppBar'),
],
),
const Text('and search for an integer between 0 and 100,000.'),
Text('and search for an integer between 0 and 100,000.'),
],
),
),

View File

@ -126,9 +126,9 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> {
),
],
),
Row(
const Row(
mainAxisSize: MainAxisSize.min,
children: const <Widget>[
children: <Widget>[
// Disabled checkboxes
Checkbox(value: true, onChanged: null),
Checkbox(value: false, onChanged: null),
@ -167,9 +167,9 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> {
],
),
// Disabled radio buttons
Row(
const Row(
mainAxisSize: MainAxisSize.min,
children: const <Widget>[
children: <Widget>[
Radio<int>(
value: 0,
groupValue: 0,

View File

@ -296,9 +296,9 @@ class _SlidersState extends State<_Sliders> {
const Text('Continuous with Editable Numerical Value'),
],
),
Column(
const Column(
mainAxisSize: MainAxisSize.min,
children: const <Widget>[
children: <Widget>[
Slider.adaptive(value: 0.25, onChanged: null),
Text('Disabled'),
],

View File

@ -93,10 +93,10 @@ class _TransformationsDemoState extends State<TransformationsDemo> {
Widget get instructionDialog {
return AlertDialog(
title: const Text('2D Transformations'),
content: Column(
content: const Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: const <Widget>[
children: <Widget>[
Text('Tap to edit hex tiles, and use gestures to move around the scene:\n'),
Text('- Drag to pan.'),
Text('- Pinch to zoom.'),

View File

@ -29,7 +29,7 @@ class _TestState extends State<Test> {
if (!_triggered) {
return const SizedBox.shrink();
}
return Row(children: const <Widget>[
return const Row(children: <Widget>[
SizedBox(width: 10000.0),
SizedBox(width: 10000.0),
SizedBox(width: 10000.0),

View File

@ -5,10 +5,10 @@
import 'package:flutter/material.dart';
Future<void> main() async {
runApp(Scaffold(
runApp(const Scaffold(
body: Center(
child: Column(
children: const <Widget>[
children: <Widget>[
Icon(Icons.ac_unit),
Text('Hello, World', textDirection: TextDirection.ltr),
],

View File

@ -432,25 +432,25 @@ class _FocusDemoState extends State<FocusDemo> {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Row(
const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
DemoButton(name: 'One'),
DemoButton(name: 'Two'),
DemoButton(name: 'Three'),
],
),
Row(
const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
DemoButton(name: 'Four'),
DemoButton(name: 'Five'),
DemoButton(name: 'Six'),
],
),
Row(
const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
DemoButton(name: 'Seven'),
DemoButton(name: 'Eight'),
DemoButton(name: 'Nine'),

View File

@ -270,9 +270,9 @@ class DragAndDropAppState extends State<DragAndDropApp> {
],
),
),
Expanded(
const Expanded(
child: Row(
children: const <Widget>[
children: <Widget>[
Expanded(child: ExampleDragTarget()),
Expanded(child: ExampleDragTarget()),
Expanded(child: ExampleDragTarget()),

View File

@ -152,18 +152,18 @@ class _FocusDemoState extends State<FocusDemo> {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Row(
const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
DemoButton(
name: 'One',
autofocus: true,
),
],
),
Row(
const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
DemoButton(name: 'Two'),
DemoButton(
name: 'Three',
@ -171,9 +171,9 @@ class _FocusDemoState extends State<FocusDemo> {
),
],
),
Row(
const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
DemoButton(name: 'Four'),
DemoButton(name: 'Five'),
DemoButton(name: 'Six'),

View File

@ -65,8 +65,8 @@ class TestRootState extends State<TestRoot> {
@override
Widget build(BuildContext context) {
return _showRow
? Row(
children: const <Widget>[
? const Row(
children: <Widget>[
TestChildWidget(),
TestChildWidget(),
],

View File

@ -25,8 +25,8 @@ class CupertinoIndicatorExample extends StatelessWidget {
@override
Widget build(BuildContext context) {
return CupertinoPageScaffold(
navigationBar: const CupertinoNavigationBar(
return const CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
middle: Text('CupertinoActivityIndicator Sample'),
),
child: Center(
@ -35,7 +35,7 @@ class CupertinoIndicatorExample extends StatelessWidget {
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
// Cupertino activity indicator with default properties.
CupertinoActivityIndicator(),
SizedBox(height: 10),
@ -44,7 +44,7 @@ class CupertinoIndicatorExample extends StatelessWidget {
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
// Cupertino activity indicator with custom radius and color.
CupertinoActivityIndicator(radius: 20.0, color: CupertinoColors.activeBlue),
SizedBox(height: 10),
@ -56,7 +56,7 @@ class CupertinoIndicatorExample extends StatelessWidget {
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
// Cupertino activity indicator with custom radius and disabled
// animation.
CupertinoActivityIndicator(radius: 20.0, animating: false),

View File

@ -56,33 +56,33 @@ class _CupertinoFormRowExampleState extends State<CupertinoFormRowExample> {
},
),
),
CupertinoFormRow(
prefix: const PrefixWidget(
const CupertinoFormRow(
prefix: PrefixWidget(
icon: CupertinoIcons.wifi,
title: 'Wi-Fi',
color: CupertinoColors.systemBlue,
),
error: const Text('Home network unavailable'),
error: Text('Home network unavailable'),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: const <Widget>[
children: <Widget>[
Text('Not connected'),
SizedBox(width: 5),
Icon(CupertinoIcons.forward)
],
),
),
CupertinoFormRow(
prefix: const PrefixWidget(
const CupertinoFormRow(
prefix: PrefixWidget(
icon: CupertinoIcons.bluetooth,
title: 'Bluetooth',
color: CupertinoColors.activeBlue,
),
helper: Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0),
padding: EdgeInsets.symmetric(vertical: 4.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: const <Widget>[
children: <Widget>[
Text('Headphone'),
Text('Connected'),
],
@ -90,7 +90,7 @@ class _CupertinoFormRowExampleState extends State<CupertinoFormRowExample> {
),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: const <Widget>[
children: <Widget>[
Text('On'),
SizedBox(width: 5),
Icon(CupertinoIcons.forward)

View File

@ -86,10 +86,10 @@ class NextPage extends StatelessWidget {
// when the CupertinoSliverNavigationBar is fully expanded.
largeTitle: const Text('Family'),
),
SliverFillRemaining(
const SliverFillRemaining(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: const <Widget>[
children: <Widget>[
Text('Drag me up', textAlign: TextAlign.center),
// When the "leading" parameter is omitted on a route that has a previous page,
// the back button is automatically added to the leading position.

View File

@ -30,10 +30,10 @@ class ButtonTypesExample extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(4.0),
return const Padding(
padding: EdgeInsets.all(4.0),
child: Row(
children: const <Widget>[
children: <Widget>[
Spacer(),
ButtonTypesGroup(enabled: true),
ButtonTypesGroup(enabled: false),

View File

@ -17,8 +17,8 @@ class CardExamplesApp extends StatelessWidget {
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4), useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('Card Examples')),
body: Column(
children: const <Widget>[
body: const Column(
children: <Widget>[
Spacer(),
ElevatedCardExample(),
FilledCardExample(),

View File

@ -28,11 +28,11 @@ class DividerExample extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(
return const Center(
child: Padding(
padding: const EdgeInsets.all(16.0),
padding: EdgeInsets.all(16.0),
child: Column(
children: const <Widget>[
children: <Widget>[
Expanded(
child: Card(
child: SizedBox.expand(),

View File

@ -28,11 +28,11 @@ class DividerExample extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(
return const Center(
child: Padding(
padding: const EdgeInsets.all(16.0),
padding: EdgeInsets.all(16.0),
child: Row(
children: const <Widget>[
children: <Widget>[
Expanded(
child: Card(
child: SizedBox.expand(),

View File

@ -30,10 +30,10 @@ class ButtonTypesExample extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(4.0),
return const Padding(
padding: EdgeInsets.all(4.0),
child: Row(
children: const <Widget>[
children: <Widget>[
Spacer(),
ButtonTypesGroup(enabled: true),
ButtonTypesGroup(enabled: false),

View File

@ -38,15 +38,15 @@ class DemoIconToggleButtons extends StatefulWidget {
class _DemoIconToggleButtonsState extends State<DemoIconToggleButtons> {
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
return const Padding(
padding: EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.center,
// Standard IconButton
children: const <Widget>[
children: <Widget>[
DemoIconToggleButton(isEnabled: true),
SizedBox(width: 10),
DemoIconToggleButton(isEnabled: false),
@ -54,7 +54,7 @@ class _DemoIconToggleButtonsState extends State<DemoIconToggleButtons> {
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
// Filled IconButton
DemoIconToggleButton(isEnabled: true, getDefaultStyle: enabledFilledButtonStyle,),
SizedBox(width: 10),
@ -63,7 +63,7 @@ class _DemoIconToggleButtonsState extends State<DemoIconToggleButtons> {
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
// Filled Tonal IconButton
DemoIconToggleButton(isEnabled: true, getDefaultStyle: enabledFilledTonalButtonStyle,),
SizedBox(width: 10),
@ -72,7 +72,7 @@ class _DemoIconToggleButtonsState extends State<DemoIconToggleButtons> {
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
// Outlined IconButton
DemoIconToggleButton(isEnabled: true, getDefaultStyle: enabledOutlinedButtonStyle,),
SizedBox(width: 10),

View File

@ -30,11 +30,11 @@ class MyStatelessWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
return const Padding(
padding: EdgeInsets.symmetric(horizontal: 8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
TextField(
decoration: InputDecoration(
hintText: 'Normal Icon Constraints',

View File

@ -30,11 +30,11 @@ class MyStatelessWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
return const Padding(
padding: EdgeInsets.symmetric(horizontal: 8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
TextField(
decoration: InputDecoration(
hintText: 'Normal Icon Constraints',

View File

@ -17,11 +17,11 @@ class SegmentedButtonApp extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
home: const Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
Spacer(),
Text('Single choice'),
SingleChoice(),

View File

@ -21,10 +21,10 @@ class MyApp extends StatelessWidget {
home: SelectionArea(
child: Scaffold(
appBar: AppBar(title: const Text(_title)),
body: Center(
body: const Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
Text('Select this icon', style: TextStyle(fontSize: 30)),
SizedBox(height: 10),
MySelectableAdapter(child: Icon(Icons.key, size: 30)),

View File

@ -20,10 +20,10 @@ class MyApp extends StatelessWidget {
home: SelectionArea(
child: Scaffold(
appBar: AppBar(title: const Text(_title)),
body: Center(
body: const Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
Text('Row 1'),
Text('Row 2'),
Text('Row 3'),

View File

@ -21,11 +21,11 @@ class MyApp extends StatelessWidget {
home: SelectionArea(
child: Scaffold(
appBar: AppBar(title: const Text(_title)),
body: Center(
body: const Center(
child: SelectionAllOrNoneContainer(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
Text('Row 1'),
Text('Row 2'),
Text('Row 3'),

View File

@ -19,11 +19,11 @@ class MyApp extends StatelessWidget {
title: _title,
home: Scaffold(
appBar: AppBar(title: const Text(_title)),
body: Center(
body: const Center(
child: SelectionArea(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
Text('Selectable text'),
SelectionContainer.disabled(child: Text('Non-selectable text')),
Text('Selectable text'),

View File

@ -17,8 +17,8 @@ class TextFieldExamplesApp extends StatelessWidget {
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4), useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('TextField Examples')),
body: Column(
children: const <Widget>[
body: const Column(
children: <Widget>[
Spacer(),
FilledTextFieldExample(),
OutlinedTextFieldExample(),

View File

@ -64,14 +64,14 @@ class VerificationCodeGenerator extends StatelessWidget {
Widget build(BuildContext context) {
return Actions(
actions: <Type, Action<Intent>> { CopyTextIntent: CallbackAction<CopyTextIntent>(onInvoke: _copy) },
child: Column(
child: const Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text('Press Ctrl-C to Copy'),
const SizedBox(height: 10),
Text('Press Ctrl-C to Copy'),
SizedBox(height: 10),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
CopyableText(text: '111'),
SizedBox(width: 5,),
CopyableText(text: '222'),

View File

@ -64,25 +64,25 @@ class MyStatelessWidget extends StatelessWidget {
Widget build(BuildContext context) {
return FocusTraversalGroup(
policy: OrderedTraversalPolicy(),
child: Column(
child: const Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
DemoButton(name: 'Six', order: 6),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
DemoButton(name: 'Five', order: 5),
DemoButton(name: 'Four', order: 4),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
DemoButton(name: 'Three', order: 3),
DemoButton(name: 'Two', order: 2),
DemoButton(name: 'One', order: 1, autofocus: true),

View File

@ -90,9 +90,9 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget>
Widget build(BuildContext context) {
return SpinModel(
notifier: _controller,
child: Row(
child: const Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: const <Widget>[
children: <Widget>[
Spinner(),
Spinner(),
Spinner(),

View File

@ -61,8 +61,8 @@ class _OverlayExampleState extends State<OverlayExample> {
Builder(builder: (BuildContext context) {
switch (currentPageIndex) {
case 0:
return Column(
children: const <Widget>[
return const Column(
children: <Widget>[
Text(
'Explore page',
style: TextStyle(
@ -76,8 +76,8 @@ class _OverlayExampleState extends State<OverlayExample> {
],
);
case 1:
return Column(
children: const <Widget>[
return const Column(
children: <Widget>[
Text(
'Commute page',
style: TextStyle(
@ -91,8 +91,8 @@ class _OverlayExampleState extends State<OverlayExample> {
],
);
case 2:
return Column(
children: const <Widget>[
return const Column(
children: <Widget>[
Text(
'Saved page',
style: TextStyle(

View File

@ -56,10 +56,10 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
},
),
},
child: Focus(
child: const Focus(
autofocus: true,
child: Column(
children: const <Widget>[
children: <Widget>[
Text('Press question mark for help'),
],
),

View File

@ -152,9 +152,9 @@ class ListenableBuilderExample extends StatelessWidget {
// The container background will change color to this when
// the subtree has focus.
focusedColor: Colors.blue.shade50,
child: Column(
child: const Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: const <Widget>[
children: <Widget>[
Text('Owner:'),
MyField(label: 'First Name'),
MyField(label: 'Last Name'),

View File

@ -6,13 +6,13 @@ import 'package:flutter/material.dart';
void main() {
runApp(
DecoratedBox(
decoration: const BoxDecoration(color: Colors.white),
const DecoratedBox(
decoration: BoxDecoration(color: Colors.white),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
FlutterLogo(size: 48),
Padding(
padding: EdgeInsets.all(32),

View File

@ -30,9 +30,9 @@ import 'package:flutter/widgets.dart';
/// ![The following code snippet would generate a row of icons consisting of a pink heart, a green bell, and a blue umbrella, each progressively bigger than the last.](https://flutter.github.io/assets-for-api-docs/assets/cupertino/cupertino_icon.png)
///
/// ```dart
/// Row(
/// const Row(
/// mainAxisAlignment: MainAxisAlignment.spaceAround,
/// children: const <Widget>[
/// children: <Widget>[
/// Icon(
/// CupertinoIcons.heart_fill,
/// color: Colors.pink,

View File

@ -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,

View File

@ -119,9 +119,9 @@ class PlatformAdaptiveIcons implements Icons {
/// ![The following code snippet would generate a row of icons consisting of a pink heart, a green musical note, and a blue umbrella, each progressively bigger than the last.](https://flutter.github.io/assets-for-api-docs/assets/widgets/icon.png)
///
/// ```dart
/// Row(
/// const Row(
/// mainAxisAlignment: MainAxisAlignment.spaceAround,
/// children: const <Widget>[
/// children: <Widget>[
/// Icon(
/// Icons.favorite,
/// color: Colors.pink,

View File

@ -160,8 +160,8 @@ enum ListTileControlAffinity {
/// whereas a [Row] does not constrain its children.
///
/// ```dart
/// Row(
/// children: const <Widget>[
/// const Row(
/// children: <Widget>[
/// Expanded(
/// child: ListTile(
/// leading: FlutterLogo(),

View File

@ -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(

View File

@ -4445,9 +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.
// TODO(goderbauer): Figure out whether this can be const.
// ignore: prefer_const_constructors_in_immutables
Flex({
const Flex({
super.key,
required this.direction,
this.mainAxisAlignment = MainAxisAlignment.start,
@ -4458,7 +4456,8 @@ class Flex extends MultiChildRenderObjectWidget {
this.textBaseline, // NO DEFAULT: we don't know what the text's baseline should be
this.clipBehavior = Clip.none,
super.children,
}) : assert(crossAxisAlignment != CrossAxisAlignment.baseline || textBaseline != null, 'textBaseline is required if you specify the crossAxisAlignment with CrossAxisAlignment.baseline');
}) : assert(!identical(crossAxisAlignment, CrossAxisAlignment.baseline) || textBaseline != null, 'textBaseline is required if you specify the crossAxisAlignment with CrossAxisAlignment.baseline');
// Cannot use == in the assert above instead of identical because of https://github.com/dart-lang/language/issues/1811.
/// The direction to use as the main axis.
///
@ -4649,8 +4648,8 @@ class Flex extends MultiChildRenderObjectWidget {
/// ![](https://flutter.github.io/assets-for-api-docs/assets/widgets/row.png)
///
/// ```dart
/// Row(
/// children: const <Widget>[
/// const Row(
/// children: <Widget>[
/// Expanded(
/// child: Text('Deliver features faster', textAlign: TextAlign.center),
/// ),
@ -4684,8 +4683,8 @@ class Flex extends MultiChildRenderObjectWidget {
/// Suppose, for instance, that you had this code:
///
/// ```dart
/// Row(
/// children: const <Widget>[
/// const Row(
/// children: <Widget>[
/// FlutterLogo(),
/// Text("Flutter's hot reload helps you quickly and easily experiment, build UIs, add features, and fix bug faster. Experience sub-second reload times, without losing state, on emulators, simulators, and hardware for iOS and Android."),
/// Icon(Icons.sentiment_very_satisfied),
@ -4711,8 +4710,8 @@ class Flex extends MultiChildRenderObjectWidget {
/// row that the child should be given the remaining room:
///
/// ```dart
/// Row(
/// children: const <Widget>[
/// const Row(
/// children: <Widget>[
/// FlutterLogo(),
/// Expanded(
/// child: Text("Flutter's hot reload helps you quickly and easily experiment, build UIs, add features, and fix bug faster. Experience sub-second reload times, without losing state, on emulators, simulators, and hardware for iOS and Android."),
@ -4740,9 +4739,9 @@ class Flex extends MultiChildRenderObjectWidget {
/// [TextDirection.rtl]. This is shown in the example below
///
/// ```dart
/// Row(
/// const Row(
/// textDirection: TextDirection.rtl,
/// children: const <Widget>[
/// children: <Widget>[
/// FlutterLogo(),
/// Expanded(
/// child: Text("Flutter's hot reload helps you quickly and easily experiment, build UIs, add features, and fix bug faster. Experience sub-second reload times, without losing state, on emulators, simulators, and hardware for iOS and Android."),
@ -4814,7 +4813,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,
@ -4851,8 +4850,8 @@ class Row extends Flex {
/// ![Using the Column in this way creates two short lines of text with a large Flutter underneath.](https://flutter.github.io/assets-for-api-docs/assets/widgets/column.png)
///
/// ```dart
/// Column(
/// children: const <Widget>[
/// const Column(
/// children: <Widget>[
/// Text('Deliver features faster'),
/// Text('Craft beautiful UIs'),
/// Expanded(
@ -5007,7 +5006,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,

View File

@ -37,15 +37,15 @@ import 'text_editing_intents.dart';
/// // If using WidgetsApp or its descendents MaterialApp or CupertinoApp,
/// // then DefaultTextEditingShortcuts is already being inserted into the
/// // widget tree.
/// return DefaultTextEditingShortcuts(
/// return const DefaultTextEditingShortcuts(
/// child: Center(
/// child: Shortcuts(
/// shortcuts: const <ShortcutActivator, Intent>{
/// shortcuts: <ShortcutActivator, Intent>{
/// SingleActivator(LogicalKeyboardKey.arrowDown, alt: true): NextFocusIntent(),
/// SingleActivator(LogicalKeyboardKey.arrowUp, alt: true): PreviousFocusIntent(),
/// },
/// child: Column(
/// children: const <Widget>[
/// children: <Widget>[
/// TextField(
/// decoration: InputDecoration(
/// hintText: 'alt + down moves to the next field.',

View File

@ -36,9 +36,9 @@ import 'icon_theme_data.dart';
/// ![The following code snippet would generate a row of icons consisting of a pink heart, a green musical note, and a blue umbrella, each progressively bigger than the last.](https://flutter.github.io/assets-for-api-docs/assets/widgets/icon.png)
///
/// ```dart
/// Row(
/// const Row(
/// mainAxisAlignment: MainAxisAlignment.spaceAround,
/// children: const <Widget>[
/// children: <Widget>[
/// Icon(
/// Icons.favorite,
/// color: Colors.pink,

View File

@ -18,8 +18,8 @@ import 'framework.dart';
/// {@tool snippet}
///
/// ```dart
/// Row(
/// children: const <Widget>[
/// const Row(
/// children: <Widget>[
/// Text('Begin'),
/// Spacer(), // Defaults to a flex of one.
/// Text('Middle'),

View File

@ -1702,9 +1702,9 @@ void main() {
testWidgets('copy paste', (WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
const CupertinoApp(
home: Column(
children: const <Widget>[
children: <Widget>[
CupertinoTextField(
placeholder: 'field 1',
),

View File

@ -701,7 +701,7 @@ void main() {
appBar: AppBar(
title: const Text('X'),
),
drawer: Column(), // Doesn't really matter. Triggers a hamburger regardless.
drawer: const Column(), // Doesn't really matter. Triggers a hamburger regardless.
),
),
);

View File

@ -253,9 +253,9 @@ Widget _withTheme(BottomAppBarTheme theme, [bool useMaterial3 = false]) {
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
bottomNavigationBar: RepaintBoundary(
key: _painterKey,
child: BottomAppBar(
child: const BottomAppBar(
child: Row(
children: const <Widget>[
children: <Widget>[
Icon(Icons.add),
Expanded(child: SizedBox()),
Icon(Icons.add),

View File

@ -82,13 +82,13 @@ void main() {
debugResetSemanticsIdCounter();
await tester.pumpWidget(
Directionality(
const Directionality(
textDirection: TextDirection.ltr,
child: Material(
child: Center(
child: Card(
child: Column(
children: const <Widget>[
children: <Widget>[
Text('First child'),
Text('Second child'),
],

View File

@ -579,8 +579,8 @@ void main() {
const TextStyle style = TextStyle(fontFamily: 'Ahem', fontSize: 10.0);
await tester.pumpWidget(
wrapForChip(
child: Row(
children: const <Widget>[
child: const Row(
children: <Widget>[
Chip(label: Text('Test'), labelStyle: style),
],
),
@ -590,8 +590,8 @@ void main() {
expect(tester.getSize(find.byType(Chip)), const Size(64.0, 48.0));
await tester.pumpWidget(
wrapForChip(
child: Row(
children: const <Widget>[
child: const Row(
children: <Widget>[
Flexible(child: Chip(label: Text('Test'), labelStyle: style)),
],
),
@ -601,8 +601,8 @@ void main() {
expect(tester.getSize(find.byType(Chip)), const Size(64.0, 48.0));
await tester.pumpWidget(
wrapForChip(
child: Row(
children: const <Widget>[
child: const Row(
children: <Widget>[
Expanded(child: Chip(label: Text('Test'), labelStyle: style)),
],
),
@ -615,8 +615,8 @@ void main() {
testWidgets('Chip responds to materialTapTargetSize', (WidgetTester tester) async {
await tester.pumpWidget(
wrapForChip(
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Chip(
label: Text('X'),
materialTapTargetSize: MaterialTapTargetSize.padded,
@ -731,8 +731,8 @@ void main() {
testWidgets('Chip responds to textScaleFactor', (WidgetTester tester) async {
await tester.pumpWidget(
wrapForChip(
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Chip(
avatar: CircleAvatar(child: Text('A')),
label: Text('Chip A'),
@ -762,8 +762,8 @@ void main() {
await tester.pumpWidget(
wrapForChip(
textScaleFactor: 3.0,
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Chip(
avatar: CircleAvatar(child: Text('A')),
label: Text('Chip A'),
@ -789,8 +789,8 @@ void main() {
// Check that individual text scales are taken into account.
await tester.pumpWidget(
wrapForChip(
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Chip(
avatar: CircleAvatar(child: Text('A')),
label: Text('Chip A', textScaleFactor: 3.0),

View File

@ -128,12 +128,12 @@ void main() {
testWidgets('Vertical Divider Test 2', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
const MaterialApp(
home: Material(
child: SizedBox(
height: 24.0,
child: Row(
children: const <Widget>[
children: <Widget>[
Text('Hey.'),
VerticalDivider(),
],

View File

@ -238,10 +238,10 @@ void main() {
platform: TargetPlatform.iOS,
dividerColor: dividerColor,
),
home: Material(
home: const Material(
child: SingleChildScrollView(
child: Column(
children: const <Widget>[
children: <Widget>[
ExpansionTile(
title: Text('Tile 1'),
maintainState: true,

View File

@ -317,8 +317,8 @@ void main() {
appBar: AppBar(),
floatingActionButton: FloatingActionButton(onPressed: () { }, mini: true),
floatingActionButtonLocation: FloatingActionButtonLocation.miniStartTop,
body: Column(
children: const <Widget>[
body: const Column(
children: <Widget>[
ListTile(
leading: CircleAvatar(),
),

View File

@ -5935,12 +5935,12 @@ void main() {
testWidgets('min intrinsic height for TextField with no content padding', (WidgetTester tester) async {
// Regression test for: https://github.com/flutter/flutter/issues/75509
await tester.pumpWidget(MaterialApp(
await tester.pumpWidget(const MaterialApp(
home: Material(
child: Center(
child: IntrinsicHeight(
child: Column(
children: const <Widget>[
children: <Widget>[
TextField(
decoration: InputDecoration(
labelText: 'Label Text',

View File

@ -240,12 +240,12 @@ void main() {
RawMaterialButton(
materialTapTargetSize: MaterialTapTargetSize.padded,
onPressed: () { },
child: SizedBox(
child: const SizedBox(
width: 400.0,
height: 400.0,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: const <Widget>[
children: <Widget>[
SizedBox(
height: 50.0,
width: 400.0,

View File

@ -4515,10 +4515,10 @@ void main() {
testWidgets('Tab preferredSize gives correct value', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
const MaterialApp(
home: Material(
child: Row(
children: const <Tab>[
children: <Tab>[
Tab(icon: Icon(Icons.message)),
Tab(text: 'Two'),
Tab(text: 'Three', icon: Icon(Icons.chat)),

View File

@ -389,8 +389,8 @@ void main() {
child: ToggleButtons(
isSelected: const <bool>[false],
onPressed: (int index) {},
children: <Widget>[
Row(children: const <Widget>[
children: const <Widget>[
Row(children: <Widget>[
Text('First child'),
Icon(Icons.check),
]),
@ -416,8 +416,8 @@ void main() {
child: ToggleButtons(
isSelected: const <bool>[true],
onPressed: (int index) {},
children: <Widget>[
Row(children: const <Widget>[
children: const <Widget>[
Row(children: <Widget>[
Text('First child'),
Icon(Icons.check),
]),
@ -442,8 +442,8 @@ void main() {
child: boilerplate(
child: ToggleButtons(
isSelected: const <bool>[true],
children: <Widget>[
Row(children: const <Widget>[
children: const <Widget>[
Row(children: <Widget>[
Text('First child'),
Icon(Icons.check),
]),
@ -497,8 +497,8 @@ void main() {
color: enabledColor,
isSelected: const <bool>[false],
onPressed: (int index) {},
children: <Widget>[
Row(children: const <Widget>[
children: const <Widget>[
Row(children: <Widget>[
Text('First child'),
Icon(Icons.check),
]),
@ -519,8 +519,8 @@ void main() {
selectedColor: selectedColor,
isSelected: const <bool>[true],
onPressed: (int index) {},
children: <Widget>[
Row(children: const <Widget>[
children: const <Widget>[
Row(children: <Widget>[
Text('First child'),
Icon(Icons.check),
]),
@ -540,8 +540,8 @@ void main() {
child: ToggleButtons(
disabledColor: disabledColor,
isSelected: const <bool>[true],
children: <Widget>[
Row(children: const <Widget>[
children: const <Widget>[
Row(children: <Widget>[
Text('First child'),
Icon(Icons.check),
]),
@ -565,8 +565,8 @@ void main() {
child: ToggleButtons(
isSelected: const <bool>[false],
onPressed: (int index) {},
children: <Widget>[
Row(children: const <Widget>[
children: const <Widget>[
Row(children: <Widget>[
Text('First child'),
]),
],
@ -594,8 +594,8 @@ void main() {
child: ToggleButtons(
isSelected: const <bool>[true],
onPressed: (int index) {},
children: <Widget>[
Row(children: const <Widget>[
children: const <Widget>[
Row(children: <Widget>[
Text('First child'),
]),
],
@ -622,8 +622,8 @@ void main() {
child: boilerplate(
child: ToggleButtons(
isSelected: const <bool>[true],
children: <Widget>[
Row(children: const <Widget>[
children: const <Widget>[
Row(children: <Widget>[
Text('First child'),
]),
],
@ -652,8 +652,8 @@ void main() {
fillColor: customFillColor,
isSelected: const <bool>[true],
onPressed: (int index) {},
children: <Widget>[
Row(children: const <Widget>[
children: const <Widget>[
Row(children: <Widget>[
Text('First child'),
]),
],

View File

@ -261,10 +261,10 @@ void main() {
color: enabledColor,
isSelected: const <bool>[false],
onPressed: (int index) {},
children: <Widget>[
children: const <Widget>[
// This Row is used like this to test for both TextStyle
// and IconTheme for Text and Icon widgets respectively.
Row(children: const <Widget>[
Row(children: <Widget>[
Text('First child'),
Icon(Icons.check),
]),
@ -290,8 +290,8 @@ void main() {
color: enabledColor,
isSelected: const <bool>[true],
onPressed: (int index) {},
children: <Widget>[
Row(children: const <Widget>[
children: const <Widget>[
Row(children: <Widget>[
Text('First child'),
Icon(Icons.check),
]),
@ -317,8 +317,8 @@ void main() {
child: ToggleButtons(
color: enabledColor,
isSelected: const <bool>[false],
children: <Widget>[
Row(children: const <Widget>[
children: const <Widget>[
Row(children: <Widget>[
Text('First child'),
Icon(Icons.check),
]),
@ -346,8 +346,8 @@ void main() {
child: ToggleButtons(
isSelected: const <bool>[true],
onPressed: (int index) {},
children: <Widget>[
Row(children: const <Widget>[
children: const <Widget>[
Row(children: <Widget>[
Text('First child'),
]),
],

View File

@ -1280,10 +1280,10 @@ void main() {
await gesture.moveTo(Offset.zero);
await tester.pumpWidget(
MaterialApp(
const MaterialApp(
home: Center(
child: Column(
children: const <Widget>[
children: <Widget>[
Tooltip(
message: 'message1',
waitDuration: waitDuration,

View File

@ -10,9 +10,9 @@ import 'mock_canvas.dart';
void main() {
testWidgets('Flex overflow indicator', (WidgetTester tester) async {
await tester.pumpWidget(
Center(
const Center(
child: Column(
children: const <Widget>[
children: <Widget>[
SizedBox(width: 200.0, height: 200.0),
],
),
@ -22,11 +22,11 @@ void main() {
expect(find.byType(Column), isNot(paints..rect()));
await tester.pumpWidget(
Center(
const Center(
child: SizedBox(
height: 100.0,
child: Column(
children: const <Widget>[
children: <Widget>[
SizedBox(width: 200.0, height: 200.0),
],
),
@ -39,11 +39,11 @@ void main() {
expect(find.byType(Column), paints..rect());
await tester.pumpWidget(
Center(
const Center(
child: SizedBox(
height: 0.0,
child: Column(
children: const <Widget>[
children: <Widget>[
SizedBox(width: 200.0, height: 200.0),
],
),

View File

@ -232,7 +232,7 @@ void main() {
testWidgets('Top AnnotatedRegion provides status bar overlay style and bottom AnnotatedRegion provides navigation bar overlay style', (WidgetTester tester) async {
setupTestDevice();
await tester.pumpWidget(
Column(children: const <Widget>[
const Column(children: <Widget>[
Expanded(child: AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle(
systemNavigationBarColor: Colors.blue,
@ -258,7 +258,7 @@ void main() {
testWidgets('Top only AnnotatedRegion provides status bar and navigation bar style properties', (WidgetTester tester) async {
setupTestDevice();
await tester.pumpWidget(
Column(children: const <Widget>[
const Column(children: <Widget>[
Expanded(child: AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle(
systemNavigationBarColor: Colors.blue,
@ -278,7 +278,7 @@ void main() {
testWidgets('Bottom only AnnotatedRegion provides status bar and navigation bar style properties', (WidgetTester tester) async {
setupTestDevice();
await tester.pumpWidget(
Column(children: const <Widget>[
const Column(children: <Widget>[
Expanded(child: SizedBox.expand()),
Expanded(child: AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle(

View File

@ -26,25 +26,25 @@ void main() {
// |
// --------------------------------------- 'ground'
final SemanticsTester semantics = SemanticsTester(tester);
await tester.pumpWidget(MaterialApp(
await tester.pumpWidget(const MaterialApp(
home: Column(
children: <Widget>[
const Text('ground'),
Text('ground'),
Card(
elevation: 10.0,
child: Column(
children: <Widget>[
const Text('absolute elevation: 10'),
Text('absolute elevation: 10'),
PhysicalModel(
elevation: 5.0,
color: Colors.black,
child: Column(
children: <Widget>[
const Text('absolute elevation: 15'),
Text('absolute elevation: 15'),
Card(
elevation: 7.0,
child: Column(
children: const <Widget>[
children: <Widget>[
Text('absolute elevation: 22'),
Card(
elevation: 8.0,
@ -56,7 +56,7 @@ void main() {
],
),
),
const Card(
Card(
elevation: 15.0,
child: Text('absolute elevation: 25'),
),
@ -102,15 +102,15 @@ void main() {
// is reversed
final SemanticsTester semantics = SemanticsTester(tester);
await tester.pumpWidget(MaterialApp(
await tester.pumpWidget(const MaterialApp(
home: Column(
children: <Widget>[
const Text('ground'),
Text('ground'),
Card(
elevation: 10.0,
child: Column(
children: <Widget>[
const Card(
Card(
elevation: 15.0,
child: Text('absolute elevation: 25'),
),
@ -119,11 +119,11 @@ void main() {
color: Colors.black,
child: Column(
children: <Widget>[
const Text('absolute elevation: 15'),
Text('absolute elevation: 15'),
Card(
elevation: 7.0,
child: Column(
children: const <Widget>[
children: <Widget>[
Text('absolute elevation: 22'),
Card(
elevation: 8.0,
@ -135,7 +135,7 @@ void main() {
],
),
),
const Text('absolute elevation: 10'),
Text('absolute elevation: 10'),
],
),
),
@ -205,8 +205,8 @@ void main() {
MergeSemantics(
child: Semantics(
explicitChildNodes: true, // just to be sure that it's going to be an explicit merge
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Card(
elevation: 15.0,
child: Text('abs. elevation 25.0'),
@ -259,8 +259,8 @@ void main() {
MergeSemantics(
child: Semantics(
explicitChildNodes: true, // just to be sure that it's going to be an explicit merge
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Card(
elevation: 5.0,
child: Text('abs. elevation 15.0'),

View File

@ -107,12 +107,12 @@ void main() {
testWidgets('Align widthFactor', (WidgetTester tester) async {
await tester.pumpWidget(
Directionality(
const Directionality(
textDirection: TextDirection.ltr,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
Align(
widthFactor: 0.5,
child: SizedBox(
@ -130,12 +130,12 @@ void main() {
testWidgets('Align heightFactor', (WidgetTester tester) async {
await tester.pumpWidget(
Directionality(
const Directionality(
textDirection: TextDirection.ltr,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: const <Widget>[
children: <Widget>[
Align(
heightFactor: 0.5,
child: SizedBox(

View File

@ -59,11 +59,11 @@ void main() {
testWidgets('AnimatedAlign widthFactor', (WidgetTester tester) async {
await tester.pumpWidget(
Directionality(
const Directionality(
textDirection: TextDirection.ltr,
child: Row(
mainAxisSize: MainAxisSize.min,
children: const <Widget>[
children: <Widget>[
AnimatedAlign(
alignment: Alignment.center,
curve: Curves.ease,
@ -84,10 +84,10 @@ void main() {
testWidgets('AnimatedAlign heightFactor', (WidgetTester tester) async {
await tester.pumpWidget(
Directionality(
const Directionality(
textDirection: TextDirection.ltr,
child: Column(
children: const <Widget>[
children: <Widget>[
AnimatedAlign(
alignment: Alignment.center,
curve: Curves.ease,
@ -108,11 +108,11 @@ void main() {
testWidgets('AnimatedAlign null height factor', (WidgetTester tester) async {
await tester.pumpWidget(
Directionality(
const Directionality(
textDirection: TextDirection.ltr,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
AnimatedAlign(
alignment: Alignment.center,
curve: Curves.ease,
@ -132,13 +132,13 @@ void main() {
testWidgets('AnimatedAlign null widthFactor', (WidgetTester tester) async {
await tester.pumpWidget(
Directionality(
const Directionality(
textDirection: TextDirection.ltr,
child: SizedBox.shrink(
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
AnimatedAlign(
alignment: Alignment.center,
curve: Curves.ease,

View File

@ -17,7 +17,7 @@ void main() {
const TextField client2 = TextField(autofillHints: <String>['2']);
await tester.pumpWidget(
MaterialApp(
const MaterialApp(
home: Scaffold(
body: AutofillGroup(
key: outerKey,
@ -25,7 +25,7 @@ void main() {
client1,
AutofillGroup(
key: innerKey,
child: Column(children: const <Widget>[client2, TextField(autofillHints: null)]),
child: Column(children: <Widget>[client2, TextField(autofillHints: null)]),
),
]),
),
@ -135,9 +135,9 @@ void main() {
child: Column(children: <Widget>[
client1,
TextField(key: keyClient3, autofillHints: const <String>['3']),
AutofillGroup(
const AutofillGroup(
key: innerKey,
child: Column(children: const <Widget>[client2]),
child: Column(children: <Widget>[client2]),
),
]),
),

View File

@ -658,10 +658,10 @@ void main() {
});
testWidgets('ColoredBox - no size, no child', (WidgetTester tester) async {
await tester.pumpWidget(Flex(
await tester.pumpWidget(const Flex(
direction: Axis.horizontal,
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
SizedBox.shrink(
child: ColoredBox(color: colorToPaint),
),
@ -681,10 +681,10 @@ void main() {
testWidgets('ColoredBox - no size, child', (WidgetTester tester) async {
const ValueKey<int> key = ValueKey<int>(0);
const Widget child = SizedBox.expand(key: key);
await tester.pumpWidget(Flex(
await tester.pumpWidget(const Flex(
direction: Axis.horizontal,
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
SizedBox.shrink(
child: ColoredBox(color: colorToPaint, child: child),
),

View File

@ -18,10 +18,10 @@ void main() {
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// Default is MainAxisAlignment.start so children so the children's
// top edges should be at 0, 100, 500, child2's height should be 400.
await tester.pumpWidget(Center(
await tester.pumpWidget(const Center(
child: Column(
key: columnKey,
children: const <Widget>[
children: <Widget>[
SizedBox(key: child0Key, width: 100.0, height: 100.0),
Expanded(child: SizedBox(key: child1Key, width: 100.0, height: 100.0)),
SizedBox(key: child2Key, width: 100.0, height: 100.0),
@ -64,10 +64,10 @@ void main() {
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// Default is MainAxisAlignment.start so children so the children's
// top edges should be at 0, 100, 200
await tester.pumpWidget(Center(
await tester.pumpWidget(const Center(
child: Column(
key: columnKey,
children: const <Widget>[
children: <Widget>[
SizedBox(key: child0Key, width: 100.0, height: 100.0),
SizedBox(key: child1Key, width: 100.0, height: 100.0),
SizedBox(key: child2Key, width: 100.0, height: 100.0),
@ -108,11 +108,11 @@ void main() {
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// The 100x100 children's top edges should be at 200, 300
await tester.pumpWidget(Center(
await tester.pumpWidget(const Center(
child: Column(
key: columnKey,
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
SizedBox(key: child0Key, width: 100.0, height: 100.0),
SizedBox(key: child1Key, width: 100.0, height: 100.0),
],
@ -147,11 +147,11 @@ void main() {
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// The 100x100 children's top edges should be at 300, 400, 500.
await tester.pumpWidget(Center(
await tester.pumpWidget(const Center(
child: Column(
key: columnKey,
mainAxisAlignment: MainAxisAlignment.end,
children: const <Widget>[
children: <Widget>[
SizedBox(key: child0Key, width: 100.0, height: 100.0),
SizedBox(key: child1Key, width: 100.0, height: 100.0),
SizedBox(key: child2Key, width: 100.0, height: 100.0),
@ -193,11 +193,11 @@ void main() {
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// The 100x100 children's top edges should be at 0, 250, 500
await tester.pumpWidget(Center(
await tester.pumpWidget(const Center(
child: Column(
key: columnKey,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: const <Widget>[
children: <Widget>[
SizedBox(key: child0Key, width: 100.0, height: 100.0),
SizedBox(key: child1Key, width: 100.0, height: 100.0),
SizedBox(key: child2Key, width: 100.0, height: 100.0),
@ -240,11 +240,11 @@ void main() {
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// The 100x100 children's top edges should be at 25, 175, 325, 475
await tester.pumpWidget(Center(
await tester.pumpWidget(const Center(
child: Column(
key: columnKey,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: const <Widget>[
children: <Widget>[
SizedBox(key: child0Key, width: 100.0, height: 100.0),
SizedBox(key: child1Key, width: 100.0, height: 100.0),
SizedBox(key: child2Key, width: 100.0, height: 100.0),
@ -293,11 +293,11 @@ void main() {
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// The 100x20 children's top edges should be at 135, 290, 445
await tester.pumpWidget(Center(
await tester.pumpWidget(const Center(
child: Column(
key: columnKey,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: const <Widget>[
children: <Widget>[
SizedBox(key: child0Key, width: 100.0, height: 20.0),
SizedBox(key: child1Key, width: 100.0, height: 20.0),
SizedBox(key: child2Key, width: 100.0, height: 20.0),
@ -335,10 +335,10 @@ void main() {
const Key flexKey = Key('flexKey');
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
await tester.pumpWidget(Center(
await tester.pumpWidget(const Center(
child: Column(
key: flexKey,
children: const <Widget>[
children: <Widget>[
SizedBox(width: 100.0, height: 100.0),
SizedBox(width: 100.0, height: 150.0),
],
@ -349,11 +349,11 @@ void main() {
expect(renderBox.size.height, equals(600.0));
// Column with MainAxisSize.min without flexible children shrink wraps.
await tester.pumpWidget(Center(
await tester.pumpWidget(const Center(
child: Column(
key: flexKey,
mainAxisSize: MainAxisSize.min,
children: const <Widget>[
children: <Widget>[
SizedBox(width: 100.0, height: 100.0),
SizedBox(width: 100.0, height: 150.0),
],
@ -367,11 +367,11 @@ void main() {
testWidgets('Column MainAxisSize.min layout at zero size', (WidgetTester tester) async {
const Key childKey = Key('childKey');
await tester.pumpWidget(Center(
await tester.pumpWidget(const Center(
child: SizedBox.shrink(
child: Column(
mainAxisSize: MainAxisSize.min,
children: const <Widget>[
children: <Widget>[
SizedBox(
key: childKey,
width: 100.0,
@ -399,11 +399,11 @@ void main() {
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// Default is MainAxisAlignment.start so children so the children's
// bottom edges should be at 0, 100, 500 from bottom, child2's height should be 400.
await tester.pumpWidget(Center(
await tester.pumpWidget(const Center(
child: Column(
key: columnKey,
verticalDirection: VerticalDirection.up,
children: const <Widget>[
children: <Widget>[
SizedBox(key: child0Key, width: 100.0, height: 100.0),
Expanded(child: SizedBox(key: child1Key, width: 100.0, height: 100.0)),
SizedBox(key: child2Key, width: 100.0, height: 100.0),
@ -446,11 +446,11 @@ void main() {
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// Default is MainAxisAlignment.start so children so the children's
// bottom edges should be at 0, 100, 200 from bottom
await tester.pumpWidget(Center(
await tester.pumpWidget(const Center(
child: Column(
key: columnKey,
verticalDirection: VerticalDirection.up,
children: const <Widget>[
children: <Widget>[
SizedBox(key: child0Key, width: 100.0, height: 100.0),
SizedBox(key: child1Key, width: 100.0, height: 100.0),
SizedBox(key: child2Key, width: 100.0, height: 100.0),
@ -491,12 +491,12 @@ void main() {
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// The 100x100 children's bottom edges should be at 200, 300 from bottom
await tester.pumpWidget(Center(
await tester.pumpWidget(const Center(
child: Column(
key: columnKey,
mainAxisAlignment: MainAxisAlignment.center,
verticalDirection: VerticalDirection.up,
children: const <Widget>[
children: <Widget>[
SizedBox(key: child0Key, width: 100.0, height: 100.0),
SizedBox(key: child1Key, width: 100.0, height: 100.0),
],
@ -531,12 +531,12 @@ void main() {
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// The 100x100 children's bottom edges should be at 300, 400, 500 from bottom.
await tester.pumpWidget(Center(
await tester.pumpWidget(const Center(
child: Column(
key: columnKey,
mainAxisAlignment: MainAxisAlignment.end,
verticalDirection: VerticalDirection.up,
children: const <Widget>[
children: <Widget>[
SizedBox(key: child0Key, width: 100.0, height: 100.0),
SizedBox(key: child1Key, width: 100.0, height: 100.0),
SizedBox(key: child2Key, width: 100.0, height: 100.0),
@ -578,12 +578,12 @@ void main() {
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// The 100x100 children's bottom edges should be at 0, 250, 500 from bottom
await tester.pumpWidget(Center(
await tester.pumpWidget(const Center(
child: Column(
key: columnKey,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
verticalDirection: VerticalDirection.up,
children: const <Widget>[
children: <Widget>[
SizedBox(key: child0Key, width: 100.0, height: 100.0),
SizedBox(key: child1Key, width: 100.0, height: 100.0),
SizedBox(key: child2Key, width: 100.0, height: 100.0),
@ -626,12 +626,12 @@ void main() {
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// The 100x100 children's bottom edges should be at 25, 175, 325, 475 from bottom
await tester.pumpWidget(Center(
await tester.pumpWidget(const Center(
child: Column(
key: columnKey,
mainAxisAlignment: MainAxisAlignment.spaceAround,
verticalDirection: VerticalDirection.up,
children: const <Widget>[
children: <Widget>[
SizedBox(key: child0Key, width: 100.0, height: 100.0),
SizedBox(key: child1Key, width: 100.0, height: 100.0),
SizedBox(key: child2Key, width: 100.0, height: 100.0),
@ -680,12 +680,12 @@ void main() {
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// The 100x20 children's bottom edges should be at 135, 290, 445 from bottom
await tester.pumpWidget(Center(
await tester.pumpWidget(const Center(
child: Column(
key: columnKey,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
verticalDirection: VerticalDirection.up,
children: const <Widget>[
children: <Widget>[
SizedBox(key: child0Key, width: 100.0, height: 20.0),
SizedBox(key: child1Key, width: 100.0, height: 20.0),
SizedBox(key: child2Key, width: 100.0, height: 20.0),
@ -723,11 +723,11 @@ void main() {
const Key flexKey = Key('flexKey');
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
await tester.pumpWidget(Center(
await tester.pumpWidget(const Center(
child: Column(
key: flexKey,
verticalDirection: VerticalDirection.up,
children: const <Widget>[
children: <Widget>[
SizedBox(width: 100.0, height: 100.0),
SizedBox(width: 100.0, height: 150.0),
],
@ -738,12 +738,12 @@ void main() {
expect(renderBox.size.height, equals(600.0));
// Column with MainAxisSize.min without flexible children shrink wraps.
await tester.pumpWidget(Center(
await tester.pumpWidget(const Center(
child: Column(
key: flexKey,
mainAxisSize: MainAxisSize.min,
verticalDirection: VerticalDirection.up,
children: const <Widget>[
children: <Widget>[
SizedBox(width: 100.0, height: 100.0),
SizedBox(width: 100.0, height: 150.0),
],
@ -757,12 +757,12 @@ void main() {
testWidgets('Column MainAxisSize.min layout at zero size', (WidgetTester tester) async {
const Key childKey = Key('childKey');
await tester.pumpWidget(Center(
await tester.pumpWidget(const Center(
child: SizedBox.shrink(
child: Column(
mainAxisSize: MainAxisSize.min,
verticalDirection: VerticalDirection.up,
children: const <Widget>[
children: <Widget>[
SizedBox(
key: childKey,
width: 100.0,

View File

@ -640,14 +640,14 @@ void main() {
// Dismissible contract. This is not an example of good practice.
testWidgets('dismissing bottom then top (smoketest)', (WidgetTester tester) async {
await tester.pumpWidget(
Directionality(
const Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: SizedBox(
width: 100.0,
height: 1000.0,
child: Column(
children: const <Widget>[
children: <Widget>[
Test1215DismissibleWidget('1'),
Test1215DismissibleWidget('2'),
],

View File

@ -1752,9 +1752,9 @@ void main() {
await gesture.moveTo(secondLocation);
await tester.pump();
await tester.pumpWidget(MaterialApp(
await tester.pumpWidget(const MaterialApp(
home: Column(
children: const <Widget>[
children: <Widget>[
Draggable<int>(
data: 1,
feedback: Text('Dragging'),
@ -2284,9 +2284,9 @@ void main() {
await gesture.moveTo(secondLocation);
await tester.pump();
await tester.pumpWidget(MaterialApp(
await tester.pumpWidget(const MaterialApp(
home: Column(
children: const <Widget>[
children: <Widget>[
Draggable<int>(
data: 1,
feedback: Text('Dragging'),
@ -3061,9 +3061,9 @@ void main() {
const HitTestBehavior hitTestBehavior = HitTestBehavior.deferToChild;
await tester.pumpWidget(
MaterialApp(
const MaterialApp(
home: Column(
children: const <Widget>[
children: <Widget>[
Draggable<int>(
feedback: SizedBox(height: 50.0, child: Text('Draggable')),
child: SizedBox(height: 50.0, child: Text('Target')),
@ -3079,9 +3079,9 @@ void main() {
// Regression test for https://github.com/flutter/flutter/issues/92083
testWidgets('feedback respect the MouseRegion cursor configure', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
const MaterialApp(
home: Column(
children: const <Widget>[
children: <Widget>[
Draggable<int>(
ignoringFeedbackPointer: false,
feedback: MouseRegion(

View File

@ -49,9 +49,9 @@ void main() {
testWidgets('Flexible defaults to loose', (WidgetTester tester) async {
await tester.pumpWidget(
Row(
const Row(
textDirection: TextDirection.ltr,
children: const <Widget>[
children: <Widget>[
Flexible(child: SizedBox(width: 100.0, height: 200.0)),
],
),
@ -64,11 +64,11 @@ void main() {
testWidgets("Doesn't overflow because of floating point accumulated error", (WidgetTester tester) async {
// both of these cases have failed in the past due to floating point issues
await tester.pumpWidget(
Center(
const Center(
child: SizedBox(
height: 400.0,
child: Column(
children: const <Widget>[
children: <Widget>[
Expanded(child: SizedBox()),
Expanded(child: SizedBox()),
Expanded(child: SizedBox()),
@ -81,11 +81,11 @@ void main() {
),
);
await tester.pumpWidget(
Center(
const Center(
child: SizedBox(
height: 199.0,
child: Column(
children: const <Widget>[
children: <Widget>[
Expanded(child: SizedBox()),
Expanded(child: SizedBox()),
Expanded(child: SizedBox()),
@ -104,7 +104,7 @@ void main() {
// we only get a single exception. Otherwise we'd get two, the one we want and
// an extra one when we discover we never computed a size.
await tester.pumpWidget(
Column(
const Column(
children: <Widget>[
Column(),
],
@ -134,11 +134,17 @@ void main() {
});
testWidgets('Can set and update clipBehavior', (WidgetTester tester) async {
await tester.pumpWidget(Flex(direction: Axis.vertical));
await tester.pumpWidget(const Flex(direction: Axis.vertical));
final RenderFlex renderObject = tester.allRenderObjects.whereType<RenderFlex>().first;
expect(renderObject.clipBehavior, equals(Clip.none));
await tester.pumpWidget(Flex(direction: Axis.vertical, clipBehavior: Clip.antiAlias));
await tester.pumpWidget(const Flex(direction: Axis.vertical, clipBehavior: Clip.antiAlias));
expect(renderObject.clipBehavior, equals(Clip.antiAlias));
});
test('Flex/Column/Row can be const-constructed', () {
const Flex(direction: Axis.vertical);
const Column();
const Row();
});
}

View File

@ -17,8 +17,8 @@ void main() {
textDirection: TextDirection.ltr,
child: Semantics(
container: true,
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Text('Michael Goderbauer'),
Text('goderbauer@google.com'),
],
@ -51,8 +51,8 @@ void main() {
child: Semantics(
container: true,
explicitChildNodes: true,
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Text('Michael Goderbauer'),
Text('goderbauer@google.com'),
],
@ -98,8 +98,8 @@ void main() {
explicitChildNodes: true,
child: Semantics(
label: 'Signed in as',
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Text('Michael Goderbauer'),
Text('goderbauer@google.com'),
],
@ -140,8 +140,8 @@ void main() {
container: true,
child: Semantics(
label: 'Signed in as',
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Text('Michael Goderbauer'),
Text('goderbauer@google.com'),
],

View File

@ -29,9 +29,9 @@ void expectRects(WidgetTester tester, List<Rect> expected) {
void main() {
testWidgets('ListBody down', (WidgetTester tester) async {
await tester.pumpWidget(Flex(
await tester.pumpWidget(const Flex(
direction: Axis.vertical,
children: const <Widget>[ ListBody(children: children) ],
children: <Widget>[ ListBody(children: children) ],
));
expectRects(
@ -46,9 +46,9 @@ void main() {
});
testWidgets('ListBody up', (WidgetTester tester) async {
await tester.pumpWidget(Flex(
await tester.pumpWidget(const Flex(
direction: Axis.vertical,
children: const <Widget>[ ListBody(reverse: true, children: children) ],
children: <Widget>[ ListBody(reverse: true, children: children) ],
));
expectRects(
@ -63,10 +63,10 @@ void main() {
});
testWidgets('ListBody right', (WidgetTester tester) async {
await tester.pumpWidget(Flex(
await tester.pumpWidget(const Flex(
textDirection: TextDirection.ltr,
direction: Axis.horizontal,
children: const <Widget>[
children: <Widget>[
Directionality(
textDirection: TextDirection.ltr,
child: ListBody(mainAxis: Axis.horizontal, children: children),
@ -86,10 +86,10 @@ void main() {
});
testWidgets('ListBody left', (WidgetTester tester) async {
await tester.pumpWidget(Flex(
await tester.pumpWidget(const Flex(
textDirection: TextDirection.ltr,
direction: Axis.horizontal,
children: const <Widget>[
children: <Widget>[
Directionality(
textDirection: TextDirection.rtl,
child: ListBody(mainAxis: Axis.horizontal, children: children),
@ -147,7 +147,7 @@ void main() {
FlutterError.onError = (FlutterErrorDetails error) => errors.add(error);
try {
await tester.pumpWidget(
Flex(
const Flex(
textDirection: TextDirection.ltr,
direction: Axis.horizontal,
children: <Widget>[
@ -159,7 +159,7 @@ void main() {
Flex(
textDirection: TextDirection.ltr,
direction: Axis.vertical,
children: const <Widget>[
children: <Widget>[
Directionality(
textDirection: TextDirection.ltr,
child: ListBody(

View File

@ -11,10 +11,10 @@ void main() {
// Regression test for https://github.com/flutter/flutter/issues/48855.
await tester.pumpWidget(
Directionality(
const Directionality(
textDirection: TextDirection.ltr,
child: Column(
children: const <Widget>[
children: <Widget>[
Text('0', key: ValueKey<int>(0)),
Text('1', key: ValueKey<int>(1)),
Text('2', key: ValueKey<int>(2)),
@ -35,10 +35,10 @@ void main() {
);
await tester.pumpWidget(
Directionality(
const Directionality(
textDirection: TextDirection.ltr,
child: Column(
children: const <Widget>[
children: <Widget>[
Text('0', key: ValueKey<int>(0)),
Text('6', key: ValueKey<int>(6)),
Text('7', key: ValueKey<int>(7)),
@ -62,8 +62,8 @@ void main() {
testWidgets('Building a new MultiChildRenderObjectElement with children having duplicated keys throws', (WidgetTester tester) async {
const ValueKey<int> duplicatedKey = ValueKey<int>(1);
await tester.pumpWidget(Column(
children: const <Widget>[
await tester.pumpWidget(const Column(
children: <Widget>[
Text('Text 1', textDirection: TextDirection.ltr, key: duplicatedKey),
Text('Text 2', textDirection: TextDirection.ltr, key: duplicatedKey),
],

View File

@ -292,11 +292,11 @@ void main() {
checkTree(tester, <TestParentData>[]);
await tester.pumpWidget(
Directionality(
const Directionality(
textDirection: TextDirection.ltr,
child: DummyWidget(
child: Row(
children: const <Widget>[
children: <Widget>[
Positioned(
top: 6.0,
left: 7.0,

View File

@ -47,15 +47,15 @@ void main() {
testWidgets('PhysicalModel - clips when overflows and elevation is 0', (WidgetTester tester) async {
const Key key = Key('test');
await tester.pumpWidget(
MediaQuery(
const MediaQuery(
key: key,
data: const MediaQueryData(),
data: MediaQueryData(),
child: Directionality(
textDirection: TextDirection.ltr,
child: Padding(
padding: const EdgeInsets.all(50),
padding: EdgeInsets.all(50),
child: Row(
children: const <Widget>[
children: <Widget>[
Material(child: Text('A long long long long long long long string')),
Material(child: Text('A long long long long long long long string')),
Material(child: Text('A long long long long long long long string')),

View File

@ -147,17 +147,17 @@ void main() {
color: Colors.green,
child: IntrinsicHeight(
child: RichText(
text: TextSpan(
text: const TextSpan(
children: <InlineSpan>[
const TextSpan(text: 'Start\n', style: TextStyle(height: 1.0, fontSize: 16)),
TextSpan(text: 'Start\n', style: TextStyle(height: 1.0, fontSize: 16)),
WidgetSpan(
child: Row(
children: const <Widget>[
children: <Widget>[
SizedBox(height: 16, width: 16),
],
),
),
const TextSpan(text: 'End', style: TextStyle(height: 1.0, fontSize: 16)),
TextSpan(text: 'End', style: TextStyle(height: 1.0, fontSize: 16)),
],
),
),

View File

@ -284,12 +284,12 @@ void main() {
OrderPainter.log.clear();
const Key childKey = Key('childKey');
await tester.pumpWidget(Center(
await tester.pumpWidget(const Center(
child: SizedBox.shrink(
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
SizedBox(
key: childKey,
width: 100.0,
@ -704,13 +704,13 @@ void main() {
OrderPainter.log.clear();
const Key childKey = Key('childKey');
await tester.pumpWidget(Center(
await tester.pumpWidget(const Center(
child: SizedBox.shrink(
child: Row(
textDirection: TextDirection.ltr,
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
SizedBox(
key: childKey,
width: 100.0,
@ -1125,13 +1125,13 @@ void main() {
OrderPainter.log.clear();
const Key childKey = Key('childKey');
await tester.pumpWidget(Center(
await tester.pumpWidget(const Center(
child: SizedBox.shrink(
child: Row(
textDirection: TextDirection.rtl,
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
SizedBox(
key: childKey,
width: 100.0,

View File

@ -113,10 +113,10 @@ void main() {
}
testWidgets('SafeArea alone.', (WidgetTester tester) async {
final Widget child = boilerplate(SafeArea(
final Widget child = boilerplate(const SafeArea(
maintainBottomViewPadding: true,
child: Column(
children: const <Widget>[
children: <Widget>[
Expanded(child: Placeholder()),
],
),
@ -148,10 +148,10 @@ void main() {
});
testWidgets('SafeArea alone - partial ViewInsets consume Padding', (WidgetTester tester) async {
final Widget child = boilerplate(SafeArea(
final Widget child = boilerplate(const SafeArea(
maintainBottomViewPadding: true,
child: Column(
children: const <Widget>[
children: <Widget>[
Expanded(child: Placeholder()),
],
),
@ -181,12 +181,12 @@ void main() {
});
testWidgets('SafeArea with nested Scaffold', (WidgetTester tester) async {
final Widget child = boilerplate(SafeArea(
final Widget child = boilerplate(const SafeArea(
maintainBottomViewPadding: true,
child: Scaffold(
resizeToAvoidBottomInset: false,
body: Column(
children: const <Widget>[
children: <Widget>[
Expanded(child: Placeholder()),
],
),
@ -219,12 +219,12 @@ void main() {
});
testWidgets('SafeArea with nested Scaffold - partial ViewInsets consume Padding', (WidgetTester tester) async {
final Widget child = boilerplate(SafeArea(
final Widget child = boilerplate(const SafeArea(
maintainBottomViewPadding: true,
child: Scaffold(
resizeToAvoidBottomInset: false,
body: Column(
children: const <Widget>[
children: <Widget>[
Expanded(child: Placeholder()),
],
),

View File

@ -409,8 +409,8 @@ void main() {
home: SelectableRegion(
focusNode: FocusNode(),
selectionControls: materialTextSelectionControls,
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Text('How are you?'),
Text('Good, and you?'),
Text('Fine, thank you.'),
@ -449,8 +449,8 @@ void main() {
home: SelectableRegion(
focusNode: FocusNode(),
selectionControls: materialTextSelectionControls,
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Text('How are you?'),
SelectionContainer.disabled(child: Text('Good, and you?')),
Text('Fine, thank you.'),
@ -490,8 +490,8 @@ void main() {
home: SelectableRegion(
focusNode: FocusNode(),
selectionControls: materialTextSelectionControls,
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Text('How are you?'),
Text('Good, and you?'),
Text('Fine, thank you.'),
@ -529,8 +529,8 @@ void main() {
home: SelectableRegion(
focusNode: FocusNode(),
selectionControls: materialTextSelectionControls,
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Text('How are you?'),
Text('Good, and you?'),
Text('Fine, thank you.'),
@ -665,8 +665,8 @@ void main() {
home: SelectableRegion(
focusNode: focusNode,
selectionControls: materialTextSelectionControls,
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Text('How are you?'),
Text('Good, and you?'),
Text('Fine, thank you.'),
@ -813,8 +813,8 @@ void main() {
home: SelectableRegion(
focusNode: FocusNode(),
selectionControls: materialTextSelectionControls,
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Text('How are you?'),
Text('جيد وانت؟', textDirection: TextDirection.rtl),
Text('Fine, thank you.'),
@ -854,8 +854,8 @@ void main() {
home: SelectableRegion(
focusNode: FocusNode(),
selectionControls: materialTextSelectionControls,
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Text('How are you?'),
Text('Good, and you?'),
Text('Fine, thank you.'),
@ -954,8 +954,8 @@ void main() {
home: SelectableRegion(
focusNode: FocusNode(),
selectionControls: materialTextSelectionControls,
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Text('How are you?'),
Text('Good, and you?'),
Text('Fine, thank you.'),
@ -995,8 +995,8 @@ void main() {
home: SelectableRegion(
focusNode: FocusNode(),
selectionControls: materialTextSelectionControls,
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Text('How are you?'),
Text('Good, and you?'),
Text('Fine, thank you.'),
@ -1031,8 +1031,8 @@ void main() {
home: SelectableRegion(
focusNode: FocusNode(),
selectionControls: materialTextSelectionControls,
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Text('How are you?'),
Text('Good, and you?'),
Text('Fine, thank you.'),
@ -1067,8 +1067,8 @@ void main() {
home: SelectableRegion(
focusNode: FocusNode(),
selectionControls: materialTextSelectionControls,
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Text('How are you?'),
Text('Good, and you?'),
Text('Fine, thank you.'),
@ -1102,8 +1102,8 @@ void main() {
home: SelectableRegion(
focusNode: FocusNode(),
selectionControls: materialTextSelectionControls,
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Text('How are you?'),
Text('Good, and you?'),
Text('Fine, thank you.'),
@ -1141,8 +1141,8 @@ void main() {
home: SelectableRegion(
focusNode: FocusNode(),
selectionControls: materialTextSelectionControls,
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Text('How are you?'),
Text('Good, and you?'),
Text('Fine, thank you.'),
@ -1201,8 +1201,8 @@ void main() {
home: SelectableRegion(
focusNode: FocusNode(),
selectionControls: materialTextSelectionControls,
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Text('How are you?'),
Text('Good, and you?'),
Text('Fine, thank you.'),
@ -1311,8 +1311,8 @@ void main() {
home: SelectableRegion(
focusNode: FocusNode(),
selectionControls: materialTextSelectionControls,
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Text('How are you?'),
Text('Good, and you?'),
Text('Fine, thank you.'),
@ -1402,8 +1402,8 @@ void main() {
home: SelectableRegion(
focusNode: FocusNode(),
selectionControls: materialTextSelectionControls,
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Text('How are you?'),
Text('Good, and you?'),
Text('Fine, thank you.'),
@ -1480,8 +1480,8 @@ void main() {
home: SelectableRegion(
focusNode: FocusNode(),
selectionControls: materialTextSelectionControls,
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Text('How are you?'),
Text('Good, and you?'),
Text('Fine, thank you.'),

View File

@ -5079,11 +5079,11 @@ void main() {
testWidgets('text selection style 1', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
const MaterialApp(
home: Material(
child: Center(
child: Column(
children: const <Widget>[
children: <Widget>[
SelectableText.rich(
TextSpan(
children: <TextSpan>[
@ -5131,11 +5131,11 @@ void main() {
testWidgets('text selection style 2', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
const MaterialApp(
home: Material(
child: Center(
child: Column(
children: const <Widget>[
children: <Widget>[
SelectableText.rich(
TextSpan(
children: <TextSpan>[

View File

@ -25,8 +25,8 @@ void main() {
SelectionContainer(
registrar: registrar,
delegate: delegate,
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Text('column1', textDirection: TextDirection.ltr),
Text('column2', textDirection: TextDirection.ltr),
Text('column3', textDirection: TextDirection.ltr),
@ -46,9 +46,9 @@ void main() {
SelectionContainer(
registrar: registrar,
delegate: delegate,
child: SelectionContainer.disabled(
child: const SelectionContainer.disabled(
child: Column(
children: const <Widget>[
children: <Widget>[
Text('column1', textDirection: TextDirection.ltr),
Text('column2', textDirection: TextDirection.ltr),
Text('column3', textDirection: TextDirection.ltr),
@ -69,7 +69,7 @@ void main() {
SelectionContainer(
registrar: registrar,
delegate: delegate,
child: Column(
child: const Column(
),
),
);
@ -80,8 +80,8 @@ void main() {
SelectionContainer(
registrar: registrar,
delegate: delegate,
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Text('column1', textDirection: TextDirection.ltr),
],
),
@ -94,7 +94,7 @@ void main() {
SelectionContainer(
registrar: registrar,
delegate: delegate,
child: Column(
child: const Column(
),
),
);
@ -111,8 +111,8 @@ void main() {
registrar: registrar,
child: SelectionContainer(
delegate: delegate,
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Text('column1', textDirection: TextDirection.ltr),
],
),

View File

@ -12,7 +12,7 @@ void main() {
testWidgets('SemanticNode.rect is clipped', (WidgetTester tester) async {
final SemanticsTester semantics = SemanticsTester(tester);
await tester.pumpWidget(Directionality(
await tester.pumpWidget(const Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: SizedBox(
@ -20,7 +20,7 @@ void main() {
child: Flex(
clipBehavior: Clip.hardEdge,
direction: Axis.horizontal,
children: const <Widget>[
children: <Widget>[
SizedBox(
width: 75.0,
child: Text('1'),
@ -70,7 +70,7 @@ void main() {
testWidgets('SemanticsNode is not removed if out of bounds and merged into something within bounds', (WidgetTester tester) async {
final SemanticsTester semantics = SemanticsTester(tester);
await tester.pumpWidget(Directionality(
await tester.pumpWidget(const Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: SizedBox(
@ -79,14 +79,14 @@ void main() {
clipBehavior: Clip.hardEdge,
direction: Axis.horizontal,
children: <Widget>[
const SizedBox(
SizedBox(
width: 75.0,
child: Text('1'),
),
MergeSemantics(
child: Flex(
direction: Axis.horizontal,
children: const <Widget>[
children: <Widget>[
SizedBox(
width: 75.0,
child: Text('2'),

View File

@ -1001,14 +1001,14 @@ void main() {
},
);
await tester.pumpWidget(
Directionality(
const Directionality(
textDirection: TextDirection.ltr,
child: Column(
children: <Widget>[
const Text('Label 1'),
const Text('Label 2'),
Text('Label 1'),
Text('Label 2'),
Row(
children: const <Widget>[
children: <Widget>[
Text('Label 3'),
Text('Label 4'),
Text('Label 5'),
@ -1070,8 +1070,8 @@ void main() {
const Text('Label 2'),
Transform.rotate(
angle: pi / 2.0,
child: Row(
children: const <Widget>[
child: const Row(
children: <Widget>[
Text('Label 3'),
Text('Label 4'),
Text('Label 5'),
@ -1638,7 +1638,7 @@ void main() {
// Construct a widget tree that will end up with a fitted box that applies
// a zero transform because it does not actually draw its children.
// Assert that this subtree gets dropped (the root node has no children).
await tester.pumpWidget(Column(
await tester.pumpWidget(const Column(
children: <Widget>[
SizedBox(
height: 0,

View File

@ -7,8 +7,8 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Spacer takes up space.', (WidgetTester tester) async {
await tester.pumpWidget(Column(
children: const <Widget>[
await tester.pumpWidget(const Column(
children: <Widget>[
SizedBox(width: 10.0, height: 10.0),
Spacer(),
SizedBox(width: 10.0, height: 10.0),
@ -24,9 +24,9 @@ void main() {
const Spacer spacer2 = Spacer();
const Spacer spacer3 = Spacer(flex: 2);
const Spacer spacer4 = Spacer(flex: 4);
await tester.pumpWidget(Row(
await tester.pumpWidget(const Row(
textDirection: TextDirection.rtl,
children: const <Widget>[
children: <Widget>[
SizedBox(width: 10.0, height: 10.0),
spacer1,
SizedBox(width: 10.0, height: 10.0),
@ -54,10 +54,10 @@ void main() {
});
testWidgets('Spacer takes up space.', (WidgetTester tester) async {
await tester.pumpWidget(UnconstrainedBox(
await tester.pumpWidget(const UnconstrainedBox(
constrainedAxis: Axis.vertical,
child: Column(
children: const <Widget>[
children: <Widget>[
SizedBox(width: 20.0, height: 10.0),
Spacer(),
SizedBox(width: 10.0, height: 10.0),

View File

@ -130,7 +130,7 @@ void main() {
testWidgets('swap instances around', (WidgetTester tester) async {
const Widget a = TestWidget(persistentState: 0x61, syncedState: 0x41, child: Text('apple', textDirection: TextDirection.ltr));
const Widget b = TestWidget(persistentState: 0x62, syncedState: 0x42, child: Text('banana', textDirection: TextDirection.ltr));
await tester.pumpWidget(Column());
await tester.pumpWidget(const Column());
final GlobalKey keyA = GlobalKey();
final GlobalKey keyB = GlobalKey();

View File

@ -1331,8 +1331,8 @@ void main() {
decoration: const BoxDecoration(
color: Color(0xff00ff00),
),
child: Column(
children: const <Widget>[
child: const Column(
children: <Widget>[
Text('Hello\nLine 2\nLine 3',
textDirection: TextDirection.ltr,
style: TextStyle(height: 5),

View File

@ -1012,13 +1012,13 @@ void main() {
testWidgets('textWidthBasis with textAlign still obeys parent alignment', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
const MaterialApp(
home: Scaffold(
body: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: const <Widget>[
children: <Widget>[
Text(
'LEFT ALIGNED, PARENT',
textAlign: TextAlign.left,

View File

@ -190,8 +190,8 @@ void main() {
routes: <String, WidgetBuilder>{
'/foo' : (BuildContext context) => const Text('New route'),
},
home: Row(
children: const <Widget>[
home: const Row(
children: <Widget>[
_TickingWidget(),
_MultiTickingWidget(),
Text('Old route'),

View File

@ -808,7 +808,7 @@ void main() {
),
const ColoredBox(color: Color(0xff00ff00), child: square),
]),
Row(mainAxisSize: MainAxisSize.min, children: const <Widget>[
const Row(mainAxisSize: MainAxisSize.min, children: <Widget>[
ColoredBox(color: Color(0xff0000ff), child: square),
ColoredBox(color: Color(0xffeeff00), child: square),
]),

View File

@ -4303,11 +4303,11 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService {
});
Future<void> pumpWidgetForLayoutExplorer(WidgetTester tester) async {
final Widget widget = Directionality(
const Widget widget = Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Row(
children: const <Widget>[
children: <Widget>[
Flexible(
child: ColoredBox(
color: Colors.green,
@ -4959,9 +4959,9 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService {
appBar: AppBar(
title: const Text('Hello World!'),
),
body: Center(
body: const Center(
child: Column(
children: const <Widget>[
children: <Widget>[
Text('Hello World!'),
],
),

View File

@ -841,8 +841,8 @@ void main() {
testWidgets('Object exactly matches container width', (WidgetTester tester) async {
await tester.pumpWidget(
Column(
children: const <Widget>[
const Column(
children: <Widget>[
Wrap(
textDirection: TextDirection.ltr,
spacing: 10.0,
@ -859,8 +859,8 @@ void main() {
verify(tester, <Offset>[Offset.zero]);
await tester.pumpWidget(
Column(
children: const <Widget>[
const Column(
children: <Widget>[
Wrap(
textDirection: TextDirection.ltr,
spacing: 10.0,
@ -893,7 +893,7 @@ void main() {
testWidgets('Horizontal wrap - IntrinsicsHeight', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/48679.
await tester.pumpWidget(
Directionality(
const Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: IntrinsicHeight(
@ -901,13 +901,13 @@ void main() {
color: Colors.green,
child: Wrap(
children: <Widget>[
const Text('Start', style: TextStyle(height: 1.0, fontSize: 16)),
Text('Start', style: TextStyle(height: 1.0, fontSize: 16)),
Row(
children: const <Widget>[
children: <Widget>[
SizedBox(height: 40, width: 60),
],
),
const Text('End', style: TextStyle(height: 1.0, fontSize: 16)),
Text('End', style: TextStyle(height: 1.0, fontSize: 16)),
],
),
),
@ -925,7 +925,7 @@ void main() {
testWidgets('Vertical wrap - IntrinsicsWidth', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/48679.
await tester.pumpWidget(
Directionality(
const Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: IntrinsicWidth(
@ -934,13 +934,13 @@ void main() {
child: Wrap(
direction: Axis.vertical,
children: <Widget>[
const Text('Start', style: TextStyle(height: 1.0, fontSize: 16)),
Text('Start', style: TextStyle(height: 1.0, fontSize: 16)),
Column(
children: const <Widget>[
children: <Widget>[
SizedBox(height: 40, width: 60),
],
),
const Text('End', style: TextStyle(height: 1.0, fontSize: 16)),
Text('End', style: TextStyle(height: 1.0, fontSize: 16)),
],
),
),

Some files were not shown because too many files have changed in this diff Show More