Flutter:如何在TextField上使用focusNode属性

时间:2018-04-19 03:26:09

标签: dart flutter

我希望在用户点击它时控制TextField窗口小部件。如何实现focusNode属性?说明中没有详细解释。

2 个答案:

答案 0 :(得分:2)

OrcHealth = 15

while ((OrcHealth <=0)) or ((Action != 0)):
    if Action == 1:
        HeroAttack=random.randint(1,5)
        OrcHealth = OrcHealth - HeroAttack
        print("You see an opening, this is your chance! You swing your blade and do",HeroAttack,"to the orc.\n This brings the beast down to", OrcHealth)
        Action = int(input("You grip your sword tightly and think about what to do next.")
else:
      print("The battle is over.")

答案 1 :(得分:1)

别忘了以后将其丢弃,以避免内存泄漏:

@override
  void dispose() {
    focusNode.dispose();
    super.dispose();
  }