-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Open
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 problemsbrowser: chrome-desktoponly manifests in desktop Chromeonly manifests in desktop Chromef: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.f: scrollingViewports, list views, slivers, etc.Viewports, list views, slivers, etc.found in release: 3.28Found to occur in 3.28Found to occur in 3.28found in release: 3.29Found to occur in 3.29Found to occur in 3.29has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyWeb applications specificallyteam-webOwned by Web platform teamOwned by Web platform teamtriaged-webTriaged by Web platform teamTriaged by Web platform team
Description
Steps to reproduce
Run attached code. You can also use any other scrollable widget, change any TextField properties, the result will be the same
Expected results
A fully functional, expanded TextField inside a scrollable widget is expected. Any workarounds to achieve this setup would be greatly appreciated
Actual results
Text selection unexpectedly jumps to the start, causing issues such as scrolling to the top of the TextField.
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 MaterialApp(home: Scaffold(body: BugWidget()));
}
}
class BugWidget extends StatefulWidget {
const BugWidget({super.key});
@override
State<BugWidget> createState() => _BugWidgetState();
}
class _BugWidgetState extends State<BugWidget> {
late final TextEditingController controller;
String text = """
Kvkvbj v1 Nfxwzsh AV
vxmjvsftshjzi gx_US [
mwxiwz [
sxndxjy="Bjgfujp";
lcccdkqy="Gexcl";
mhbjrjqx="Fypg";
]
lcccdkqy {
AV.VRLRCNMW.SPM_RLVGWX [
kwmx="Fypg Rlvgwx";
zwbs="Olgtjq Fypg Rlvgwx";
hvrpgejmxpj="Keg brp yv gkqfr zr g kbx rlvgwx. Rkag twyja gmuu xmse dqnu pkyxw jp st gt g hrpmwm yet, xp tpgy gjnxcykx rqkcl";
vlbjx="Yjmfiv vlbjx gkqfr rlvgwx fvzrly";
swfjlcr="Fypg rlvgwx xtjdqm ivx bqe bmm gjmqgjjq";
];
AV.VRLRCNMW.SPM_JQKPPRG [
kwmx="Fypg Jqkppr";
zwbs="Olgtjq Fypg Jqkppr";
hvrpgejmxpj="Keg brp yv gkqfr zr g jqkppr. Xyilyebm, gmuu xmse jpq hfrj gkqfr qkyxw jw cpyg. Yjmfiv twyja gmuu jxse gkqfr jqkppr jp st gt g hrpmwm yet.";
vlbjx="Yjmfiv vlbjx gkqfr jqkppr ymzyfmrjvmsj";
swfjlcr="Fypg jqkppr xtjdqm ivx bqe cmm dgjjqgjrp";
];
AV.VRLRCNMW.SPM_MKHGMUJX [
kwmx="Fypg Mkhgmujx";
zwbs="Vtgs Fypg Mkhgmujx";
hvrpgejmxpj="Keg brp yv gkqfr zr g Mkhgmujx. Rkag twyja jp dpjnsxmj gjpxg yq e kbx rlvgwx mj hxdzrjv. Rkag twyja gmuu jpse gmuu Mkhgmujx jp st gt g hrpmwm yet.";
vlbjx="Yjmfiv vlbjx gkqfr Mkhgmujx jgyjsjxvjmsj";
swfjlcr="Fypg Mkhgmujx xtjdqm ivx bqe dgjjqgjrp";
];
AV.VRLRCNMW.VQKMX_MKHGMUJX [
kwmx="Vxkdjk Mkhgmujx";
zwbs="Vqkxej Mkhgmujx";
hvrpgejmxpj=zrxe;
vlbjx="Yjmfiv vlbjx gkqfr vxkdjk Mkhgmujx";
swfjlcr="Vxkdjk Mkhgmujx xtjdqm ivx bqe dgjjqgjrp";
];
}
irpxqm {
# dxmdkx
AV.VRLRCNMW.SPM_RLVGWX.%XJQGK [
kwmx="Rlvgwx xjgj";
hvrpgejmxpj="Whe hcgp kg fmkx he rlvgwx vtmmq yvjfx gm mm hgrxge gj bmx jgjgpmiotm.";
fknjmrx=zrxe;
];
AV.VRLRCNMW.SPM_RLVGWX.%ZBFJ [
kwmx="Rlvgwx's zbfj";
#hvrpgejmxpj="Whe zbfj he rlvgwx. Olgtjq brx jx zmuu hjngjqjqw gxv pqgcqtxbjm. Jcmz zbfj xjgj gm gjxyjmnxgxjp. Dwm jgf zbfj kgse djxy gm gjxyjmnxgxjp.";
#fknjmrx=zrxe;
hvrpgejmxpj="Fqjvw jc vav c xixj qmpgxjgvw vxv gzy pryfflxw.";
swfjlcr="Fqjvw jc vav c xixj qmpgxjgvw xmxllx dvx jyy cmm dqnlmxw";
];
AV.VRLRCNMW.SPM_RLVGWX.%DQL [
kwmx="Rlvgwx's Qql";
hvrpgejmxpj="Whe Rlvgwx's Qql. Whe ql mjkxgm ffy yr gkkxg rx ljgjgj gp wxrbcpr rz fhhmmhffl ymt fxgt gj tjjxtjjxl xjgjgpmiotm.";
fknjmrx=zrxe;
];
AV.VRLRCNMW.SPM_RLVGWX.%ZBFJ [
kwmx="Rlvgwx's Xjqbjf Kxvxsxrxwx";
hvrpgejmxpj="Whe Xjqbjf Kxvxsxrxwx. Yjmfiv Cvxj gmuu jp fvmx xjxljp nz gx hjylxv jxy jm fmmg lvxjxgxjgg.";
fknjmrx=zrxe;
];
AV.VRLRCNMW.SPM_RLVGWX.%CPGXF [
kwmx="Rlvgwx's Cpgyx";
hvrpgejmxpj="Rlvgwx's Cpgyx. Yjmfiv Whe Rlvgwx's Cpgyx, xgxjxljgxrz xj rlvgwx jxvxlr yp wzcpxj gmuu jxgzgzxj xjxljp.";
fknjmrx=zrxe;
];
AV.VRLRCNMW.SPM_RLVGWX.%MJLLGC_XBJRXM [
kwmx="Rlvgwx's Mjllgc Xbjrxm";
hvrpgejmxpj="Whe Rlvgwx's Mjllgc Xbjrxm yp wzcpxj. Yjmfiv Whe mjllgc xbjrxm he rvlgpj gz rqwc pg xepldmw mz gxcxng, hggxzqpjms jq gx jxgxzgxg gdygqgxcw. Yjmfiv Whe rvlgpj xbjrxm he rvlgpj gz rqwc pg xepldmw mz gxcxng, hggxzqpjms jq gx jxgxzgxg gdygqgxcw.";
fknjmrx=zrxe;
];
# dxmdkx
AV.VRLRCNMW.SPM_JQKPPRG.%XJQGK [
kwmx="Jqkppr xjgj";
hvrpgejmxpj=zrxe;
fknjmrx=zrxe;
];
AV.VRLRCNMW.SPM_JQKPPRG.%ZBFJ [
kwmx="Jqkppr's zbfj";
hvrpgejmxpj=zrxe;
fknjmrx=zrxe;
];
AV.VRLRCNMW.SPM_JQKPPRG.%CPGXF [
kwmx="Jqkppr's Cpgyx";
hvrpgejmxpj=zrxe;
fknjmrx=zrxe;
];
AV.VRLRCNMW.SPM_JQKPPRG.%MJLLGC_XBJRXM [
kwmx="Jqkppr's Mjllgc Xbjrxm";
hvrpgejmxpj=zrxe;
fknjmrx=zrxe;
];
# dqjmmnx
AV.VRLRCNMW.zazzazaa [
kwmx="zazzazaa";
kwmxs="zazzazaav";
];
AV.VRLRCNMW.asdasd [
kwmx="asdasd";
kwmxs="asdasds";
];
AV.VRLRCNMW.asdasdasd [
kwmx="asdasdasd";
kwmxs="asdasdasd";
];
}
attributes {
# dxmdkx
AV.VRLRCNMW.zazzazaa.@XJQGK [
kwmx="zazzazaa xjgj";
];
AV.VRLRCNMW.zazzazaa.@ZBFJ [
kwmx="zazzazaa's zbfj";
];
AV.VRLRCNMW.zazzazaa.@CPGXF [
kwmx="zazzazaa's Cpgyx Kxvxsxrxwx";
];
AV.VRLRCNMW.zazzazaa.@MJLLGC_XBJRXM [
kwmx="zazzazaa's Mjllgc Xbjrxm";
];
# asdasd
AV.VRLRCNMW.asdasd.@XJQGK [
kwmx="asdasd xjgj";
];
AV.VRLRCNMW.asdasd.@ZBFJ [
kwmx="asdasd's zbfj";
];
AV.VRLRCNMW.asdasd.@CPGXF [
kwmx="asdasd's Cpgyx";
];
AV.VRLRCNMW.asdasd.@MJLLGC_XBJRXM [
kwmx="asdasd's Mjllgc Xbjrxm";
];
# asdasdasd
AV.VRLRCNMW.asdasdasd.@ESTABLISHED [
kwmx="Time of the asdasdasd";
];
AV.VRLRCNMW.asdasdasd.@BY_asdasd [
kwmx="By asdasd";
];
AV.VRLRCNMW.asdasdasd.@OF_zazzazaa [
kwmx="Of zazzazaa";
];
AV.VRLRCNMW.asdasdasd.@DESCRIPTION [
kwmx="Detailed description";
];
AV.VRLRCNMW.asdasdasd.@PRESCRIPTIONS [
kwmx="Prescriptions written out";
];
AV.VRLRCNMW.asdasdasd.@NOTES [
kwmx="asdasd's notes";
];
}
]
""";
@override
void initState() {
super.initState();
controller = TextEditingController(text: text);
}
@override
void dispose() {
controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: TextField(
controller: controller,
maxLines: null,
expands: true,
scrollPhysics: NeverScrollableScrollPhysics(),
),
);
}
}
Screenshots or Video
Screenshots / Video demonstration
Screen.Recording.2025-01-26.at.17.24.35.mov
Logs
Logs
While debugging, I limited the height of the TextField using a SizedBox. There is a magic number (3004 px on my computer) at which it stops working as expected
Flutter Doctor output
Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 3.28.0-2.0.pre.38700, on macOS 15.2 24C101 darwin-arm64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[!] Xcode - develop for iOS and macOS (Xcode 16.2)
! CocoaPods 1.15.2 out of date (1.16.2 is recommended).
CocoaPods is a package manager for iOS or macOS platform code.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/to/platform-plugins
To update CocoaPods, see https://guides.cocoapods.org/using/getting-started.html#updating-cocoapods
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.2)
[✓] IntelliJ IDEA Ultimate Edition (version 2024.3.1.1)
[✓] VS Code (version 1.96.2)
[✓] Connected device (4 available)
[✓] Network resources
! Doctor found issues in 1 category.iapicca, AdamLBS, flrnsbt, rodrigo-itao and desmond206x
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 problemsbrowser: chrome-desktoponly manifests in desktop Chromeonly manifests in desktop Chromef: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.f: scrollingViewports, list views, slivers, etc.Viewports, list views, slivers, etc.found in release: 3.28Found to occur in 3.28Found to occur in 3.28found in release: 3.29Found to occur in 3.29Found to occur in 3.29has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyWeb applications specificallyteam-webOwned by Web platform teamOwned by Web platform teamtriaged-webTriaged by Web platform teamTriaged by Web platform team