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
107 changed files with 520 additions and 515 deletions

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),
],