mirror of
https://github.com/flutter/packages.git
synced 2025-06-27 21:28:33 +08:00
[various] Prep for more const widgets (#3139)
* [various] Prep for more const widgets * exclude from readme
This commit is contained in:

committed by
GitHub

parent
f14b713e79
commit
e63f3e3fc6
@ -140,6 +140,7 @@ displayed and the entrance animation and exit animation.
|
||||
inAnimation: AdaptiveScaffold.leftOutIn,
|
||||
builder: (_) => AdaptiveScaffold.standardNavigationRail(
|
||||
extended: true,
|
||||
// ···
|
||||
leading: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: const <Widget>[
|
||||
|
@ -45,6 +45,8 @@ class MyHomePage extends StatelessWidget {
|
||||
children: <Widget>[
|
||||
const Divider(color: Colors.black),
|
||||
const SizedBox(height: 10),
|
||||
// TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later.
|
||||
// ignore: prefer_const_constructors
|
||||
Row(
|
||||
children: const <Widget>[
|
||||
SizedBox(
|
||||
@ -150,6 +152,10 @@ class MyHomePage extends StatelessWidget {
|
||||
inAnimation: AdaptiveScaffold.leftOutIn,
|
||||
builder: (_) => AdaptiveScaffold.standardNavigationRail(
|
||||
extended: true,
|
||||
// #enddocregion Example
|
||||
// TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later.
|
||||
// ignore: prefer_const_constructors
|
||||
// #docregion Example
|
||||
leading: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: const <Widget>[
|
||||
|
@ -409,6 +409,8 @@ class _LargeComposeIcon extends StatelessWidget {
|
||||
child: Column(children: <Widget>[
|
||||
Container(
|
||||
padding: const EdgeInsets.fromLTRB(6, 0, 0, 0),
|
||||
// TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later.
|
||||
// ignore: prefer_const_constructors
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: const <Widget>[
|
||||
@ -439,8 +441,12 @@ class _LargeComposeIcon extends StatelessWidget {
|
||||
),
|
||||
width: 200,
|
||||
height: 50,
|
||||
// TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later.
|
||||
// ignore: prefer_const_constructors
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16.0, 0, 0, 0),
|
||||
// TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later.
|
||||
// ignore: prefer_const_constructors
|
||||
child: Row(
|
||||
children: const <Widget>[
|
||||
Icon(Icons.edit_outlined),
|
||||
|
@ -210,6 +210,8 @@ void defineTests() {
|
||||
|
||||
await tester.pumpWidget(
|
||||
boilerplate(
|
||||
// TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later.
|
||||
// ignore: prefer_const_constructors
|
||||
Column(
|
||||
children: const <Widget>[
|
||||
MarkdownBody(fitContent: false, data: data),
|
||||
@ -233,6 +235,8 @@ void defineTests() {
|
||||
|
||||
await tester.pumpWidget(
|
||||
boilerplate(
|
||||
// TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later.
|
||||
// ignore: prefer_const_constructors
|
||||
Column(
|
||||
children: const <Widget>[
|
||||
MarkdownBody(data: data),
|
||||
|
@ -15,17 +15,21 @@ void defineTests() {
|
||||
'Given a MarkdownBody with shrinkWrap=true '
|
||||
'Then it wraps its content',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(boilerplate(Stack(
|
||||
children: const <Widget>[
|
||||
Text('shrinkWrap=true'),
|
||||
Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: MarkdownBody(
|
||||
data: 'This is a [link](https://flutter.dev/)',
|
||||
await tester.pumpWidget(boilerplate(
|
||||
// TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later.
|
||||
// ignore: prefer_const_constructors
|
||||
Stack(
|
||||
children: const <Widget>[
|
||||
Text('shrinkWrap=true'),
|
||||
Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: MarkdownBody(
|
||||
data: 'This is a [link](https://flutter.dev/)',
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)));
|
||||
],
|
||||
),
|
||||
));
|
||||
|
||||
final Rect stackRect = tester.getRect(find.byType(Stack));
|
||||
final Rect textRect = tester.getRect(find.byType(Text));
|
||||
@ -43,18 +47,22 @@ void defineTests() {
|
||||
'Given a MarkdownBody with shrinkWrap=false '
|
||||
'Then it expands to the maximum allowed height',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(boilerplate(Stack(
|
||||
children: const <Widget>[
|
||||
Text('shrinkWrap=false test'),
|
||||
Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: MarkdownBody(
|
||||
data: 'This is a [link](https://flutter.dev/)',
|
||||
shrinkWrap: false,
|
||||
await tester.pumpWidget(boilerplate(
|
||||
// TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later.
|
||||
// ignore: prefer_const_constructors
|
||||
Stack(
|
||||
children: const <Widget>[
|
||||
Text('shrinkWrap=false test'),
|
||||
Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: MarkdownBody(
|
||||
data: 'This is a [link](https://flutter.dev/)',
|
||||
shrinkWrap: false,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)));
|
||||
],
|
||||
),
|
||||
));
|
||||
|
||||
final Rect stackRect = tester.getRect(find.byType(Stack));
|
||||
final Rect textRect = tester.getRect(find.byType(Text));
|
||||
|
@ -87,10 +87,18 @@ class _ExampleState extends State<Example> {
|
||||
},
|
||||
);
|
||||
} else {
|
||||
// TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later.
|
||||
// ignore: prefer_const_constructors
|
||||
result = Material(
|
||||
// TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later.
|
||||
// ignore: prefer_const_constructors
|
||||
child: SafeArea(
|
||||
// TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later.
|
||||
// ignore: prefer_const_constructors
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
// TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later.
|
||||
// ignore: prefer_const_constructors
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: const <Widget>[
|
||||
|
Reference in New Issue
Block a user