Skip to content

Commit e63f3e3

Browse files
authored
[various] Prep for more const widgets (#3139)
* [various] Prep for more const widgets * exclude from readme
1 parent f14b713 commit e63f3e3

File tree

6 files changed

+54
-21
lines changed

6 files changed

+54
-21
lines changed

packages/flutter_adaptive_scaffold/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ displayed and the entrance animation and exit animation.
140140
inAnimation: AdaptiveScaffold.leftOutIn,
141141
builder: (_) => AdaptiveScaffold.standardNavigationRail(
142142
extended: true,
143+
// ···
143144
leading: Row(
144145
mainAxisAlignment: MainAxisAlignment.spaceAround,
145146
children: const <Widget>[

packages/flutter_adaptive_scaffold/example/lib/adaptive_layout_demo.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ class MyHomePage extends StatelessWidget {
4545
children: <Widget>[
4646
const Divider(color: Colors.black),
4747
const SizedBox(height: 10),
48+
// TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later.
49+
// ignore: prefer_const_constructors
4850
Row(
4951
children: const <Widget>[
5052
SizedBox(
@@ -150,6 +152,10 @@ class MyHomePage extends StatelessWidget {
150152
inAnimation: AdaptiveScaffold.leftOutIn,
151153
builder: (_) => AdaptiveScaffold.standardNavigationRail(
152154
extended: true,
155+
// #enddocregion Example
156+
// TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later.
157+
// ignore: prefer_const_constructors
158+
// #docregion Example
153159
leading: Row(
154160
mainAxisAlignment: MainAxisAlignment.spaceAround,
155161
children: const <Widget>[

packages/flutter_adaptive_scaffold/example/lib/main.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,8 @@ class _LargeComposeIcon extends StatelessWidget {
409409
child: Column(children: <Widget>[
410410
Container(
411411
padding: const EdgeInsets.fromLTRB(6, 0, 0, 0),
412+
// TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later.
413+
// ignore: prefer_const_constructors
412414
child: Row(
413415
mainAxisAlignment: MainAxisAlignment.spaceBetween,
414416
children: const <Widget>[
@@ -439,8 +441,12 @@ class _LargeComposeIcon extends StatelessWidget {
439441
),
440442
width: 200,
441443
height: 50,
444+
// TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later.
445+
// ignore: prefer_const_constructors
442446
child: Padding(
443447
padding: const EdgeInsets.fromLTRB(16.0, 0, 0, 0),
448+
// TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later.
449+
// ignore: prefer_const_constructors
444450
child: Row(
445451
children: const <Widget>[
446452
Icon(Icons.edit_outlined),

packages/flutter_markdown/test/list_test.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@ void defineTests() {
210210

211211
await tester.pumpWidget(
212212
boilerplate(
213+
// TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later.
214+
// ignore: prefer_const_constructors
213215
Column(
214216
children: const <Widget>[
215217
MarkdownBody(fitContent: false, data: data),
@@ -233,6 +235,8 @@ void defineTests() {
233235

234236
await tester.pumpWidget(
235237
boilerplate(
238+
// TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later.
239+
// ignore: prefer_const_constructors
236240
Column(
237241
children: const <Widget>[
238242
MarkdownBody(data: data),

packages/flutter_markdown/test/markdown_body_shrink_wrap_test.dart

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,21 @@ void defineTests() {
1515
'Given a MarkdownBody with shrinkWrap=true '
1616
'Then it wraps its content',
1717
(WidgetTester tester) async {
18-
await tester.pumpWidget(boilerplate(Stack(
19-
children: const <Widget>[
20-
Text('shrinkWrap=true'),
21-
Align(
22-
alignment: Alignment.bottomCenter,
23-
child: MarkdownBody(
24-
data: 'This is a [link](https://flutter.dev/)',
18+
await tester.pumpWidget(boilerplate(
19+
// TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later.
20+
// ignore: prefer_const_constructors
21+
Stack(
22+
children: const <Widget>[
23+
Text('shrinkWrap=true'),
24+
Align(
25+
alignment: Alignment.bottomCenter,
26+
child: MarkdownBody(
27+
data: 'This is a [link](https://flutter.dev/)',
28+
),
2529
),
26-
),
27-
],
28-
)));
30+
],
31+
),
32+
));
2933

3034
final Rect stackRect = tester.getRect(find.byType(Stack));
3135
final Rect textRect = tester.getRect(find.byType(Text));
@@ -43,18 +47,22 @@ void defineTests() {
4347
'Given a MarkdownBody with shrinkWrap=false '
4448
'Then it expands to the maximum allowed height',
4549
(WidgetTester tester) async {
46-
await tester.pumpWidget(boilerplate(Stack(
47-
children: const <Widget>[
48-
Text('shrinkWrap=false test'),
49-
Align(
50-
alignment: Alignment.bottomCenter,
51-
child: MarkdownBody(
52-
data: 'This is a [link](https://flutter.dev/)',
53-
shrinkWrap: false,
50+
await tester.pumpWidget(boilerplate(
51+
// TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later.
52+
// ignore: prefer_const_constructors
53+
Stack(
54+
children: const <Widget>[
55+
Text('shrinkWrap=false test'),
56+
Align(
57+
alignment: Alignment.bottomCenter,
58+
child: MarkdownBody(
59+
data: 'This is a [link](https://flutter.dev/)',
60+
shrinkWrap: false,
61+
),
5462
),
55-
),
56-
],
57-
)));
63+
],
64+
),
65+
));
5866

5967
final Rect stackRect = tester.getRect(find.byType(Stack));
6068
final Rect textRect = tester.getRect(find.byType(Text));

packages/rfw/example/remote/lib/main.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,18 @@ class _ExampleState extends State<Example> {
8787
},
8888
);
8989
} else {
90+
// TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later.
91+
// ignore: prefer_const_constructors
9092
result = Material(
93+
// TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later.
94+
// ignore: prefer_const_constructors
9195
child: SafeArea(
96+
// TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later.
97+
// ignore: prefer_const_constructors
9298
child: Padding(
9399
padding: const EdgeInsets.all(20.0),
100+
// TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later.
101+
// ignore: prefer_const_constructors
94102
child: Column(
95103
crossAxisAlignment: CrossAxisAlignment.stretch,
96104
children: const <Widget>[

0 commit comments

Comments
 (0)