)]}'
{
  "commit": "228df7e82104877a79abdddbc066c05d57b6045c",
  "tree": "9b4755e3bcb2efda46d680f890f13a9b8542241c",
  "parents": [
    "29be2798df87211d6752ea49a4da7520285f31e9"
  ],
  "author": {
    "name": "Renzo Olivares",
    "email": "rmolivares@renzo-olivares.dev",
    "time": "Tue Jul 07 14:43:15 2026 -0700"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Tue Jul 07 21:43:15 2026 +0000"
  },
  "message": "Fix TextSelectionOverlay crash when layout is degenerate (#188672)\n\nFixes #187644 \n\n# Foldable Selection Handle Drag Crash Reproductions\n\nThe example below reproduce the `Unsupported operation: Infinity or NaN\ntoInt` crash during selection handle drags under transient degenerate\nlayouts (like folding transitions).\n\n---\n\n## Example: Multi-Touch Simulator (For any phone, foldable or\nnon-foldable)\n\nThis example uses a **Slider** to manually scale the height of the\n`TextField` down to `1e-310` mid-drag.\n\n### Code (`main.dart`)\n```dart\nimport \u0027package:flutter/material.dart\u0027;\n\nvoid main() \u003d\u003e runApp(const MyApp());\n\nclass MyApp extends StatelessWidget {\n  const MyApp({super.key});\n\n  @override\n  Widget build(BuildContext context) {\n    return MaterialApp(\n      home: Scaffold(\n        appBar: AppBar(title: const Text(\u0027Degenerate Transform Simulator\u0027)),\n        body: const ReproWidget(),\n      ),\n    );\n  }\n}\n\nclass ReproWidget extends StatefulWidget {\n  const ReproWidget({super.key});\n\n  @override\n  State\u003cReproWidget\u003e createState() \u003d\u003e _ReproWidgetState();\n}\n\nclass _ReproWidgetState extends State\u003cReproWidget\u003e {\n  double scaleY \u003d 1.0;\n  final TextEditingController _controller \u003d TextEditingController(\n    text:\n        \u0027Select a word here, hold and drag the handle, then slide the slider to 0.\u0027,\n  );\n\n  @override\n  void dispose() {\n    _controller.dispose();\n    super.dispose();\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    return Padding(\n      padding: const EdgeInsets.all(16.0),\n      child: Column(\n        children: \u003cWidget\u003e[\n          const Text(\u0027Collapse Height Scale:\u0027),\n          Slider(\n            value: scaleY \u003d\u003d 1e-310 ? 0.0 : scaleY,\n            min: 0.0,\n            max: 1.0,\n            onChanged: (double value) {\n              setState(() {\n                // Collapse the height axis to a subnormal value close to 0 (1e-310)\n                scaleY \u003d value \u003c 0.05 ? 1e-310 : value;\n              });\n            },\n            onChangeEnd: (double value) {\n              setState(() {\n                scaleY \u003d scaleY \u003d\u003d 1e-310 ? 0.0 : value;\n              });\n            },\n          ),\n          Text(\n            \u0027Current Scale Y: ${scaleY \u003d\u003d 1e-310 ? \"1e-310 (degenerate)\" : scaleY.toStringAsFixed(3)}\u0027,\n          ),\n          const SizedBox(height: 100),\n          Center(\n            child: Transform(\n              transform: Matrix4.diagonal3Values(1.0, scaleY, 1.0),\n              alignment: Alignment.center,\n              child: SizedBox(\n                width: 300,\n                height: 120,\n                child: TextField(\n                  controller: _controller,\n                  maxLines: null,\n                  decoration: const InputDecoration(\n                    border: OutlineInputBorder(),\n                    labelText: \u0027Text Input\u0027,\n                  ),\n                ),\n              ),\n            ),\n          ),\n        ],\n      ),\n    );\n  }\n}\n```\n\n### Steps to Reproduce:\n1. Run the app on a device using an **unpatched** Flutter framework.\n2. **Double-tap** a word in the text field to show the selection\nhandles.\n3. **Press and hold** one of the selection handles and start dragging\nit.\n4. **While keeping your finger down dragging the handle**, use your\nother hand to slide the slider all the way to the left (setting `scaleY`\nto `1e-310`).\n5. Move your dragging finger slightly.\n6. The app will immediately crash.\n\n---\n\n## Pre-launch Checklist\n\n- [x] I read the [Contributor Guide] and followed the process outlined\nthere for submitting PRs.\n- [x] I read the [AI contribution guidelines] and understand my\nresponsibilities, or I am not using AI tools.\n- [x] I read the [Tree Hygiene] wiki page, which explains my\nresponsibilities.\n- [x] I read and followed the [Flutter Style Guide], including [Features\nwe expect every widget to implement].\n- [x] I signed the [CLA].\n- [x] I listed at least one issue that this PR fixes in the description\nabove.\n- [x] I updated/added relevant documentation (doc comments with `///`).\n- [x] I added new tests to check the change I am making, or this PR is\n[test-exempt].\n- [x] I followed the [breaking change policy] and added [Data Driven\nFixes] where supported.\n- [x] All existing and new tests are passing.\n\n---------\n\nCo-authored-by: Renzo Olivares \u003croliv@google.com\u003e",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "037d8fc2cf90aae98a744c6c9badf7ee1dc3bc7a",
      "old_mode": 33188,
      "old_path": "packages/flutter/lib/src/painting/text_painter.dart",
      "new_id": "71e5d422ba98c9e1086a61a7d9d8c606dd5287e3",
      "new_mode": 33188,
      "new_path": "packages/flutter/lib/src/painting/text_painter.dart"
    },
    {
      "type": "modify",
      "old_id": "86f639bceefb0d0a6b35a1e54fa4a6d7fb6696d8",
      "old_mode": 33188,
      "old_path": "packages/flutter/lib/src/widgets/text_selection.dart",
      "new_id": "05f696b37ce29f61ec6cf2c429702f1b7aea3d17",
      "new_mode": 33188,
      "new_path": "packages/flutter/lib/src/widgets/text_selection.dart"
    },
    {
      "type": "modify",
      "old_id": "73e4134254970f0f4173e7c66de7574540f63406",
      "old_mode": 33188,
      "old_path": "packages/flutter/test/painting/text_painter_test.dart",
      "new_id": "7e135b46895cd4ceb0a52d2d110e77386e16d0b5",
      "new_mode": 33188,
      "new_path": "packages/flutter/test/painting/text_painter_test.dart"
    },
    {
      "type": "modify",
      "old_id": "3c8d968fa42204ba2a66cb0209e7ff63241f7b64",
      "old_mode": 33188,
      "old_path": "packages/flutter/test/widgets/editable_text_tester.dart",
      "new_id": "c631f4b240d41849dc0c63a0e409b486d55b9626",
      "new_mode": 33188,
      "new_path": "packages/flutter/test/widgets/editable_text_tester.dart"
    },
    {
      "type": "modify",
      "old_id": "f18b1cc986030764882394c21c5b38d150d4f727",
      "old_mode": 33188,
      "old_path": "packages/flutter/test/widgets/text_selection_test.dart",
      "new_id": "c4203282b26bb0b21e5e31e619cb4d73588f9e0d",
      "new_mode": 33188,
      "new_path": "packages/flutter/test/widgets/text_selection_test.dart"
    }
  ]
}
