From e765ed43a5b588aeae2cbcff6db463829b1a086b Mon Sep 17 00:00:00 2001 From: Kishan Rathore <34465683+rkishan516@users.noreply.github.com> Date: Thu, 12 Jun 2025 00:19:40 +0530 Subject: [PATCH] Docs: Update docs for suffix icon interaction behaviour (#169828) Docs: Update docs for suffix icon interaction behaviour fixes: #167713 ## 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. --- .../flutter/lib/src/material/text_field.dart | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/packages/flutter/lib/src/material/text_field.dart b/packages/flutter/lib/src/material/text_field.dart index 3057f700cd4..94749ec31ea 100644 --- a/packages/flutter/lib/src/material/text_field.dart +++ b/packages/flutter/lib/src/material/text_field.dart @@ -603,6 +603,27 @@ class TextField extends StatefulWidget { /// /// If non-null this property overrides the [decoration]'s /// [InputDecoration.enabled] property. + /// + /// When a text field is disabled, all of its children widgets are also + /// disabled, including the [InputDecoration.suffixIcon]. If you need to keep + /// the suffix icon interactive while disabling the text field, consider using + /// [readOnly] and [enableInteractiveSelection] instead: + /// + /// ```dart + /// TextField( + /// enabled: true, + /// readOnly: true, + /// enableInteractiveSelection: false, + /// decoration: InputDecoration( + /// suffixIcon: IconButton( + /// onPressed: () { + /// // This will work because the TextField is enabled + /// }, + /// icon: const Icon(Icons.edit_outlined), + /// ), + /// ), + /// ) + /// ``` final bool? enabled; /// Determines whether this widget ignores pointer events.