Skip to content

[web] onTextScaleFactorChanged not firing? #178271

Closed

Description

@ditman

(Internal issue: b/457959782)

Steps to reproduce

I'd expect this app to update the text scale factor as I change Font settings in Chrome:

  • Run the provided main.dart in Chrome
  • In a separate tab, go to "Customize fonts" in the Chrome settings, and change the "Font size" slider (by default it should be at 16), make it larger. The larger, the more apparent the issue.
    • (Observe that this immediately scale any non-flutter website)

Expected results

  • The demo app I posted, should update the displayed value of the text scale factor, and its font should adapt to the new size

Actual results

  • The text scale factor remains fixed at whatever was when the app first started.

(Note that reloading updates the value, so the value is computed correctly, it seems to just be the onTextScaleFactorChanged callback not firing)

Code sample

main.dart
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  double _textScaleFactor = PlatformDispatcher.instance.textScaleFactor;

  @override
  void initState() {
    super.initState();
    // This is not firing as browser settings are updated!
    PlatformDispatcher.instance.onTextScaleFactorChanged = (() {
      setState(() {
        _textScaleFactor = PlatformDispatcher.instance.textScaleFactor;
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: .center,
          children: [
            const Text('The current textScaleFactor is:'),
            Text(
              '$_textScaleFactor',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
          ],
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

n/a

Logs

Logs

n/a

Flutter Doctor output

Doctor output
$ flutter doctor -v
[!] Flutter (Channel master, 3.38.0-1.0.pre-475, on Debian GNU/Linux rodete 6.16.9-1rodete1-amd64, locale en_US.UTF-8) [792ms]
    • Flutter version 3.38.0-1.0.pre-475 on channel master at /work/flutter/flutter
    ! Upstream repository [email protected]:ditman/flutter-flutter.git is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to [email protected]:ditman/flutter-flutter.git to dismiss this error.
    • Framework revision f892a5a3cc (4 hours ago), 2025-11-10 14:35:58 -0500
    • Engine revision f892a5a3cc
    • Dart version 3.11.0 (build 3.11.0-114.0.dev)
    • DevTools version 2.52.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets,
      omit-legacy-version-file, enable-lldb-debugging
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

...

[✓] Connected device (2 available) [136ms]
    • Chrome (web)    • chrome • web-javascript • Google Chrome 142.0.7444.134

Activity

  1. added
    P2Important issues not at the top of the work list
    triaged-webTriaged by Web platform team
    engineflutter/engine related. See also e: labels.
    a: typographyText rendering, possibly libtxt
    on Nov 12, 2025
  2. self-assigned this
    on Nov 13, 2025
  3. moved this from To do to In progress in Nevercodeon Nov 13, 2025
  4. moved this from In progress to PR submitted in Nevercodeon Nov 20, 2025
  5. moved this from PR submitted to Done (PR merged) in Nevercodeon Dec 2, 2025
  6. added
    r: fixedIssue is closed as already fixed in a newer version
    on Dec 2, 2025
  7. github-actions commented on Dec 16, 2025

    @github-actions

    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 -v and a minimal reproduction of the issue.

  8. locked as resolved and limited conversation to collaborators on Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: typographyText rendering, possibly libtxtengineflutter/engine related. See also e: labels.r: fixedIssue is closed as already fixed in a newer versionteam-webOwned by Web platform teamtriaged-webTriaged by Web platform team

Type

No type

Projects

  • Status
    Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions