Repository: flutter
Issue: [Linux Desktop] Running app with chinese system language throws Exception:errorOffset argument contained a NaN value.
Labels: framework,platform-linux,a: desktop,a: error message,has reproducible steps,P2,found in release: 2.5,found in release: 2.6,team-linux,triaged-linux

<!-- Thank you for using Flutter!

     If you are looking for support, please check out our documentation
     or consider asking a question on Stack Overflow:
      * https://flutter.dev/
      * https://api.flutter.dev/
      * https://stackoverflow.com/questions/tagged/flutter?sort=frequent

     If you have found a bug or if our documentation doesn't have an answer
     to what you're looking for, then fill out the template below. Please read
     our guide to filing a bug first: https://flutter.dev/docs/resources/bug-reports
-->

## Steps to Reproduce

<!-- Please include full steps to reproduce so that we can reproduce the problem. -->

1. Execute `flutter run` on the code sample <!-- (see "Code sample" section below) -->
2. Press 1 to select Linux Platform <!-- describe steps to demonstrate bug -->
3. Show up App window but got a exception <!-- for example "Tap on X and see a crash" -->

**Expected results:** <!-- what did you want to see? -->
NO EXCEPTIONS log show up on console

**Actual results:** <!-- what did you see? -->
EXCEPTIONS!

<details>
<summary>Code sample</summary>

<!--
      Please create a minimal reproducible sample that shows the problem
      and attach it below between the lines with the backticks.

      To create it you can use `flutter create bug` command and update the `main.dart` file.

      Alternatively, you can use https://dartpad.dev/
      which is capable of creating and running small Flutter apps.

      Without this we will unlikely be able to progress on the issue, and because of that
      we regretfully will have to close it.
-->

```dart
import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
      theme: ThemeData(
          elevatedButtonTheme: ElevatedButtonThemeData(
        style: ElevatedButton.styleFrom(
          primary: Colors.blue,
        ),
      )),
      home: Scaffold(
        body: Center(child: Text('Test')), 
      )));
}

```

</details>

<details>
  <summary>Logs</summary>

<!--
      Run your application with `flutter run --verbose` and attach all the
      log output below between the lines with the backticks. If there is an
      exception, please see if the error message includes enough information
      to explain how to solve the issue.
-->

```
An Observatory debugger and profiler on Linux is available at: http://127.0.0.1:39657/yyPXTy8X_4o=/

══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
The following assertion was thrown during paint():
Offset argument contained a NaN value.
'dart:ui/painting.dart':
Failed assertion: line 52 pos 10: '<optimized out>'

Either the assertion indicates an error in the framework itself, or we should provide substantially
more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=2_bug.md

The relevant error-causing widget was:
  MaterialApp MaterialApp:file:///home/zidi/Documents/ProjectPiao/PiaoPiao/piao_app/lib/main.dart:6:10

When the exception was thrown, this was the stack:
#2      _offsetIsValid (dart:ui/painting.dart:52:10)
#3      Canvas.drawParagraph (dart:ui/painting.dart:4466:12)
#4      TextPainter.paint (package:flutter/src/painting/text_painter.dart:642:12)
#5      BannerPainter.paint (package:flutter/src/widgets/banner.dart:147:18)
#6      RenderCustomPaint._paintWithPainter (package:flutter/src/rendering/custom_paint.dart:563:13)
#7      RenderCustomPaint.paint (package:flutter/src/rendering/custom_paint.dart:610:7)
#8      RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2409:7)
#9      PaintingContext.paintChild (package:flutter/src/rendering/object.dart:189:13)
#10     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#11     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2409:7)
#12     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:189:13)
#13     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#14     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2409:7)
#15     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:189:13)
#16     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#17     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2409:7)
#18     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:189:13)
#19     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#20     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2409:7)
#21     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:189:13)
#22     RenderView.paint (package:flutter/src/rendering/view.dart:209:15)
#23     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2409:7)
#24     PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:141:11)
#25     PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:100:5)
#26     PipelineOwner.flushPaint (package:flutter/src/rendering/object.dart:979:29)
#27     RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:455:19)
#28     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:883:13)
#29     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:319:5)
#30     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1143:15)
#31     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1080:9)
#32     SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:863:7)
(elided 13 frames from class _AssertionError, class _RawReceivePortImpl, class _Timer, dart:async, and dart:async-patch)

The following RenderObject was being processed when the exception was fired: RenderCustomPaint#2a752:
  needs compositing
  creator: CustomPaint ← Banner ← CheckedModeBanner ← Title ← Directionality ←
    _LocalizationsScope-[GlobalKey#9d572] ← Semantics ← Localizations ← MediaQuery ←
    _MediaQueryFromWindow ← _FocusMarker ← Focus ← ⋯
  parentData: <none> (can use size)
  constraints: BoxConstraints(w=1280.0, h=720.0)
  size: Size(1280.0, 720.0)
This RenderObject had the following descendants (showing up to depth 5):
    child: RenderPointerListener#93936
      child: RenderAbsorbPointer#1027e
        child: RenderSemanticsAnnotations#327e0
          child: _RenderTheatre#cca13
            onstage 1: RenderIgnorePointer#af29b
            onstage 2: RenderSemanticsAnnotations#6cc21
            no offstage children
════════════════════════════════════════════════════════════════════════════════════════════════════
Activating Dart DevTools...                                         3.3s
The Flutter DevTools debugger and profiler on Linux is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:39657/yyPXTy8X_4o=/
Lost connection to device.
```

<!--
     Run `flutter analyze` and attach any output of that command below.
     If there are any analysis errors, try resolving them before filing this issue.
-->

```
Analyzing piao_app...                                                   

   info • Prefer const with constant constructors • lib/main.dart:14:13 • prefer_const_constructors
   info • Prefer const with constant constructors • lib/main.dart:15:15 • prefer_const_constructors
   info • Prefer const with constant constructors • lib/main.dart:15:29 • prefer_const_constructors
```

```
Machine Configurations
Kernel: Linux MYPCNAME 5.11.0-38-generic #42~20.04.1-Ubuntu SMP Tue Sep 28 20:41:07 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
OS: Ubuntu 20.04.3 LTS
Type: 64-bits
Memory: 32GB
CPU: AMD 5900x
GPU: NVIDIA GTX 1080 Ti
GPU Driver: NVIDIA driver metapackage nvidia-driver-460
```

<!-- Finally, paste the output of running `flutter doctor -v` here. -->

```
flutter doctor -v
[✓] Flutter (Channel stable, 2.5.3, on Ubuntu 20.04.3 LTS 5.11.0-38-generic, locale zh_CN.UTF-8)
    • Flutter version 2.5.3 at /home/zidi/Documents/SDK/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 18116933e7 (3 周前), 2021-10-15 10:46:35 -0700
    • Engine revision d3ea636dc5
    • Dart version 2.14.4

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.


[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 10.0.0-4ubuntu1
    • cmake version 3.16.3
    • ninja version 1.10.0
    • pkg-config version 0.29.1

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).

[✓] VS Code (version 1.61.1)
    • VS Code at /usr/share/code
    • Flutter extension version 3.28.0

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Ubuntu 20.04.3 LTS 5.11.0-38-generic
    • Chrome (web)    • chrome • web-javascript • Google Chrome 94.0.4606.81

! Doctor found issues in 2 categories.
```

</details>


<!--
      Consider also attaching screenshots and/or videos to better
      illustrate the issue.

      You can upload them directly on GitHub.
      Beware that video file size is limited to 10MB.
-->