【问题标题】:how to define route in navigator.pop如何在 navigator.pop 中定义路由
【发布时间】:2021-10-16 00:55:42
【问题描述】:

类验证扩展 StatelessWidget { const Verification({Key?key}) : super(key: key);

@覆盖 小部件构建(BuildContext 上下文){ 返回材料应用程序( debugShowCheckedModeBanner:假, 家:脚手架( 身体:填充( 填充:const EdgeInsets.only(顶部:30,左侧:20), 孩子:列( 孩子们: [ 排( 孩子们: [ 墨水井( 点按:(){ Navigator.pop(上下文); }, 孩子:Image.asset( “资产/图像/矢量.png”, 规模:2.5, ), ), 大小盒( 宽度:MediaQuery.of(context).size.width * 0.2, ), 文本( “确认”, 样式:TextStyle(字体大小:28,字体重量:FontWeight.w700), ), ], ), 填充( 填充:const EdgeInsets.only(顶部:15), 孩子:行( mainAxisAlignment:MainAxisAlignment.start, 孩子们: [ Text("请输入您的" ,style: TextStyle(fontSize: 48, fontWeight: FontWeight.w700),), ], ), ),排( mainAxisAlignment:MainAxisAlignment.start, 孩子们: [ Text("验证码" ,style: TextStyle(fontSize: 48, fontWeight: FontWeight.w700),), ], ),

        ],
      ),
    ),
  ),
);

} }

【问题讨论】:

    标签: flutter


    【解决方案1】:

    在 navigator.pop 中不能定义路由,只能返回一页。 如果你想返回几个Screen,你可以使用

    nav = Navigator.of(context);
    nav.pop();
    nav.pop();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-04-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多