如何在“On Tap”操作与“导航到”操作中传递参数

huangapple go评论56阅读模式
英文:

How to pass parameter with On Tap action versus Navigate To action

问题

如何在不使用导航到操作的情况下传递页面参数?

我试图更新一行数据,但FlutterFlow的文档指定要使用导航到操作来传递参数,而我想避免使用这种方式。我的目标是在单击数据库条目时设置页面参数,以在同一页面上的不同窗口中加载所选行。我理解这将需要自定义操作,但我对Flutter、Dart或FlutterFlow中的自定义代码不熟悉。

这是FlutterFlow文档中关于通过导航传递参数的示例

FlutterFlow的文档显示:
页面1 -> 发送参数值 -> 页面2

我正在尝试:
页面1 -> 发送参数值 -> 页面1

英文:

How can I pass page parameters without using the Navigate To action?

I'm trying to update a row but FlutterFlow's documentation specifies passing parameters using the Navigate To action that I'm trying to avoid. My goal is to set page parameters on click of a database entry to load the selected row on a separate window on the same page. My understanding is that this would require a custom action but I'm not familiar with Flutter, Dart, or custom code in FlutterFlow.

Here's an example from FlutterFlow's docs on passing parameters through navigation

FlutterFlow's docs show:
Page 1 -> send parameter value -> Page 2

I am trying to:
Page 1 -> send parameter value -> Page 1

答案1

得分: 1

为什么不尝试使用页面状态(Page State)呢?

页面参数(Page Parameters)要求您从另一个页面传递数据,而页面状态(Page States)可以在同一页上更新。由于您想要更新同一页上的内容,将所需的值存储在页面状态中,然后在单击适当的数据库条目后进行更新会更有意义。

英文:

Why don't you try using a Page State instead?

Page Parameters require you to pass data from another page, while Page States can be updated on the same page. Since you want to update something that is on the same page, it would make sense to store your desired value in a Page State and update it once you have clicked on the appropriate database entry.

huangapple
  • 本文由 发表于 2023年5月30日 12:38:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/76361658.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定