Skip to content

[various] Prep for more const widgets #3139

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/flutter_adaptive_scaffold/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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>[
Expand Down
6 changes: 6 additions & 0 deletions packages/flutter_adaptive_scaffold/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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>[
Expand Down Expand Up @@ -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),
Expand Down
4 changes: 4 additions & 0 deletions packages/flutter_markdown/test/list_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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),
Expand Down
50 changes: 29 additions & 21 deletions packages/flutter_markdown/test/markdown_body_shrink_wrap_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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));
Expand Down
8 changes: 8 additions & 0 deletions packages/rfw/example/remote/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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>[
Expand Down