Repository navigation
MediaQuery.paddingOf does not rebuild when value changes #116842
Copy link
Copy link
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
Activity
What's the expected output vs actual? I thought keyboard area was represented by viewInsets, not padding?
Ah you're right, I forgot to handle padding in updateShouldNotifyDependent.
Reacted by b3nni97Awesome, with the new MediaQuery API the performance has improved significantly, great work :)
- changed the title
[-][iOS] MediaQuery.paddingOf does not rebuild when value changes[/-][+]MediaQuery.paddingOf does not rebuild when value changes[/+]on Dec 11, 2022 - addedin triagePresently being triaged by the triage teamPresently being triaged by the triage team
on Dec 12, 2022 Issue is reproducible using the sample and steps provided above.
updated sample
import 'package:flutter/material.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return const MaterialApp( home: Home(), ); } } class Home extends StatelessWidget { final bool useMediaQueryOf = false; const Home({super.key}); @override Widget build(BuildContext context) { if (useMediaQueryOf) { print('using MediaQuery.of() ${MediaQuery.of(context).padding}'); } else { print('using MediaQuery.paddingOf() ${MediaQuery.paddingOf(context)}'); } return Scaffold( appBar: AppBar(), body: ListView.builder( itemBuilder: (_, ndx) { return const TextField(); }, ), ); } }
flutter doctor -v
[!] Flutter (Channel master, 3.7.0-5.0.pre.25, on macOS 13.0.1 22A400 darwin-arm64, locale en-GB) • Flutter version 3.7.0-5.0.pre.25 on channel master at /Users/nexus/dev/sdks/flutters ! Warning: `flutter` on your path resolves to /Users/nexus/dev/sdks/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/nexus/dev/sdks/flutters. Consider adding /Users/nexus/dev/sdks/flutters/bin to the front of your path. ! Warning: `dart` on your path resolves to /Users/nexus/dev/sdks/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/nexus/dev/sdks/flutters. Consider adding /Users/nexus/dev/sdks/flutters/bin to the front of your path. • Upstream repository https://github.com/flutter/flutter.git • Framework revision 92aebc953d (86 minutes ago), 2022-12-11 22:24:23 -0500 • Engine revision 922546c919 • Dart version 3.0.0 (build 3.0.0-12.0.dev) • DevTools version 2.20.0 • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades. [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0) • Android SDK at /Users/nexus/Library/Android/sdk • Platform android-33, build-tools 33.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 14.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14B47b • CocoaPods version 1.11.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2021.3) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866) [✓] VS Code (version 1.74.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.54.0 [✓] Connected device (3 available) • iPhone 14 Pro (mobile) • 4F72110C-F38B-4CF9-93C4-4D6042148D28 • ios • com.apple.CoreSimulator.SimRuntime.iOS-16-1 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 13.0.1 22A400 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 108.0.5359.98 [✓] HTTP Host Availability • All required HTTP hosts are available ! Doctor found issues in 1 category.- addedframeworkflutter/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 onfound in release: 3.7Found to occur in 3.7Found to occur in 3.7and removedin triagePresently being triaged by the triage teamPresently being triaged by the triage team
on Dec 12, 2022 - addedr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
on Dec 13, 2022 This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.- locked as resolved and limited conversation to collaborators
on Mar 5, 2023
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
Steps to Reproduce
flutter runon the code sampleExpected results:
MediaQuery.paddingOf(context) should rebuild if the value changes.
Actual results:
MediaQuery.paddingOf(context) does not rebuild if the value changes.
@moffatman
Code sample
Logs