forked from firka/flutter
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:
committed by
GitHub
parent
3f986e4238
commit
b0f1714b7b
@@ -14,15 +14,15 @@ void main() {
|
||||
appBar: AppBar(
|
||||
title: const Text('RenderFlex OverFlow'),
|
||||
),
|
||||
body: SizedBox(
|
||||
body: const SizedBox(
|
||||
width: 400.0,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
const Icon(Icons.message),
|
||||
Icon(Icons.message),
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: const <Widget>[
|
||||
children: <Widget>[
|
||||
Text('Title'),
|
||||
Text(
|
||||
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed '
|
||||
|
||||
@@ -279,11 +279,11 @@ class IconBar extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 16.0, right: 16.0),
|
||||
return const Padding(
|
||||
padding: EdgeInsets.only(left: 16.0, right: 16.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: const <Widget>[
|
||||
children: <Widget>[
|
||||
IconWithText(Icons.thumb_up, 'Like'),
|
||||
IconWithText(Icons.comment, 'Comment'),
|
||||
IconWithText(Icons.share, 'Share'),
|
||||
@@ -578,9 +578,9 @@ class BottomBar extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
child: const Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: const <Widget>[
|
||||
children: <Widget>[
|
||||
BottomBarButton(Icons.new_releases, 'News'),
|
||||
BottomBarButton(Icons.people, 'Requests'),
|
||||
BottomBarButton(Icons.chat, 'Messenger'),
|
||||
|
||||
@@ -12,10 +12,10 @@ class CubicBezierPage extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
return const Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: const <Widget>[
|
||||
children: <Widget>[
|
||||
Bezier(Colors.amber, 1.0),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -88,9 +88,9 @@ class StackSizePage extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Material(
|
||||
return const Material(
|
||||
child: Column(
|
||||
children: const <Widget>[
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: 200,
|
||||
height: 100,
|
||||
|
||||
@@ -9,10 +9,10 @@ class TextPage extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Material(
|
||||
return const Material(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: const <Widget>[
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: 200,
|
||||
height: 100,
|
||||
|
||||
@@ -20,10 +20,10 @@ class BenchSimpleLazyTextScroll extends WidgetRecorder {
|
||||
|
||||
@override
|
||||
Widget createWidget() {
|
||||
return Directionality(
|
||||
return const Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: Row(
|
||||
children: const <Widget>[
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: _TestScrollingWidget(
|
||||
initialScrollOffset: 0,
|
||||
|
||||
@@ -28,8 +28,8 @@ Future<void> main() async {
|
||||
Icon(Icons.ac_unit),
|
||||
],
|
||||
),
|
||||
body: Column(
|
||||
children: const <Widget>[
|
||||
body: const Column(
|
||||
children: <Widget>[
|
||||
Text('Item 1'),
|
||||
Text('Item 2'),
|
||||
Text('Item 3'),
|
||||
|
||||
@@ -345,8 +345,8 @@ class _CreateCompanySheet extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: const <Widget>[
|
||||
return const Column(
|
||||
children: <Widget>[
|
||||
TextField(
|
||||
autofocus: true,
|
||||
decoration: InputDecoration(
|
||||
|
||||
@@ -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')
|
||||
),
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -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.'),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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'),
|
||||
],
|
||||
|
||||
@@ -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.'),
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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),
|
||||
],
|
||||
|
||||
@@ -432,25 +432,25 @@ class _FocusDemoState extends State<FocusDemo> {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
const Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: const <Widget>[
|
||||
children: <Widget>[
|
||||
DemoButton(name: 'One'),
|
||||
DemoButton(name: 'Two'),
|
||||
DemoButton(name: 'Three'),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
const Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: const <Widget>[
|
||||
children: <Widget>[
|
||||
DemoButton(name: 'Four'),
|
||||
DemoButton(name: 'Five'),
|
||||
DemoButton(name: 'Six'),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
const Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: const <Widget>[
|
||||
children: <Widget>[
|
||||
DemoButton(name: 'Seven'),
|
||||
DemoButton(name: 'Eight'),
|
||||
DemoButton(name: 'Nine'),
|
||||
|
||||
@@ -270,9 +270,9 @@ class DragAndDropAppState extends State<DragAndDropApp> {
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
const Expanded(
|
||||
child: Row(
|
||||
children: const <Widget>[
|
||||
children: <Widget>[
|
||||
Expanded(child: ExampleDragTarget()),
|
||||
Expanded(child: ExampleDragTarget()),
|
||||
Expanded(child: ExampleDragTarget()),
|
||||
|
||||
@@ -152,18 +152,18 @@ class _FocusDemoState extends State<FocusDemo> {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
const Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: const <Widget>[
|
||||
children: <Widget>[
|
||||
DemoButton(
|
||||
name: 'One',
|
||||
autofocus: true,
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
const Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: const <Widget>[
|
||||
children: <Widget>[
|
||||
DemoButton(name: 'Two'),
|
||||
DemoButton(
|
||||
name: 'Three',
|
||||
@@ -171,9 +171,9 @@ class _FocusDemoState extends State<FocusDemo> {
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
const Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: const <Widget>[
|
||||
children: <Widget>[
|
||||
DemoButton(name: 'Four'),
|
||||
DemoButton(name: 'Five'),
|
||||
DemoButton(name: 'Six'),
|
||||
|
||||
@@ -65,8 +65,8 @@ class TestRootState extends State<TestRoot> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return _showRow
|
||||
? Row(
|
||||
children: const <Widget>[
|
||||
? const Row(
|
||||
children: <Widget>[
|
||||
TestChildWidget(),
|
||||
TestChildWidget(),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user