Remove deprecated Scaffold.resizeToAvoidBottomPadding (#72890)

This commit is contained in:
Kate Lovett 2021-01-19 18:14:05 -06:00 committed by GitHub
parent ca3728914f
commit 80f88a7981
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 35 additions and 29 deletions

View file

@ -11,6 +11,29 @@
version: 1
transforms:
# Changes made in https://github.com/flutter/flutter/pull/26259
- title: 'Rename to resizeToAvoidBottomInset'
date: 2020-12-23
element:
uris: [ 'material.dart' ]
field: 'resizeToAvoidBottomPadding'
inClass: 'Scaffold'
changes:
- kind: 'rename'
newName: 'resizeToAvoidBottomInset'
# Changes made in https://github.com/flutter/flutter/pull/26259
- title: 'Rename to resizeToAvoidBottomInset'
date: 2020-12-23
element:
uris: [ 'material.dart' ]
constructor: ''
inClass: 'Scaffold'
changes:
- kind: 'renameParameter'
oldName: 'resizeToAvoidBottomPadding'
newName: 'resizeToAvoidBottomInset'
# Change made in https://github.com/flutter/flutter/pull/20649
# TODO(Piinks): Add tests when `bulkApply:false` testing is supported, https://github.com/dart-lang/sdk/issues/44639
- title: 'Replace with CupertinoPopupSurface'

View file

@ -1449,7 +1449,6 @@ class Scaffold extends StatefulWidget {
this.bottomNavigationBar,
this.bottomSheet,
this.backgroundColor,
this.resizeToAvoidBottomPadding,
this.resizeToAvoidBottomInset,
this.primary = true,
this.drawerDragStartBehavior = DragStartBehavior.start,
@ -1726,18 +1725,6 @@ class Scaffold extends StatefulWidget {
/// * [showModalBottomSheet], which displays a modal bottom sheet.
final Widget? bottomSheet;
/// This flag is deprecated, please use [resizeToAvoidBottomInset]
/// instead.
///
/// Originally the name referred [MediaQueryData.padding]. Now it refers
/// [MediaQueryData.viewInsets], so using [resizeToAvoidBottomInset]
/// should be clearer to readers.
@Deprecated(
'Use resizeToAvoidBottomInset to specify if the body should resize when the keyboard appears. '
'This feature was deprecated after v1.1.9.'
)
final bool? resizeToAvoidBottomPadding;
/// If true the [body] and the scaffold's floating widgets should size
/// themselves to avoid the onscreen keyboard whose height is defined by the
/// ambient [MediaQuery]'s [MediaQueryData.viewInsets] `bottom` property.
@ -2730,9 +2717,8 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
late _ScaffoldGeometryNotifier _geometryNotifier;
// Backwards compatibility for deprecated resizeToAvoidBottomPadding property
bool get _resizeToAvoidBottomInset {
return widget.resizeToAvoidBottomInset ?? widget.resizeToAvoidBottomPadding ?? true;
return widget.resizeToAvoidBottomInset ?? true;
}
@override

View file

@ -385,7 +385,7 @@ void main() {
padding: EdgeInsets.all(50.0),
),
child: Scaffold(
resizeToAvoidBottomPadding: false,
resizeToAvoidBottomInset: false,
body: Builder(
builder: (BuildContext context) {
scaffoldContext = context;

View file

@ -103,19 +103,6 @@ void main() {
bodyBox = tester.renderObject(find.byKey(bodyKey));
expect(bodyBox.size, equals(const Size(800.0, 544.0)));
// Backwards compatibility: deprecated resizeToAvoidBottomPadding flag
await tester.pumpWidget(boilerplate(MediaQuery(
data: const MediaQueryData(viewInsets: EdgeInsets.only(bottom: 100.0)),
child: Scaffold(
appBar: AppBar(title: const Text('Title')),
body: Container(key: bodyKey),
resizeToAvoidBottomPadding: false,
),
)));
bodyBox = tester.renderObject(find.byKey(bodyKey));
expect(bodyBox.size, equals(const Size(800.0, 544.0)));
});
testWidgets('Scaffold large bottom padding test', (WidgetTester tester) async {

View file

@ -5,6 +5,11 @@
import 'package:flutter/material.dart';
void main() {
// Changes made in https://github.com/flutter/flutter/pull/26259
const Scaffold scaffold = Scaffold(resizeToAvoidBottomPadding: true);
final bool resize = scaffold.resizeToAvoidBottomPadding;
// Change made in https://github.com/flutter/flutter/pull/15303
showDialog(child: Text('Fix me.'));

View file

@ -5,6 +5,11 @@
import 'package:flutter/material.dart';
void main() {
// Changes made in https://github.com/flutter/flutter/pull/26259
const Scaffold scaffold = Scaffold(resizeToAvoidBottomInset: true);
final bool resize = scaffold.resizeToAvoidBottomInset;
// Change made in https://github.com/flutter/flutter/pull/15303
showDialog(builder: (context) => Text('Fix me.'));