草庐IT

flutter-pub

全部标签

flutter - Dart:可取消的后期延迟/ future

我是Flutter的新手,我想通过调用API从InputField翻译一些文本。但是我不想在每次击键时调用它,而是仅在用户暂停输入时调用它。在Android上,我只是将Handler类与postDelay()一起使用,并预先调用removeAllCallbacksAndMessages(null)。有没有办法在Dart上做类似的事情?这是我当前的代码:FuturegetTranslation(Stringquery,Languagefrom,Languageto)async{//cancelhereifacalltothisfunctionwaslessthan500millisago

flutter - Dart:可取消的后期延迟/ future

我是Flutter的新手,我想通过调用API从InputField翻译一些文本。但是我不想在每次击键时调用它,而是仅在用户暂停输入时调用它。在Android上,我只是将Handler类与postDelay()一起使用,并预先调用removeAllCallbacksAndMessages(null)。有没有办法在Dart上做类似的事情?这是我当前的代码:FuturegetTranslation(Stringquery,Languagefrom,Languageto)async{//cancelhereifacalltothisfunctionwaslessthan500millisago

flutter - 从 future 的功能中获取数据到文本小部件

我正在尝试使用Text实现一个Column:Column(children:[Text('datafromfuturefunction')],),我无法从initState()获取数据,因为initState()它只是void如果我直接从函数中获取数据Text(function)我明白了instanceoffunction函数:Futurecalculate(intindex)async{LocData_getUser=awaitgetLoc();doubleuLat=_getUser.latitude;doubleuLng=_getUser.latitude;doublepLat=p

flutter - 从 future 的功能中获取数据到文本小部件

我正在尝试使用Text实现一个Column:Column(children:[Text('datafromfuturefunction')],),我无法从initState()获取数据,因为initState()它只是void如果我直接从函数中获取数据Text(function)我明白了instanceoffunction函数:Futurecalculate(intindex)async{LocData_getUser=awaitgetLoc();doubleuLat=_getUser.latitude;doubleuLng=_getUser.latitude;doublepLat=p

flutter - 返回不同的 StatefulWidgets 的方法在返回不同的小部件时不更新

我有一个方法可以根据枚举的值返回两个有状态小部件之一。但是,即使我可以通过调试器看到正在返回“正确”的小部件,UI也只会显示第一个呈现的小部件。状态对象似乎以某种方式在小部件的不同实例之间共享,或者我遗漏了一些东西。Widget_buildInfoCard(LoginStatusstatus){switch(status){caseLoginStatus.LOGIN_FAILED:returnInfoCard("Loginfailed,pleasecheckyourusernameandpassword.");default:returnInfoCard("Pleaseloginwit

flutter - 返回不同的 StatefulWidgets 的方法在返回不同的小部件时不更新

我有一个方法可以根据枚举的值返回两个有状态小部件之一。但是,即使我可以通过调试器看到正在返回“正确”的小部件,UI也只会显示第一个呈现的小部件。状态对象似乎以某种方式在小部件的不同实例之间共享,或者我遗漏了一些东西。Widget_buildInfoCard(LoginStatusstatus){switch(status){caseLoginStatus.LOGIN_FAILED:returnInfoCard("Loginfailed,pleasecheckyourusernameandpassword.");default:returnInfoCard("Pleaseloginwit

flutter - 如何根据项目包含的数据过滤列表

我正在尝试实现一种搜索方法。我有一个列表,比方说:List_users=[user1,user2,user3];我的类(class)是:classUser{finalStringname;finalStringid;}列表的项目是:varuser1=User(name:"Bob",id:1);varuser2=User(name:"Alice",id:2);varuser3=User(name:"Joe",id:3);如何根据用户名过滤列表? 最佳答案 使用哪里Listfiltered=_users.where((user)=>us

flutter - 如何根据项目包含的数据过滤列表

我正在尝试实现一种搜索方法。我有一个列表,比方说:List_users=[user1,user2,user3];我的类(class)是:classUser{finalStringname;finalStringid;}列表的项目是:varuser1=User(name:"Bob",id:1);varuser2=User(name:"Alice",id:2);varuser3=User(name:"Joe",id:3);如何根据用户名过滤列表? 最佳答案 使用哪里Listfiltered=_users.where((user)=>us

image - 如何在 flutter 中向图像添加文本

如何在flutterweb中给图片添加文字如何在flutterweb上将文本添加到图像中?是否有用于图像编辑的小部件。我们怎样才能做到这一点? 最佳答案 您可以使用custompainting(otheranswerfoundby@F-1)或stackotherwidgetontopofyourimage(hereisexcellentexample,withtextontopofimagesasyoumightwant. 关于image-如何在flutter中向图像添加文本,我们在St

image - 如何在 flutter 中向图像添加文本

如何在flutterweb中给图片添加文字如何在flutterweb上将文本添加到图像中?是否有用于图像编辑的小部件。我们怎样才能做到这一点? 最佳答案 您可以使用custompainting(otheranswerfoundby@F-1)或stackotherwidgetontopofyourimage(hereisexcellentexample,withtextontopofimagesasyoumightwant. 关于image-如何在flutter中向图像添加文本,我们在St