-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Closed
Labels
found in release: 3.7Found to occur in 3.7Found to occur in 3.7frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
Steps to Reproduce
- Execute
flutter runon the code sample - Press on a text field to open the keyboard
- In the console, the value of paddingOf(context) was output 1 time, although this value should change during the keyboard animation.
- If the useMediaQueryOf in _HomeState is set to true (Restart the App after this) and you then click on a text field you will see the output several times in the console.
Expected results:
MediaQuery.paddingOf(context) should rebuild if the value changes.
Actual results:
MediaQuery.paddingOf(context) does not rebuild if the value changes.
Code sample
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Home(),
showPerformanceOverlay: true,
);
}
}
class Home extends StatelessWidget {
bool useMediaQueryOf = false;
@override
Widget build(BuildContext context) {
if (useMediaQueryOf) {
print(MediaQuery.of(context).padding);
} else {
print(MediaQuery.paddingOf(context));
}
return Scaffold(
appBar: AppBar(),
body: ListView.builder(
itemBuilder: (_, ndx) {
return TextField();
},
),
);
}
}Logs
[✓] Flutter (Channel master, 3.7.0-4.0.pre.62, on macOS 12.6 21G115 darwin-arm64, locale en-US)
• Flutter version 3.7.0-4.0.pre.62 on channel master at
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision be5c389e6c (23 hours ago), 2022-12-09 20:52:32 -0500
• Engine revision faae28965a
• Dart version 3.0.0 (build 3.0.0-3.0.dev)
• DevTools version 2.20.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
found in release: 3.7Found to occur in 3.7Found to occur in 3.7frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version