-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsfound in release: 3.24Found to occur in 3.24Found to occur in 3.24frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-text-inputOwned by Text Input teamOwned by Text Input teamtriaged-text-inputTriaged by Text Input teamTriaged by Text Input team
Description
Steps to reproduce
- use new stable Flutter (3.24.0) - I believe this is a new issue
- Just place
TextFieldwith long hint, minLines = 1, maxLines=4 (example values) - type in a short text
Expected results
I except the field to have as many lines as the short text needs, not the hint (when it's not visible)
Actual results
when we have long hint and it needs more lines, even though we typed some short text and the hint is not visible, the text fields still have as many lines as the hint needs
Code sample
Code sample
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
bool useHint = true;
void toggleHint() {
setState(() {
useHint = !useHint;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 200,
decoration: BoxDecoration(
border: Border.all(color: Colors.blue, width: 4.0)),
child: TextField(
minLines: 1, // this here causes problem
maxLines: 4, // this here causes problem
decoration: InputDecoration(
hintText: useHint // with hint there is a problem
? "veeeery loooooooooooooooooong hiiiintttttttttt"
: null),
),
),
Switch(value: useHint, onChanged: (_) => toggleHint())
],
),
),
);
}
}Screenshots or Video
Screenshots / Video demonstration
Nagranie.z.ekranu.2024-08-9.o.19.23.56.mov
Logs
Flutter Doctor output
Doctor output
shark@sharkbook hint_issue % fvm flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel stable, 3.24.0, on macOS 14.4.1 23E224 darwin-arm64, locale pl-PL)
! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/2.17.6/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /Users/shark/fvm/versions/stable. Consider adding /Users/shark/fvm/versions/stable/bin to the front of your path.
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2024.1.4)
[✓] VS Code (version 1.92.1)
[✓] Connected device (4 available)
[✓] Network resources```
</details>Rei-x, SuicaLondon and rs5173
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsfound in release: 3.24Found to occur in 3.24Found to occur in 3.24frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-text-inputOwned by Text Input teamOwned by Text Input teamtriaged-text-inputTriaged by Text Input teamTriaged by Text Input team