From 9e64b671117e5751f270b00594b153cb827d5ec0 Mon Sep 17 00:00:00 2001 From: Bruno Leroux Date: Fri, 11 Oct 2024 23:35:27 +0200 Subject: [PATCH] Improve InputDecoration.errorMaxLines documentation (#156468) ## Description This PR improves the `InputDecoration.errorMaxLines` and `InputDecoration.helperMaxLines` documentations to explain when wrapping and ellipsing are applied. ## Related Issue Fixes [InputDecoration.errorMaxLines's documentation does not match behavior](https://github.com/flutter/flutter/issues/155626). --- .../lib/src/material/input_decorator.dart | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/packages/flutter/lib/src/material/input_decorator.dart b/packages/flutter/lib/src/material/input_decorator.dart index 08c13d661e..75df5507b8 100644 --- a/packages/flutter/lib/src/material/input_decorator.dart +++ b/packages/flutter/lib/src/material/input_decorator.dart @@ -2874,7 +2874,15 @@ class InputDecoration { /// The maximum number of lines the [helperText] can occupy. /// - /// Defaults to null, which means that the [helperText] is not limited. + /// Defaults to null, which means that soft line breaks in [helperText] are + /// truncated with an ellipse while hard line breaks are respected. + /// For example, a [helperText] that overflows the width of the field will be + /// truncated with an ellipse. However, a [helperText] with explicit linebreak + /// characters (\n) will display on multiple lines. + /// + /// To cause a long [helperText] to wrap, either set [helperMaxLines] or use + /// [helper] which offers more flexibility. For instance, it can be set to a + /// [Text] widget with a specific overflow value. /// /// This value is passed along to the [Text.maxLines] attribute /// of the [Text] widget used to display the helper. @@ -2972,7 +2980,15 @@ class InputDecoration { /// The maximum number of lines the [errorText] can occupy. /// - /// Defaults to null, which means that the [errorText] is not limited. + /// Defaults to null, which means that soft line breaks in [errorText] are + /// truncated with an ellipse while hard line breaks are respected. + /// For example, an [errorText] that overflows the width of the field will be + /// truncated with an ellipse. However, an [errorText] with explicit linebreak + /// characters (\n) will display on multiple lines. + /// + /// To cause a long [errorText] to wrap, either set [errorMaxLines] or use + /// [error] which offers more flexibility. For instance, it can be set to a + /// [Text] widget with a specific overflow value. /// /// This value is passed along to the [Text.maxLines] attribute /// of the [Text] widget used to display the error.