end of sort_child_properties_last (#82457)

This commit is contained in:
Alexandre Ardhuin
2021-05-13 22:39:04 +02:00
committed by GitHub
parent d9db3ea6e6
commit 157bc92d4a
120 changed files with 395 additions and 392 deletions

View File

@@ -87,8 +87,8 @@ class _FilteredChildAnimationPageState extends State<FilteredChildAnimationPage>
children: List<Widget>.generate(rows, (int r) => Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: List<Widget>.generate(cols, (int c) => Container(
child: Text('text', style: TextStyle(fontSize: fontSize)),
decoration: decoration,
child: Text('text', style: TextStyle(fontSize: fontSize)),
)),
)),
),
@@ -138,8 +138,8 @@ class _FilteredChildAnimationPageState extends State<FilteredChildAnimationPage>
return RepaintBoundary(
child: AnimatedBuilder(
animation: _controller,
child: protectChild ? RepaintBoundary(child: child) : child,
builder: builder,
child: protectChild ? RepaintBoundary(child: child) : child,
),
);
}

View File

@@ -75,16 +75,16 @@ class _MultiWidgetConstructTableState extends State<MultiWidgetConstructTable>
key: ValueKey<int>(widgetCounter + label),
color: Color.lerp(
Colors.white, baseColor, label / totalLength),
child: Text('${widgetCounter + label}'),
constraints: BoxConstraints.expand(height: height),
child: Text('${widgetCounter + label}'),
)
: MyContainer(
// This key forces rebuilding the element
key: ValueKey<int>(widgetCounter + label),
color: Color.lerp(
Colors.white, baseColor, label / totalLength),
child: Text('${widgetCounter + label}'),
constraints: BoxConstraints.expand(height: height),
child: Text('${widgetCounter + label}'),
);
},
),
@@ -109,8 +109,8 @@ class MyContainer extends StatelessWidget {
Widget build(BuildContext context) {
return Container(
color: color,
child: child,
constraints: constraints,
child: child,
);
}
}

View File

@@ -310,9 +310,9 @@ class StockHomeState extends State<StockHome> {
Widget buildFloatingActionButton() {
return FloatingActionButton(
tooltip: 'Create company',
child: const Icon(Icons.add),
backgroundColor: Theme.of(context).colorScheme.secondary,
onPressed: _handleCreateCompany,
child: const Icon(Icons.add),
);
}

View File

@@ -57,6 +57,8 @@ class StockRow extends StatelessWidget {
),
Expanded(
child: Row(
crossAxisAlignment: CrossAxisAlignment.baseline,
textBaseline: DefaultTextStyle.of(context).style.textBaseline,
children: <Widget>[
Expanded(
flex: 2,
@@ -77,8 +79,6 @@ class StockRow extends StatelessWidget {
),
),
],
crossAxisAlignment: CrossAxisAlignment.baseline,
textBaseline: DefaultTextStyle.of(context).style.textBaseline,
),
),
],

View File

@@ -28,8 +28,10 @@ class _StockSymbolView extends StatelessWidget {
return Container(
padding: const EdgeInsets.all(20.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
stock.symbol,
@@ -38,7 +40,6 @@ class _StockSymbolView extends StatelessWidget {
),
arrow,
],
mainAxisAlignment: MainAxisAlignment.spaceBetween,
),
Text('Last Sale', style: headings),
Text('$lastSale ($changeInPrice)'),
@@ -61,7 +62,6 @@ class _StockSymbolView extends StatelessWidget {
),
),
],
mainAxisSize: MainAxisSize.min,
),
);
}

View File

