1173 Commits

Author SHA1 Message Date
Justin McCandless
bef11d207f
Some cleanup of cross library test imports (#177029)
There is a lot of cross-library importing in the framework unit tests
that I'd like to clean up, see the design doc for more:
https://docs.google.com/document/d/1UHxALQqCbmgjnM1RNV9xE2pK3IGyx-UktGX1D7hYCjs/edit?tab=t.0

This PR cleans up a few obvious instances and adds TODOs for others. I
created this while doing an investigation for the design doc linked
above. I hope that we'll be able to follow up with fixes for all of the
problematic tests (tracked in the issue below).

Part of https://github.com/flutter/flutter/issues/177028
2026-01-02 19:20:06 +00:00
Kishan Rathore
e5be1a3904
fix: exclude semantics for disabled dates (#178981)
## Changes
* Exclude semantics for disabled dates directly in CupertinoDatePicker

fixes: #178713

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
2025-12-24 07:53:19 +00:00
Ahmed Mohamed Sameh
162ced574f
Make sure that a CupertinoTextSelectionToolbarButton doesn't crash in… (#179995)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the
CupertinoTextSelectionToolbarButton widget.
2025-12-18 22:02:22 +00:00
Ahmed Mohamed Sameh
44a143ed0b
Make sure that a CupertinoTextFormFieldRow doesn't crash in 0x0 envir… (#179932)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the
CupertinoTextFormFieldRow widget.
2025-12-17 06:29:13 +00:00
Ahmed Mohamed Sameh
7d1e466d0e
Make sure that a CupertinoTabView doesn't crash in 0x0 environment (#179845)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the CupertinoTabView
widget.
2025-12-17 06:24:57 +00:00
Ahmed Mohamed Sameh
17779252c5
Make sure that a CupertinoTextField doesn't crash in 0x0 environment (#179865)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the
CupertinoTextField widget.
2025-12-17 06:24:57 +00:00
Ahmed Mohamed Sameh
b47a810ab0
Make sure that a CupertinoSwitch doesn't crash in 0x0 environment (#179748)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the CupertinoSwitch
widget.
2025-12-17 06:22:57 +00:00
Kishan Rathore
698615f942
Feat: Add top gap for cupertino sheet (#171348)
Feat: Add top gap for cupertino sheet
fixes: #169465 

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
2025-12-16 19:38:56 +00:00
Ahmed Mohamed Sameh
b0801721b3
Make sure that a CupertinoDialogAction doesn't crash in 0x0 environment (#178956)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the
CupertinoDialogAction widget.

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
2025-12-10 00:41:29 +00:00
Ahmed Mohamed Sameh
5266539cfb
Make sure that a CupertinoListSection doesn't crash in 0x0 environment (#179068)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the
CupertinoListSection widget.

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
2025-12-10 00:26:59 +00:00
Ahmed Mohamed Sameh
4e113f9420
Make sure that a CupertinoFormSection doesn't crash in 0x0 environment (#179001)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the
CupertinoFormSection widget.

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
2025-12-10 00:25:49 +00:00
Ahmed Mohamed Sameh
410a0dda2b
Make sure that a CupertinoMagnifier doesn't crash in 0x0 environment (#179206)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the
CupertinoMagnifier widget.

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
2025-12-10 00:24:35 +00:00
Ahmed Mohamed Sameh
41ff0598fe
Make sure that a CupertinoSegmentedControl doesn't crash in 0x0 envir… (#179544)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the
CupertinoSegmentedControl widget.
2025-12-10 00:22:36 +00:00
Ahmed Mohamed Sameh
4c24578e2b
Make sure that a CupertinoSlider doesn't crash in 0x0 environment (#179566)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the CupertinoSlider
widget.
2025-12-10 00:22:36 +00:00
Ahmed Mohamed Sameh
6e611e04b7
Make sure that a CupertinoPageScaffold doesn't crash in 0x0 environment (#179245)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the
CupertinoPageScaffold widget.

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
2025-12-10 00:22:36 +00:00
Ahmed Mohamed Sameh
981a39f551
Make sure that a CupertinoActionSheetAction doesn't crash in 0x0 envi… (#178955)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the
CupertinoActionSheetAction widget.

---------

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
2025-12-09 17:32:06 +00:00
Ahmed Mohamed Sameh
af7b52181e
Make sure that a CupertinoPickerDefaultSelectionOverlay doesn't crash… (#179351)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the
CupertinoPickerDefaultSelectionOverlay widget.

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
2025-12-09 17:30:04 +00:00
Ahmed Mohamed Sameh
6c7de50493
Make sure that a CupertinoExpansionTile doesn't crash in 0x0 environment (#178978)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the
CupertinoExpansionTile widget.

---------

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
2025-12-09 17:28:05 +00:00
Ahmed Mohamed Sameh
61033df43a
Make sure that a CupertinoListTile doesn't crash in 0x0 environment (#179109)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the CupertinoListTile
widget.

---------

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
2025-12-08 18:23:05 +00:00
Ahmed Mohamed Sameh
07e1cdd9ff
Make sure that a CupertinoFocusHalo doesn't crash in 0x0 environment (#178773)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the
CupertinoFocusHalo widget.

---------

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
2025-12-08 18:16:21 +00:00
Ahmed Mohamed Sameh
5be16afd7f
Make sure that a CupertinoPopupSurface doesn't crash in 0x0 environment (#178929)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the
CupertinoPopupSurface widget.

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
2025-12-08 18:16:20 +00:00
Ahmed Mohamed Sameh
5acb8b9d83
Make sure that a CupertinoFormRow doesn't crash in 0x0 environment (#178979)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the CupertinoFormRow
widget.

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
2025-12-05 23:54:49 +00:00
Ahmed Mohamed Sameh
3a2b6821ee
Make sure that a CupertinoContextMenuAction doesn't crash in 0x0 envi… (#178721)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the
CupertinoContextMenuAction widget.

Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
2025-12-05 23:53:02 +00:00
Ahmed Mohamed Sameh
0951f1e181
Make sure that a CupertinoRadio doesn't crash in 0x0 environment (#179378)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the CupertinoRadio
widget.

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
2025-12-05 23:53:01 +00:00
Ahmed Mohamed Sameh
a9d7ab92b6
Make sure that a CupertinoSearchTextField doesn't crash in 0x0 enviro… (#179487)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the
CupertinoSearchTextField widget.

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
2025-12-05 23:51:02 +00:00
Ahmed Mohamed Sameh
fe9a609404
Make sure that a CupertinoPicker doesn't crash in 0x0 environment (#179258)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the CupertinoPicker
widget.

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
2025-12-05 23:47:49 +00:00
Ahmed Mohamed Sameh
2300260b28
Make sure that a CupertinoAlertDialog doesn't crash in 0x0 environment (#178858)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the
CupertinoAlertDialog widget.

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
2025-12-05 23:46:25 +00:00
Ahmed Mohamed Sameh
c4daa1f597
Make sure that a CupertinoListTileChevron doesn't crash in 0x0 enviro… (#179165)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the
CupertinoListTileChevron widget.

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
2025-12-05 23:46:25 +00:00
Ahmed Mohamed Sameh
a8577f996b
Make sure that CupertinoNavigationBar doesn't crash in 0x0 environment (#179235)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the
CupertinoNavigationBar widget.

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
2025-12-05 23:46:25 +00:00
Ahmed Mohamed Sameh
362361484d
Make sure that a CupertinoCheckbox doesn't crash in 0x0 environment (#178630)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the CupertinoCheckbox
widget.

Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
2025-12-05 23:46:25 +00:00
Ahmed Mohamed Sameh
393c51fb46
Make sure that a CupertinoApp doesn't crash in 0x0 environment (#178610)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the CupertinoApp
widget.

Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
2025-12-05 23:45:03 +00:00
Ahmed Mohamed Sameh
fed50b185e
Make sure that a CupertinoButton doesn't crash in 0x0 environment (#178629)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the CupertinoButton
widget.

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
2025-12-05 23:45:03 +00:00
Ahmed Mohamed Sameh
b9424acf3c
Make sure that a CupertinoTimerPicker doesn't crash in 0x0 environment (#178857)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the
CupertinoTimerPicker widget.

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
2025-12-05 23:45:03 +00:00
Ahmed Mohamed Sameh
2a88fa0f23
Make sure that a CupertinoScrollbar doesn't crash in 0x0 environment (#179442)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the
CupertinoScrollbar widget.

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
2025-12-05 23:45:03 +00:00
Renzo Olivares
102cde6efa
Fix crash when text editing value changes between scrolls (#179163)
This change fixes a crash in `EditableText` that occurs when the text
editing value changes between two scrolls, when the second scroll ends
`_dataWhenToolbarShowScheduled` will be invalidated. If the second
scroll ends before the post frame callback scheduled by the first scroll
has a chance to execute, there will be a crash because
`_dataWhenToolbarShowScheduled` is being accessed while null.

This change also invalidates a scheduled toolbar if the text editing
value has changed before the post-frame callback has a chance to run.

Fixes #179164

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

---------

Co-authored-by: Renzo Olivares <roliv@google.com>
2025-12-02 22:53:24 +00:00
Ahmed Mohamed Sameh
7ef942bad7
Make sure that a CupertinoActivityIndicator doesn't crash in 0x0 envi… (#178565)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the
CupertinoActivityIndicator widget.
2025-11-26 22:56:56 +00:00
Kate Lovett
9d96df2364
Modernize framework lints (#179089)
WIP

Commits separated as follows:
- Update lints in analysis_options files
- Run `dart fix --apply`
- Clean up leftover analysis issues 
- Run `dart format .` in the right places.

Local analysis and testing passes. Checking CI now.

Part of https://github.com/flutter/flutter/issues/178827
- Adoption of flutter_lints in examples/api coming in a separate change
(cc @loic-sharma)

## Pre-launch Checklist

- [ ] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [ ] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [ ] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [ ] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-11-26 01:10:39 +00:00
Ahmed Mohamed Sameh
3ff025970a
Make sure that a CupertinoLinearActivityIndicator doesn't crash in 0x… (#178566)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the
CupertinoLinearActivityIndicator widget.

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
2025-11-22 01:06:40 +00:00
Ahmed Mohamed Sameh
946edbc5f9
Make sure that a CupertinoTabBar doesn't crash in 0x0 environment (#178613)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the CupertinoTabBar
widget.

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
2025-11-22 01:05:56 +00:00
Ahmed Mohamed Sameh
c213a54279
Make sure that a CupertinoContextMenu doesn't crash in 0x0 environment (#178722)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the
CupertinoContextMenu widget.
2025-11-22 01:02:57 +00:00
Ahmed Mohamed Sameh
63ef482845
Make sure that a CupertinoSpellCheckSuggestionsToolbar doesn't crash … (#177978)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the
CupertinoSpellCheckSuggestionsToolbar widget.

Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
2025-11-21 00:00:42 +00:00
Onnimanni Hannonen
1d268f4bf6
Add focus support for CupertinoActionSheetAction #166398 (#167119)
<!--
Thanks for filing a pull request!
Reviewers are typically assigned within a week of filing a request.
To learn more about code review, see our documentation on Tree Hygiene:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
-->

### This PR fixes #166398
- Adds focus support for `CupertinoActionSheetAction`. This makes it
work with keyboard shortcuts
- Creates new widget, `CupertinoTraversalGroup` that applies a Cupertino
style focus border around its child when any of its descendant has focus
- Employs `CupertinoTraversalGroup` in `CupertinoActionSheet`

How the new implementation looks and behaves:

https://github.com/user-attachments/assets/ea6789f1-921d-4598-bcca-489dc063ff73

How the native counterpart looks and behaves:

https://github.com/user-attachments/assets/4c6ae2a0-7205-4de2-b981-ec7f4839da6e

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

---------

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
2025-11-12 04:35:43 +00:00
Renzo Olivares
36b1877073
Listen to text spacing overrides on the web (#178081)
Original PR/Discussion: https://github.com/flutter/flutter/pull/172915

# Framework:
* `EditableText`/`SelectableText`, applies
`lineHeightScaleFactorOverride`, `wordSpacingOverride`, and
`letterSpacingOverride` to it's `TextStyle` similarly to how we already
do for bold platform overrides. Note `SelectableText` is built on
`EditableText` so it also applies these overrides.
* `Text`, applies `lineHeightScaleFactorOverride`,
`wordSpacingOverride`, and `letterSpacingOverride` to it's `TextStyle`
similarly to how we already do for bold platform overrides.
* Exposes line height override through
`MediaQueryData.lineHeightScaleFactorOverride` and
`maybeLineHeightScaleFactorOverrideOf(context)`.
* Exposes letter spacing override through
`MediaQueryData.letterSpacingOverride` and
`maybeLetterSpacingOverrideOf(context)`.
* Exposes word spacing override through
`MediaQueryData.wordSpacingOverride` and
`maybeWordSpacingOverrideOf(context)`.
* Exposes paragraph spacing override through
`MediaQueryData.paragraphSpacingOverride` and
`maybeParagraphSpacingOverrideOf(context)`.
* `MediaQuery.applyTextStyleOverrides()` \
`MediaQueryData.applyTextStyleOverrides()` to be able to reset/override
the text spacing settings on `MediaQueryData`.

# Engine:
* Introduces new members on `PlatformDispatcher` API that hold the text
spacing properties that are overridden on the web.
* We provide the `lineHeightScaleFactorOverride`,
`letterSpacingOverride`, `wordSpacingOverride`, and
`paragraphSpacingOverride` on the web by attaching a `ResizeObserver` to
an off-screen hidden element, when its size changes we capture its text
spacing CSS properties, and notify the framework through
`onMetricsChanged`.

Fixes #142712


https://github.com/user-attachments/assets/aaaa3e74-c232-4956-acd2-ae1a4487e415

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

---------

Co-authored-by: Renzo Olivares <roliv@google.com>
2025-11-11 18:44:19 +00:00
Kostia Sokolovskyi
7947aef699
Update CupertinoSwitch thumb to snap to the sides on drag. (#176825)
Fixes https://github.com/flutter/flutter/issues/166485

## Description

- Updates `CupertinoSwitch` thumb to snap to the sides on drag
- Updates `CupertinoSwitch` to emit vibration not when drag starts, but
when the dragged thumb crosses the middle point

| BEFORE | AFTER |
| - | - |
| <video alt="before"
src="https://github.com/user-attachments/assets/467f0a3c-ab6a-40c0-a0fe-6b1ff835bbb0"
/> | <video alt="after"
src="https://github.com/user-attachments/assets/9bc21bdc-e8a3-4626-8155-1d90614a72fa"
/> |

## Pre-launch Checklist

- [X] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [X] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [X] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [X] I signed the [CLA].
- [X] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [X] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [X] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [X] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

---------

Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
2025-11-10 20:57:45 +00:00
Victor Sanni
df3867ed94
Correct editable text and placeholder position in baseline aligned stack (#177342)
This PR makes CupertinoTextField's placeholder and editable text
position respect `CupertinoTextField.textAlignVertical`.

<details open>
<summary>Image comparison</summary>

| | Before | After | 
| --- | --- | --- |
| top | <img width="436" height="327" alt="top b4"
src="https://github.com/user-attachments/assets/39606c72-fb1f-4619-bfb2-ccaeaf502324"
/> | <img width="436" height="327" alt="top"
src="https://github.com/user-attachments/assets/faea26fc-c934-4660-bbee-e62effa44599"
/> |
| center | <img width="436" height="327" alt="top b4"
src="https://github.com/user-attachments/assets/39606c72-fb1f-4619-bfb2-ccaeaf502324"
/> | <img width="436" height="327" alt="center"
src="https://github.com/user-attachments/assets/2ee7004a-6f70-4af2-b33b-76293c8deac1"
/> |
| bottom | <img width="436" height="327" alt="top b4"
src="https://github.com/user-attachments/assets/39606c72-fb1f-4619-bfb2-ccaeaf502324"
/> | <img width="436" height="327" alt="bottom"
src="https://github.com/user-attachments/assets/69ba89fb-9f1c-456e-9889-216eb31d66b9"
/> |

</details>

<details>
<summary>Sample code</summary>

```dart
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

void main() => runApp(const TextFieldApp());

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(home: HomePage());
  }
}

class HomePage extends StatefulWidget {
  const HomePage({super.key});

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  TextEditingController commentController = TextEditingController();
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.grey,
      body: SafeArea(
        child: Center(
          child: Padding(
            padding: const EdgeInsets.all(8.0),
            child: CupertinoTextField(
              style: const TextStyle(fontSize: 40),
              placeholderStyle: const TextStyle(
                fontSize: 80,
                color: CupertinoColors.inactiveGray,
              ),
              placeholder: 'Enter text',
              textAlignVertical: TextAlignVertical.bottom,
            ),
          ),
        ),
      ),
    );
  }
}

```

</details>

Fixes [CupertinoTextField text not vertically centered when fontSize
differs between style and
placeholderStyle.](https://github.com/flutter/flutter/issues/176817)
2025-10-27 22:53:57 +00:00
Jason Simmons
e090117bde
Set the font weight variation axis based on the text style's FontWeight (#175771)
This makes it possible for applications to set a FontWeight and get the
expected result for both variable fonts and fonts that provide separate
assets for each weight.

See https://github.com/flutter/flutter/issues/148026
2025-10-27 20:10:17 +00:00
Ahmed Mohamed Sameh
3d3e2ebc51
Make sure that a CupertinoDesktopTextSelectionToolbar doesn't crash i… (#173964)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the
CupertinoDesktopTextSelectionToolbar UI control.

---------

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
2025-10-20 22:45:08 +00:00
Kishan Rathore
ee991b3a78
feat: apply radioGroup role to segmented control widgets (#176157)
feat: apply radioGroup role to segmented control widgets
fixes: #164589

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
2025-10-11 01:11:05 +00:00
Huy
c5228651d0
Fix RadioButton is not vocalized as unselected by VoiceOver (#175926)
### Issue
- Fix https://github.com/flutter/flutter/issues/170422

### Description

This PR proposes a fix by adding a hint to Semantics here:


b220f5a2ab/packages/flutter/lib/src/widgets/raw_radio.dart (L217-L222)

The hint is only available on iOS &macOS platforms with a localized
string for `unselected` state to prevent regression on Android, which
works as expected currently and this seems to be the only solution as
investigated below ⬇️

<details open>
<summary>Demo the fix</summary>


https://github.com/user-attachments/assets/56c1c6c9-5178-45be-a633-47145a0543d6

</details>

#### Why can't we make it simpler with Semantics flags only?

- I looked at
[UIAccessibilityTraits](https://developer.apple.com/documentation/uikit/uiaccessibilitytraits),
it seems the
[selected](https://developer.apple.com/documentation/uikit/uiaccessibilitytraits/selected)
property does announce `selected` state, but it does not mention or give
hints for `unselected` state.
-
[L824-L828](e8bef98051/engine/src/flutter/shell/platform/darwin/ios/framework/Source/SemanticsObject.mm (L824-L828))
in Flutter source code does mention radio button: Looks like I can try
marking both toggle and check, but it's impossible, due to an assertion:
[A semantics node cannot be toggled and checked at the same
time](35375e43fb/packages/flutter/lib/src/rendering/object.dart (L4807-L4809))

➡️ Not sure which flags can trigger `unselected` state implicitly.

#### How do iOS native apps work?

I did test with two approaches:

1. iOS Reminders app: 
VoiceOver vocalizes as follows:
Unchecked radio: "...Incomplete..."
checked radio:"...Completed..."

<details>
<summary>Demo video</summary>


https://github.com/user-attachments/assets/6bed5d14-ded8-47c2-9c09-7afc266898cc

</details>

2. Build Radio with SwiftUI

Looks like [there is no built-in widget for Radio provided by
Apple](https://www.reddit.com/r/SwiftUI/comments/1gsh7zo/does_swiftui_have_a_builtin_radiobutton_in_2024/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button).
[Is it really a native iOS
component?](https://www.reddit.com/r/SwiftUI/comments/1gsh7zo/comment/lxea1uf/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button)

Most of results I have found suggest building radio from a button with
changing image source(selected/unselected, respectively), as I do in
this SwiftUI code here:
https://gist.github.com/huycozy/93b12c030651c4fde6fe8fceda1ba1ee. We can
control what the reader vocalizes by setting traits and value for it
manually. This being said, setting accessibility hint or value from
Flutter side makes sense in this case. Please let me know if I am
missing something.

<details>
<summary>Demo video</summary>


https://github.com/user-attachments/assets/118c89c5-46a3-497f-8b2a-6f7c5ae8edf3

</details>


## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

---------

Signed-off-by: huycozy <huy@nevercode.io>
Co-authored-by: chunhtai <47866232+chunhtai@users.noreply.github.com>
2025-10-09 00:12:33 +00:00
Ahmed Mohamed Sameh
3764b0b068
Make sure that a CupertinoDesktopTextSelectionToolbarButton doesn't c… (#173894)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the
CupertinoDesktopTextSelectionToolbarButton UI control.

---------

Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
2025-09-25 20:25:05 +00:00