草庐IT

mdl-textfield

全部标签

regex - TextField在whitelistingtextinputformatter中添加2个十进制正数配置后不接受输入

keyboardType:TextInputType.number,inputFormatters:[WhitelistingTextInputFormatter(RegExp("^\s*(?=.*[1-9])\d*(?:\.\d{1,2})?\s*\$"))],),我在我的TextFormField中使用了这个设置,并使用了我从另一个SO帖子中获取的这个正则表达式。在regex101.com上测试似乎没问题,但我无法使用此正则表达式在我的表单上输入任何内容。我使用正则表达式的目标是获得两位十进制正float。Regexgreaterthanzerowith2decimalplaces

android - 在 Flutter 中的方向更改时保留 TextField 值

我在Flutter的OrientationBuilder中有一个TextField。现在,当我改变应用程序的方向时,TextField的当前值(例如,用户输入其中的文本)丢失了,但我想保留TextField的值。我需要重建TextField,因为横向模式下的布局不同。这能做到吗?编辑:这是我目前尝试过的:两次我都使用了以下模型(位于->models->markdownModel.dart):import'package:scoped_model/scoped_model.dart';classCodeextendsModel{String_markdown='#MarkdownPrev

自定义 TextField 中的 Flutter Google Places

你会如何使用像Flutter_Google_Places这样的Dart包?或Google_Places_Picker在您自己的自定义TextFormField中?这两个库似乎都只使用Future来等待用户选择位置。(示例如下)StringplaceName;varplace=awaitPluginGooglePlacePicker.showAutocomplete(mode:PlaceAutocompleteMode.MODE_FULLSCREEN,countryCode:country,typeFilter:TypeFilter.CITIES);placeName=place.nam

drop-down-menu - 如何在 Flutter 的 TextField 中获取 DropDown

我在Flutter中有一个应用程序,我想添加一个TextField,其中嵌套了一个float菜单,TextField应该用作DropDownButton中的过滤器,类似this的东西,但float菜单出现在字段上,不要按下。和一个可以选择嵌套项的dropDownButton。如何在TextField中添加dropDownButton并在嵌套列表中搜索? 最佳答案 使用覆盖..voidshowOverlay(BuildContextcontext){//inbuilderwriteafunctionthatreturnyourdrop

dart - 当我专注于 TextField - Bloc Pattern 时小部件重新呈现

我正在使用BLoC来保持两个嵌套的FullScreenDialogs之间的状态。当我按下第一个屏幕时,我正在初始化bloc,就像这样returnFloatingActionButton(child:Icon(Icons.add),onPressed:(){Navigator.of(context).push(MaterialPageRoute(builder:(BuildContextcontext)=>ProductBlocProvider(child:ProductEntryScreen()),fullscreenDialog:true));},);ProductEntryScre

firebase - 如何将 Flutter TextField 与 Firestore 字段同步?

我在Firestore中有task文档,它有todo字段,在FlutterUI中有TextField。请指教如何使textfield与todo字段同步,即任何时候,textfield中的文本都会随着用户的输入而改变,用刚输入的值更新todo字段。每当todo字段更新(在Firestore控制台中手动或由其他用户更新)时,使用最新值更新textfield。谢谢! 最佳答案 首先,为TextField提供一个TextEditingController(完整示例请查看this)。对于问题的第一部分,您需要为TextEditingContr

dart - 我尝试使用 TextField 的 Controller ,但我收到错误 "NoSuchMethodError: The method ' 调用' was called on null"

我尝试使用TextField的Controller,但我收到错误"NoSuchMethodError:Themethod'call'wascalledonnull"如果我使用onChange()就可以了。我的代码:class_MyHomePageStateextendsState{Icon_searchIcon=Icon(Icons.search,color:Colors.white);int_searchIconState=0;Widget_appBarTitle;TextEditingController_controller=TextEditingController();_on

Flutter:带有 TextField/TextFormField 的 Bottom Sheet

在我们的应用程序的一部分中,我希望在BottomSheet中有一个简单的表单,就像下面的代码一样。不幸的是,当我输入它时,我得到了一个错误ThefollowingassertionwasthrownduringperformLayout():AnInputDecorator,whichistypicallycreatedbyaTextField,cannothaveanunboundedwidth.Thishappenswhentheparentwidgetdoesnotprovideafinitewidthconstraint.Forexample,iftheInputDecorat

flutter : Textfield in ListView. 生成器

大家好,我在CloudFirestore中有一些数据,还有一个ListView.builder用于将数据加载到其中。在此ListView.builder中,我有Network.Image、用于显示标题和副标题的ListTile以及另一个具有用于添加一些评论和图标按钮的文本字段的ListTile。我的目标是获取文本字段的文本并在单击按钮时显示为alertDialog。到目前为止,我向文本字段添加了一个Controller,但是每当我在文本字段中键入任何内容时,它都会更改所有文本字段。我曾尝试创建一个列表来指定一个唯一的Controller,这样我就可以停止文本字段中的所有更改,但我失败了

android - 如何在 Flutter 中删除 TextField 底部的空格?

我不明白为什么文本和蓝线之间的TextField底部有空格。这是我的代码:Future_selectNoteType(BuildContextcontext)async{switch(awaitshowDialog(context:context,builder:(BuildContextcontext){returnnewSimpleDialog(title:constText('SelectNoteType'),children:[Padding(padding:constEdgeInsets.only(left:8.0,right:8.0),child:newTextField(