【问题标题】:Undefined name 'context'. Try correcting the name to one that is defined未定义的名称“上下文”。尝试将名称更正为已定义的名称
【发布时间】:2021-03-24 03:23:03
【问题描述】:

手势检测器( onTap: () => Navigator.push( context, // 这里我得到了红线 MaterialPageRoute( 建设者:(_)=> RestaurantScreen(餐厅:餐厅), ), ),

【问题讨论】:

  • 请修正您的格式并将标题更改为问题形式

标签: flutter


【解决方案1】:

您应该将上下文传递到您拥有手势检测器的任何位置,以便能够使用上下文。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-01-28
    • 2020-11-01
    • 2020-09-03
    • 2023-02-07
    • 2022-08-22
    • 1970-01-01
    • 2022-06-10
    • 2021-11-28
    相关资源
    最近更新 更多