@@ -82,8 +82,8 @@ class MotionEventsBodyState extends State<MotionEventsBody> {
children: <Widget>[
Expanded(
child: ElevatedButton(
child: const Text('RECORD'),
onPressed: listenToFlutterViewEvents,
child: const Text('RECORD'),
),
),
Expanded(

View File

@@ -57,20 +57,20 @@ class WindowManagerBodyState extends State<WindowManagerBody> {
if (viewChannel != null) ... <Widget>[
ElevatedButton(
key: const ValueKey<String>('ShowAlertDialog'),
child: const Text('SHOW ALERT DIALOG'),
onPressed: onShowAlertDialogPressed,
child: const Text('SHOW ALERT DIALOG'),
),
Row(
children: <Widget>[
ElevatedButton(
key: const ValueKey<String>('AddWindow'),
child: const Text('ADD WINDOW'),
onPressed: onAddWindowPressed,
child: const Text('ADD WINDOW'),
),
ElevatedButton(
key: const ValueKey<String>('TapWindow'),
child: const Text('TAP WINDOW'),
onPressed: onTapWindowPressed,
child: const Text('TAP WINDOW'),
),
if (windowClickCount > 0)
Text(

View File

@@ -157,8 +157,8 @@ Press play to produce texture frames.''';
),
floatingActionButton: _icon == null ? null : FloatingActionButton(
key: const ValueKey<String>('fab'),
child: Icon(_icon),
onPressed: _nextState,
child: Icon(_icon),
),
),
);

View File

@@ -70,20 +70,20 @@ class _CupertinoAlertDemoState extends State<CupertinoAlertDemo> {
),
const Padding(padding: EdgeInsets.all(8.0)),
CupertinoButton.filled(
child: const Text('Alert with Title'),
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 36.0),
child: const Text('Alert with Title'),
onPressed: () => _onAlertWithTitlePress(context),
),
const Padding(padding: EdgeInsets.all(8.0)),
CupertinoButton.filled(
child: const Text('Alert with Buttons'),
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 36.0),
child: const Text('Alert with Buttons'),
onPressed: () => _onAlertWithButtonsPress(context),
),
const Padding(padding: EdgeInsets.all(8.0)),
CupertinoButton.filled(
child: const Text('Alert Buttons Only'),
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 36.0),
child: const Text('Alert Buttons Only'),
onPressed: () {
showDemoDialog(
context: context,
@@ -93,8 +93,8 @@ class _CupertinoAlertDemoState extends State<CupertinoAlertDemo> {
),
const Padding(padding: EdgeInsets.all(8.0)),
CupertinoButton.filled(
child: const Text('Action Sheet'),
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 36.0),
child: const Text('Action Sheet'),
onPressed: () => _onActionSheetPress(context),
),
],
@@ -120,13 +120,13 @@ class _CupertinoAlertDemoState extends State<CupertinoAlertDemo> {
title: const Text('Discard draft?'),
actions: <Widget>[
CupertinoDialogAction(
child: const Text('Discard'),
isDestructiveAction: true,
child: const Text('Discard'),
onPressed: () => Navigator.pop(context, 'Discard'),
),
CupertinoDialogAction(
child: const Text('Cancel'),
isDefaultAction: true,
child: const Text('Cancel'),
onPressed: () => Navigator.pop(context, 'Cancel'),
),
],
@@ -188,8 +188,8 @@ class _CupertinoAlertDemoState extends State<CupertinoAlertDemo> {
),
],
cancelButton: CupertinoActionSheetAction(
child: const Text('Cancel'),
isDefaultAction: true,
child: const Text('Cancel'),
onPressed: () => Navigator.pop(context, 'Cancel'),
),
),
@@ -252,8 +252,8 @@ class CupertinoDessertDialog extends StatelessWidget {
},
),
CupertinoDialogAction(
child: const Text('Cancel'),
isDestructiveAction: true,
child: const Text('Cancel'),
onPressed: () {
Navigator.pop(context, 'Cancel');
},

View File

@@ -61,8 +61,8 @@ class _CupertinoButtonDemoState extends State<CupertinoButtonsDemo> {
},
),
const CupertinoButton(
child: Text('Disabled'),
onPressed: null,
child: Text('Disabled'),
),
],
),
@@ -76,8 +76,8 @@ class _CupertinoButtonDemoState extends State<CupertinoButtonsDemo> {
),
const Padding(padding: EdgeInsets.all(12.0)),
const CupertinoButton.filled(
child: Text('Disabled'),
onPressed: null,
child: Text('Disabled'),
),
],
),

View File

@@ -113,8 +113,8 @@ class ExitButton extends StatelessWidget {
padding: EdgeInsets.zero,
child: const Tooltip(
message: 'Back',
child: Text('Exit'),
excludeFromSemantics: true,
child: Text('Exit'),
),
onPressed: () {
// The demo is on the root navigator.
@@ -808,8 +808,8 @@ class Tab3Dialog extends StatelessWidget {
return CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
leading: CupertinoButton(
child: const Text('Cancel'),
padding: EdgeInsets.zero,
child: const Text('Cancel'),
onPressed: () {
Navigator.of(context).pop(false);
},

View File

@@ -45,13 +45,13 @@ class _CupertinoTextFieldDemoState extends State<CupertinoTextFieldDemo> {
padding: const EdgeInsets.symmetric(horizontal: 2.0),
child: CupertinoButton(
minSize: 0.0,
padding: const EdgeInsets.only(bottom: 4),
onPressed: () => setState(() => _chatTextController!.clear()),
child: const Icon(
CupertinoIcons.arrow_up_circle_fill,
size: 28.0,
color: CupertinoColors.activeGreen,
),
padding: const EdgeInsets.only(bottom: 4),
onPressed: ()=> setState(()=> _chatTextController!.clear()),
),
),
autofocus: true,

View File

@@ -35,8 +35,8 @@ class _BottomAppBarDemoState extends State<BottomAppBarDemo> {
label: 'circular floating action button',
value: FloatingActionButton(
onPressed: _showSnackbar,
child: Icon(Icons.add, semanticLabel: 'Action'),
backgroundColor: Colors.orange,
child: Icon(Icons.add, semanticLabel: 'Action'),
),
);
@@ -431,6 +431,7 @@ class _DiamondFab extends StatelessWidget {
return Material(
shape: const _DiamondBorder(),
color: Colors.orange,
elevation: 6.0,
child: InkWell(
onTap: onPressed,
child: SizedBox(
@@ -442,7 +443,6 @@ class _DiamondFab extends StatelessWidget {
),
),
),
elevation: 6.0,
);
}
}

View File

@@ -138,8 +138,8 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
},
),
const ElevatedButton(
child: Text('DISABLED', semanticsLabel: 'DISABLED BUTTON 1'),
onPressed: null,
child: Text('DISABLED', semanticsLabel: 'DISABLED BUTTON 1'),
),
],
),
@@ -185,8 +185,8 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
},
),
const TextButton(
child: Text('DISABLED', semanticsLabel: 'DISABLED BUTTON 3',),
onPressed: null,
child: Text('DISABLED', semanticsLabel: 'DISABLED BUTTON 3',),
),
],
),
@@ -233,8 +233,8 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
),
OutlinedButton(
style: style,
child: const Text('DISABLED', semanticsLabel: 'DISABLED BUTTON 5'),
onPressed: null,
child: const Text('DISABLED', semanticsLabel: 'DISABLED BUTTON 5'),
),
],
),
@@ -376,11 +376,11 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
return Align(
alignment: const Alignment(0.0, -0.2),
child: FloatingActionButton(
tooltip: 'floating action button',
child: const Icon(Icons.add),
onPressed: () {
// Perform some action
},
tooltip: 'floating action button',
),
);
}

View File

@@ -29,6 +29,7 @@ class _PageSelector extends StatelessWidget {
Container(
margin: const EdgeInsets.only(top: 16.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
IconButton(
icon: const Icon(Icons.chevron_left),
@@ -44,7 +45,6 @@ class _PageSelector extends StatelessWidget {
tooltip: 'Page forward',
),
],
mainAxisAlignment: MainAxisAlignment.spaceBetween,
),
),
Expanded(

View File

@@ -96,7 +96,10 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> with Sing
];
return Column(
children: indicators
.map<Widget>((Widget c) => Container(child: c, margin: const EdgeInsets.symmetric(vertical: 15.0, horizontal: 20.0)))
.map<Widget>((Widget c) => Container(
margin: const EdgeInsets.symmetric(vertical: 15.0, horizontal: 20.0),
child: c,
))
.toList(),
);
}

View File

@@ -150,8 +150,9 @@ class _ListDemoState extends State<ReorderableListDemo> {
key: Key(item.value),
height: 100.0,
width: 100.0,
child: CircleAvatar(child: Text(item.value),
child: CircleAvatar(
backgroundColor: Colors.green,
child: Text(item.value),
),
);
break;

View File

@@ -84,8 +84,8 @@ class _SnackBarDemoState extends State<SnackBarDemo> {
builder: buildBody
),
floatingActionButton: FloatingActionButton(
child: const Icon(Icons.add),
tooltip: 'Create',
child: const Icon(Icons.add),
onPressed: () {
print('Floating Action Button was pressed');
},

View File

@@ -125,8 +125,8 @@ class _TabsFabDemoState extends State<TabsFabDemo> with SingleTickerProviderStat
key: page.fabKey,
tooltip: 'Show explanation',
backgroundColor: page.fabColor,
child: page.fabIcon,
onPressed: _showExplanatoryText,
child: page.fabIcon,
);
}

View File

@@ -280,8 +280,8 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
const SizedBox(height: 24.0),
Center(
child: ElevatedButton(
child: const Text('SUBMIT'),
onPressed: _handleSubmitted,
child: const Text('SUBMIT'),
),
),
const SizedBox(height: 24.0),

View File

@@ -277,8 +277,8 @@ class ExpandingBottomSheetState extends State<ExpandingBottomSheet> with TickerP
children: <Widget>[
AnimatedPadding(
padding: _cartPaddingFor(numProducts),
child: const Icon(Icons.shopping_cart),
duration: const Duration(milliseconds: 225),
child: const Icon(Icons.shopping_cart),
),
Container(
// Accounts for the overflow number

View File

@@ -40,7 +40,7 @@ class HomePage extends StatelessWidget {
children: <Widget>[
if (backdrop != null)
backdrop!,
Align(child: expandingBottomSheet, alignment: Alignment.bottomRight),
Align(alignment: Alignment.bottomRight, child: expandingBottomSheet),
],
);
}

View File

@@ -133,8 +133,8 @@ class PrimaryColorOverride extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Theme(
child: child!,
data: Theme.of(context).copyWith(primaryColor: color),
child: child!,
);
}
}

View File

@@ -78,8 +78,8 @@ class AsymmetricView extends StatelessWidget {
return ListView(
scrollDirection: Axis.horizontal,
padding: const EdgeInsets.fromLTRB(0.0, 34.0, 16.0, 44.0),
children: _buildColumns(context),
physics: const AlwaysScrollableScrollPhysics(),
children: _buildColumns(context),
);
}
}

View File

@@ -68,9 +68,6 @@ class _TransformationsDemoState extends State<TransformationsDemo> {
_reset = false;
});
},
child: CustomPaint(
painter: painter,
),
boundaryRect: Rect.fromLTWH(
-visibleSize.width / 2,
-visibleSize.height / 2,
@@ -83,6 +80,9 @@ class _TransformationsDemoState extends State<TransformationsDemo> {
initialTranslation: Offset(size.width / 2, size.height / 2),
onTapUp: _onTapUp,
size: size,
child: CustomPaint(
painter: painter,
),
);
},
),

View File

@@ -288,9 +288,9 @@ class _GestureTransformableState extends State<GestureTransformable> with Ticker
child: Transform(
transform: _transform,
child: SizedBox(
child: widget.child,
height: widget.size.height,
width: widget.size.width,
child: widget.child,
),
),
),

View File

@@ -127,11 +127,11 @@ class _VideoPlayerLoadingState extends State<VideoPlayerLoading> {
return VideoPlayer(widget.controller!);
}
return Stack(
fit: StackFit.expand,
children: <Widget>[
VideoPlayer(widget.controller!),
const Center(child: CircularProgressIndicator()),
],
fit: StackFit.expand,
);
}
}
@@ -419,6 +419,7 @@ class _VideoDemoState extends State<VideoDemo> with SingleTickerProviderStateMix
),
body: isSupported
? ConnectivityOverlay(
connectedCompleter: connectedCompleter,
child: Scrollbar(
child: ListView(
children: <Widget>[
@@ -435,7 +436,6 @@ class _VideoDemoState extends State<VideoDemo> with SingleTickerProviderStateMix
],
),
),
connectedCompleter: connectedCompleter,
)
: const Center(
child: Text(

View File

@@ -296,9 +296,9 @@ class _BackdropState extends State<Backdrop> with SingleTickerProviderStateMixin
AnimationStatus.dismissed,
controller: _controller,
child: Visibility(
child: widget.backLayer!,
visible: _controller!.status != AnimationStatus.completed,
maintainState: true,
child: widget.backLayer!,
),
),
),

View File

@@ -26,8 +26,8 @@ ElevatedButton(
// Buttons are disabled when onPressed isn't
// specified or is null.
const ElevatedButton(
child: Text('BUTTON TITLE'),
onPressed: null,
child: Text('BUTTON TITLE'),
);
// Create a button with an icon and a
@@ -54,8 +54,8 @@ OutlinedButton(
// Buttons are disabled when onPressed isn't
// specified or is null.
const OutlinedButton(
child: Text('BUTTON TITLE'),
onPressed: null,
child: Text('BUTTON TITLE'),
);
// Create a button with an icon and a
@@ -82,8 +82,8 @@ TextButton(
// Buttons are disabled when onPressed isn't
// specified or is null.
const TextButton(
child: Text('BUTTON TITLE'),
onPressed: null,
child: Text('BUTTON TITLE'),
);
// END
@@ -136,8 +136,8 @@ Scaffold(
title: const Text('Demo'),
),
floatingActionButton: const FloatingActionButton(
child: Icon(Icons.add),
onPressed: null,
child: Icon(Icons.add),
),
);
// END

View File

@@ -288,11 +288,11 @@ class _GalleryHomeState extends State<GalleryHome> with SingleTickerProviderStat
static Widget _topHomeLayout(Widget? currentChild, List<Widget> previousChildren) {
return Stack(
alignment: Alignment.topCenter,
children: <Widget>[
...previousChildren,
if (currentChild != null) currentChild,
],
alignment: Alignment.topCenter,
);
}
@@ -400,8 +400,8 @@ class _GalleryHomeState extends State<GalleryHome> with SingleTickerProviderStat
);
}
home = AnnotatedRegion<SystemUiOverlayStyle>(
child: home,
value: SystemUiOverlayStyle.light,
child: home,
);
return home;

View File

@@ -203,8 +203,8 @@ class _Heading extends StatelessWidget {
fontWeight: FontWeight.w700,
),
child: Semantics(
child: Text(text),
header: true,
child: Text(text),
),
),
);

View File

@@ -66,8 +66,8 @@ class MotionEventsBodyState extends State<MotionEventsBody> {
children: <Widget>[
Expanded(
child: ElevatedButton(
child: const Text('RECORD'),
onPressed: listenToFlutterViewEvents,
child: const Text('RECORD'),
),
),
Expanded(

View File

@@ -61,25 +61,25 @@ class NestedViewEventBodyState extends State<NestedViewEventBody> {
if (viewChannel != null) ... <Widget>[
ElevatedButton(
key: const ValueKey<String>('ShowAlertDialog'),
child: const Text('SHOW ALERT DIALOG'),
onPressed: onShowAlertDialogPressed,
child: const Text('SHOW ALERT DIALOG'),
),
ElevatedButton(
key: const ValueKey<String>('TogglePlatformView'),
child: const Text('TOGGLE PLATFORM VIEW'),
onPressed: onTogglePlatformView,
child: const Text('TOGGLE PLATFORM VIEW'),
),
Row(
children: <Widget>[
ElevatedButton(
key: const ValueKey<String>('AddChildView'),
child: const Text('ADD CHILD VIEW'),
onPressed: onChildViewPressed,
child: const Text('ADD CHILD VIEW'),
),
ElevatedButton(
key: const ValueKey<String>('TapChildView'),
child: const Text('TAP CHILD VIEW'),
onPressed: onTapChildViewPressed,
child: const Text('TAP CHILD VIEW'),
),
if (nestedViewClickCount > 0)
Text(

View File

@@ -83,8 +83,8 @@ class PlatformViewPage extends StatelessWidget {
children: <Widget>[
const Expanded(
child: SizedBox(
child: UiKitView(viewType: 'platform_view'),
width: 300,
child: UiKitView(viewType: 'platform_view'),
),
),
ElevatedButton(

View File

@@ -455,23 +455,23 @@ class _FocusDemoState extends State<FocusDemo> {
Padding(
padding: const EdgeInsets.all(8.0),
child: ElevatedButton(
child: const Text('UNDO'),
onPressed: canUndo
? () {
Actions.invoke(context, const UndoIntent());
}
: null,
child: const Text('UNDO'),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: ElevatedButton(
child: const Text('REDO'),
onPressed: canRedo
? () {
Actions.invoke(context, const RedoIntent());
}
: null,
child: const Text('REDO'),
),
),
],

View File

@@ -366,7 +366,7 @@ class CardCollectionState extends State<CardCollection> {
cardCollection = Stack(
children: <Widget>[
Column(children: <Widget>[Image.network(_sunshineURL)]),
ShaderMask(child: cardCollection, shaderCallback: _createShader),
ShaderMask(shaderCallback: _createShader, child: cardCollection),
],
);
}

View File

@@ -309,12 +309,12 @@ class _OptionsState extends State<Options> {
},
items: const <DropdownMenuItem<String>>[
DropdownMenuItem<String>(
child: Text('Standard'),
value: 'standard',
child: Text('Standard'),
),
DropdownMenuItem<String>(child: Text('Comfortable'), value: 'comfortable'),
DropdownMenuItem<String>(child: Text('Compact'), value: 'compact'),
DropdownMenuItem<String>(child: Text('Custom'), value: 'custom'),
DropdownMenuItem<String>(value: 'comfortable', child: Text('Comfortable')),
DropdownMenuItem<String>(value: 'compact', child: Text('Compact')),
DropdownMenuItem<String>(value: 'custom', child: Text('Custom')),
],
value: _densityToProfile(widget.model.density),
),

View File

@@ -65,13 +65,13 @@ class _HoverDemoState extends State<HoverDemo> {
children: <Widget>[
ElevatedButton(
onPressed: () => print('Button pressed.'),
child: const Text('Button'),
style: overrideFocusColor,
child: const Text('Button'),
),
TextButton(
onPressed: () => print('Button pressed.'),
child: const Text('Button'),
style: overrideFocusColor,
child: const Text('Button'),
),
IconButton(
onPressed: () => print('Button pressed'),

View File

@@ -121,9 +121,9 @@ class PageViewAppState extends State<PageViewApp> {
Widget _buildBody(BuildContext context) {
return PageView(
children: cardModels.map<Widget>(buildCard).toList(),
// TODO(abarth): itemsWrap: itemsWrap,
scrollDirection: scrollDirection,
children: cardModels.map<Widget>(buildCard).toList(),
);
}