stop keyboard animations rebuilding the hidden dashboard (#3805)
What changed, and why it matters
This is a performance improvement, not a security fix. The developers noticed that every time the on-screen keyboard opened or closed, several background dashboard widgets were needlessly redrawing, causing stuttering (janky frames). They replaced broad MediaQuery lookups with narrower ones that only watch the specific values actually needed (screen size and top safe-area padding), so keyboard animations no longer trigger rebuilds. The change improves app smoothness but does not address any vulnerability or protect user data.
No security action needed. Treat as a normal performance/UX improvement. If reviewing, verify that the narrower MediaQuery selectors still provide the intended layout values on devices with notches, foldables, and different orientations.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit replaces MediaQuery.of(context) calls with MediaQuery.sizeOf(context) and MediaQuery.viewPaddingOf(context) in eight UI files. In Flutter, MediaQuery.of(context) rebuilds the requesting widget whenever any MediaQuery property changes, including viewInsets (keyboard height). By switching to sizeOf/viewPaddingOf, widgets only rebuild when the specific property they consume changes. Since screen size and top view padding are unaffected by keyboard animations, the hidden dashboard stops rebuilding on every keyboard frame. The diff is a straightforward 1:1 API swap with no logic changes.
Changed components
lib/new-ui/pages/charts_page.dartlib/new-ui/pages/home_page.dartlib/new-ui/widgets/coins_page/action_row/coin_action_button.dartlib/new-ui/widgets/coins_page/action_row/coin_action_row.dartlib/new-ui/widgets/coins_page/cards/cards_view.dartlib/new-ui/widgets/coins_page/top_bar_widget/top_bar.dartlib/new-ui/widgets/coins_page/unconfirmed_balance_widget.dartlib/src/screens/wallet_list/wallet_list_page.dartInspect captured patch +12 / −12
### lib/new-ui/pages/charts_page.dart
@@ -81,7 +81,7 @@ class ChartsPage extends StatelessWidget implements PageOpenListener {
physics: const BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics()),
slivers: [
SliverPadding(
- padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top),
+ padding: EdgeInsets.only(top: MediaQuery.viewPaddingOf(context).top),
sliver: CupertinoSliverRefreshControl(
refreshTriggerPullDistance: 160,
refreshIndicatorExtent: 90,
### lib/new-ui/pages/home_page.dart
@@ -97,7 +97,7 @@ class _NewHomePageState extends State<NewHomePage> with RouteAware {
@override
Widget build(BuildContext context) => Container(
- height: MediaQuery.of(context).size.height,
+ height: MediaQuery.sizeOf(context).height,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
@@ -114,7 +114,7 @@ class _NewHomePageState extends State<NewHomePage> with RouteAware {
physics: const BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics()),
slivers: [
SliverPadding(
- padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top),
+ padding: EdgeInsets.only(top: MediaQuery.viewPaddingOf(context).top),
sliver: CupertinoSliverRefreshControl(
refreshTriggerPullDistance: 160,
refreshIndicatorExtent: 90,
@@ -254,7 +254,7 @@ class _NewHomePageState extends State<NewHomePage> with RouteAware {
)
]),
Container(
- height: (MediaQuery.of(context).padding.top),
+ height: (MediaQuery.viewPaddingOf(context).top),
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.bottomCenter,
### lib/new-ui/widgets/coins_page/action_row/coin_action_button.dart
@@ -22,7 +22,7 @@ class CoinActionButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final size = MediaQuery.of(context).size.width * sizeFactor;
+ final size = MediaQuery.sizeOf(context).width * sizeFactor;
final double effectiveSize = min(size, 80);
// The caption below the circle is the accessible name, so it is excluded
### lib/new-ui/widgets/coins_page/action_row/coin_action_row.dart
@@ -41,7 +41,7 @@ class CoinActionRow extends StatelessWidget {
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
- spacing: MediaQuery.of(context).size.width * 0.05,
+ spacing: MediaQuery.sizeOf(context).width * 0.05,
children: [
CoinActionButton(
key: ValueKey("home_page_send_button_key"),
### lib/new-ui/widgets/coins_page/cards/cards_view.dart
@@ -265,7 +265,7 @@ class _CardsViewState extends State<CardsView> {
}
}
- double get effectiveCardWidth => min(MediaQuery.of(context).size.width * 0.878,
+ double get effectiveCardWidth => min(MediaQuery.sizeOf(context).width * 0.878,
responsiveLayoutUtil.shouldRenderMobileUI ? 768 : 512);
double _getBoxHeight(int numCards, double overlapAmount) {
@@ -290,7 +290,7 @@ class _CardsViewState extends State<CardsView> {
@override
Widget build(BuildContext context) => Observer(builder: (context) {
- final parentWidth = MediaQuery.of(context).size.width;
+ final parentWidth = MediaQuery.sizeOf(context).width;
final children = <Widget>[];
final stack = _hideAccountInfo
### lib/new-ui/widgets/coins_page/top_bar_widget/top_bar.dart
@@ -180,7 +180,7 @@ class _TopBarState extends State<TopBar> {
//FIXME remove after this gets fixed flutter-side
double _additionalTopPadding(BuildContext context) {
- if (Platform.isIOS && MediaQuery.of(context).viewPadding.top < 12) {
+ if (Platform.isIOS && MediaQuery.viewPaddingOf(context).top < 12) {
return 24;
}
### lib/new-ui/widgets/coins_page/unconfirmed_balance_widget.dart
@@ -89,7 +89,7 @@ class UnconfirmedBalanceWidget extends StatelessWidget {
}
return Container(
- width: MediaQuery.of(context).size.width * 0.87,
+ width: MediaQuery.sizeOf(context).width * 0.87,
height: 48,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surfaceContainer,
@@ -180,7 +180,7 @@ class ZcashManualShieldingRow extends StatelessWidget {
@override
Widget build(BuildContext context) => Container(
- width: MediaQuery.of(context).size.width * 0.87,
+ width: MediaQuery.sizeOf(context).width * 0.87,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surfaceContainer,
borderRadius: BorderRadius.circular(16),
### lib/src/screens/wallet_list/wallet_list_page.dart
@@ -363,7 +363,7 @@ class WalletListBodyState extends State<WalletListBody> {
),
Container(
height: 240,
- width: MediaQuery.of(context).size.width,
+ width: MediaQuery.sizeOf(context).width,
margin: EdgeInsets.only(bottom: 24),
padding: EdgeInsets.only(left: 16, right: 16),
child: Column(Why this scored 21/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.