Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit b0f1714

Browse files
authored
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
1 parent 3f986e4 commit b0f1714

File tree

107 files changed

+520
-515
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+520
-515
lines changed

dev/automated_tests/flutter_test/print_correct_local_widget_test.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ void main() {
1414
appBar: AppBar(
1515
title: const Text('RenderFlex OverFlow'),
1616
),
17-
body: SizedBox(
17+
body: const SizedBox(
1818
width: 400.0,
1919
child: Row(
2020
children: <Widget>[
21-
const Icon(Icons.message),
21+
Icon(Icons.message),
2222
Column(
2323
mainAxisSize: MainAxisSize.min,
2424
crossAxisAlignment: CrossAxisAlignment.start,
25-
children: const <Widget>[
25+
children: <Widget>[
2626
Text('Title'),
2727
Text(
2828
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed '

dev/benchmarks/complex_layout/lib/src/app.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -279,11 +279,11 @@ class IconBar extends StatelessWidget {
279279

280280
@override
281281
Widget build(BuildContext context) {
282-
return Padding(
283-
padding: const EdgeInsets.only(left: 16.0, right: 16.0),
282+
return const Padding(
283+
padding: EdgeInsets.only(left: 16.0, right: 16.0),
284284
child: Row(
285285
mainAxisAlignment: MainAxisAlignment.spaceBetween,
286-
children: const <Widget>[
286+
children: <Widget>[
287287
IconWithText(Icons.thumb_up, 'Like'),
288288
IconWithText(Icons.comment, 'Comment'),
289289
IconWithText(Icons.share, 'Share'),
@@ -578,9 +578,9 @@ class BottomBar extends StatelessWidget {
578578
),
579579
),
580580
),
581-
child: Row(
581+
child: const Row(
582582
mainAxisAlignment: MainAxisAlignment.spaceBetween,
583-
children: const <Widget>[
583+
children: <Widget>[
584584
BottomBarButton(Icons.new_releases, 'News'),
585585
BottomBarButton(Icons.people, 'Requests'),
586586
BottomBarButton(Icons.chat, 'Messenger'),

dev/benchmarks/macrobenchmarks/lib/src/cubic_bezier.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ class CubicBezierPage extends StatelessWidget {
1212

1313
@override
1414
Widget build(BuildContext context) {
15-
return Center(
15+
return const Center(
1616
child: Column(
1717
mainAxisAlignment: MainAxisAlignment.center,
18-
children: const <Widget>[
18+
children: <Widget>[
1919
Bezier(Colors.amber, 1.0),
2020
],
2121
),

dev/benchmarks/macrobenchmarks/lib/src/stack_size.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ class StackSizePage extends StatelessWidget {
8888

8989
@override
9090
Widget build(BuildContext context) {
91-
return Material(
91+
return const Material(
9292
child: Column(
93-
children: const <Widget>[
93+
children: <Widget>[
9494
SizedBox(
9595
width: 200,
9696
height: 100,

dev/benchmarks/macrobenchmarks/lib/src/text.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ class TextPage extends StatelessWidget {
99

1010
@override
1111
Widget build(BuildContext context) {
12-
return Material(
12+
return const Material(
1313
child: Column(
1414
mainAxisAlignment: MainAxisAlignment.center,
15-
children: const <Widget>[
15+
children: <Widget>[
1616
SizedBox(
1717
width: 200,
1818
height: 100,

dev/benchmarks/macrobenchmarks/lib/src/web/bench_simple_lazy_text_scroll.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ class BenchSimpleLazyTextScroll extends WidgetRecorder {
2020

2121
@override
2222
Widget createWidget() {
23-
return Directionality(
23+
return const Directionality(
2424
textDirection: TextDirection.ltr,
2525
child: Row(
26-
children: const <Widget>[
26+
children: <Widget>[
2727
Flexible(
2828
child: _TestScrollingWidget(
2929
initialScrollOffset: 0,

dev/benchmarks/microbenchmarks/lib/foundation/all_elements_bench.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ Future<void> main() async {
2828
Icon(Icons.ac_unit),
2929
],
3030
),
31-
body: Column(
32-
children: const <Widget>[
31+
body: const Column(
32+
children: <Widget>[
3333
Text('Item 1'),
3434
Text('Item 2'),
3535
Text('Item 3'),

dev/benchmarks/test_apps/stocks/lib/stock_home.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,8 @@ class _CreateCompanySheet extends StatelessWidget {
345345

346346
@override
347347
Widget build(BuildContext context) {
348-
return Column(
349-
children: const <Widget>[
348+
return const Column(
349+
children: <Widget>[
350350
TextField(
351351
autofocus: true,
352352
decoration: InputDecoration(

dev/integration_tests/abstract_method_smoke_test/lib/main.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ class SecondPage extends StatelessWidget {
5959

6060
@override
6161
Widget build(BuildContext context) {
62-
return Scaffold(
62+
return const Scaffold(
6363
body: Column(
64-
children: const <Widget>[
64+
children: <Widget>[
6565
Expanded(
6666
child: AndroidView(viewType: 'simple')
6767
),

dev/integration_tests/flutter_gallery/lib/demo/cupertino/cupertino_switch_demo.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ class _CupertinoSwitchDemoState extends State<CupertinoSwitchDemo> {
5757
),
5858
Semantics(
5959
container: true,
60-
child: Column(
61-
children: const <Widget>[
60+
child: const Column(
61+
children: <Widget>[
6262
CupertinoSwitch(
6363
value: true,
6464
onChanged: null,
@@ -71,8 +71,8 @@ class _CupertinoSwitchDemoState extends State<CupertinoSwitchDemo> {
7171
),
7272
Semantics(
7373
container: true,
74-
child: Column(
75-
children: const <Widget>[
74+
child: const Column(
75+
children: <Widget>[
7676
CupertinoSwitch(
7777
value: false,
7878
onChanged: null,

0 commit comments

Comments
 (0)