Revert "Changing ElevatedButton.child to be non-nullable (#87901)" (#88071)

This reverts commit 724c0eb65cef6a66241f9f1500dc9ed53991d5be.
This commit is contained in:
Hans Muller 2021-08-11 17:29:29 -07:00 committed by GitHub
parent e127665795
commit 871386bbb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

View File

@ -96,7 +96,7 @@ class ElevatedButton extends ButtonStyleButton {
FocusNode? focusNode,
bool autofocus = false,
Clip clipBehavior = Clip.none,
required Widget child,
required Widget? child,
}) : super(
key: key,
onPressed: onPressed,

View File

@ -7157,7 +7157,7 @@ class IgnorePointer extends SingleChildRenderObjectWidget {
/// height: 100.0,
/// child: ElevatedButton(
/// onPressed: () {},
/// child: const Text('Lower'),
/// child: null,
/// ),
/// ),
/// SizedBox(
@ -7170,7 +7170,7 @@ class IgnorePointer extends SingleChildRenderObjectWidget {
/// primary: Colors.blue.shade200,
/// ),
/// onPressed: () {},
/// child: const Text('Upper'),
/// child: null,
/// ),
/// ),
/// ),

View File

@ -244,7 +244,7 @@ void main() {
onPressed: () {
pressed = true;
},
child: const Text('Button'),
child: null,
),
const Material(
type: MaterialType.transparency,

View File

@ -287,7 +287,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService {
final GlobalKey topButtonKey = GlobalKey();
Widget selectButtonBuilder(BuildContext context, VoidCallback onPressed) {
return Material(child: ElevatedButton(onPressed: onPressed, key: selectButtonKey, child: const Text('Button')));
return Material(child: ElevatedButton(onPressed: onPressed, key: selectButtonKey, child: null));
}
// State type is private, hence using dynamic.
dynamic getInspectorState() => inspectorKey.currentState;
@ -390,7 +390,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService {
final GlobalKey inspectorKey = GlobalKey();
Widget selectButtonBuilder(BuildContext context, VoidCallback onPressed) {
return Material(child: ElevatedButton(onPressed: onPressed, key: selectButtonKey, child: const Text('Button')));
return Material(child: ElevatedButton(onPressed: onPressed, key: selectButtonKey, child: null));
}
// State type is private, hence using dynamic.
dynamic getInspectorState() => inspectorKey.currentState;
@ -590,7 +590,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService {
InspectorSelectButtonBuilder selectButtonBuilder(Key key) {
return (BuildContext context, VoidCallback onPressed) {
return Material(child: ElevatedButton(onPressed: onPressed, key: key, child: const Text('Button')));
return Material(child: ElevatedButton(onPressed: onPressed, key: key, child: null));
};
}