【问题标题】:assigning a unique id for button [closed]为按钮分配一个唯一的 ID [关闭]
【发布时间】:2019-06-06 05:24:40
【问题描述】:

假设存在一个表单并且有两个按钮,我希望一个按钮被禁用,直到用户填写所有参数,而另一个启用,以便用户导航到后面板。是否存在为按钮分配唯一 ID 的功能?

Edit1:  Tried to disable one of the button,until all the text-form field in the page is touched by users,once user enters all the required parameters ,then the button gets enabled!

【问题讨论】:

    标签: android button dart flutter boolean


    【解决方案1】:

    您不需要唯一的 ID

    FlatButton(Text('foo'), onPressed: areAllParametersFilled ? _onFooPressed : null),
    FlatButton(Text('bar'), onPressed: !areAllParametersFilled ? _onBarPressed : null),
    

    【讨论】:

    • 这只是一个虚构的名字。你需要自己完成。因为你没有提供你的代码我不知道什么适合你的需要。我假设一个bool areAllParametersFilled; 设置为true 当所有都填满时设置为false 否则。您需要自己设置。
    猜你喜欢
    • 1970-01-01
    • 2015-02-01
    • 2020-06-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-31
    • 1970-01-01
    相关资源
    最近更新 更多