Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 关闭导航仪时的颤振错误_Flutter_Flutter Layout - Fatal编程技术网

Flutter 关闭导航仪时的颤振错误

Flutter 关闭导航仪时的颤振错误,flutter,flutter-layout,Flutter,Flutter Layout,使用不包含导航器的上下文请求的导航器操作 完整代码在这里 class _MyAppState extends State<MyApp> { @override Widget build(BuildContext context) { return new MaterialApp( home: new Scaffold( drawer: new Drawer(child: new ListView( child

使用不包含导航器的上下文请求的导航器操作

完整代码在这里

class _MyAppState extends State<MyApp> {
   @override
   Widget build(BuildContext context) {
     return new MaterialApp(
       home: new Scaffold(
         drawer: new Drawer(child: new ListView(
           children: <Widget>[
               new DrawerHeader(

                 decoration:BoxDecoration(

                   color: Colors.blue
                 ),
                 child: new Container(
                   child: new Text("Hearer name"),

                 ),),
               new ListTile(
                 title: new Text("pop1"),

                 onTap: (){Navigator.pop(context);},
               ),
               new ListTile(
                 title: new Text("pop2"),
                 onTap: (){Navigator.pop(context);},
               ),


             new Container(
               padding: const EdgeInsets.all(20.0),
               child: new Text("asdsad"),
               decoration: BoxDecoration(
                 color: Colors.grey
               ),
             ), new ListTile(
                 title: new Text("pop4"),
                 onTap: (){Navigator.pop(context);},
               ),
             new Container(
               padding: const EdgeInsets.all(20.0),
               child: new Text("opt2"),
             ), new Container(
               padding: const EdgeInsets.all(20.0),
               child:
                   new Text("Asdsa"),




             ),




           ],
         ),),
         appBar: new AppBar(
           title: new Text("Hi , i am milla"),

         ),
         body: new Center(
           child: new ListView(
             shrinkWrap: true,
             padding: const EdgeInsets.all(20.0),
             children: <Widget>[
               new ProductItem("orange"),


             ],
           )
         ),
       ),
     );
   }
class\u MyAppState扩展状态{
@凌驾
小部件构建(构建上下文){
返回新材料PP(
家:新脚手架(
抽屉:新抽屉(子项:新列表视图(
儿童:[
新型抽屉阅读器(
装饰:盒子装饰(
颜色:颜色。蓝色
),
子容器:新容器(
儿童:新文本(“听者姓名”),
),),
新ListTile(
标题:新文本(“pop1”),
onTap:(){Navigator.pop(上下文);},
),
新ListTile(
标题:新文本(“pop2”),
onTap:(){Navigator.pop(上下文);},
),
新容器(
填充:常数边集全部(20.0),
子项:新文本(“asdsad”),
装饰:盒子装饰(
颜色:颜色。灰色
),
),新列表(
标题:新文本(“pop4”),
onTap:(){Navigator.pop(上下文);},
),
新容器(
填充:常数边集全部(20.0),
子:新文本(“opt2”),
),新货柜(
填充:常数边集全部(20.0),
儿童:
新文本(“Asdsa”),
),
],
),),
appBar:新的appBar(
标题:新文本(“嗨,我是米拉”),
),
正文:新中心(
子:新列表视图(
收缩膜:对,
填充:常数边集全部(20.0),
儿童:[
新产品项目(“橙色”),
],
)
),
),
);
}
完整错误代码

:══╡ 用手势捕捉异常 ╞═══════════════════════════════════════════════════════════════════ I/flatter(3551):在处理 手势:I/颤振(3551):使用 不包括Navigator.I/flatter(3551)的上下文: 用于从导航器推送或弹出路由的上下文必须是 作为I/flutter(3551)的小部件:导航器的后代 widget.I/flatter(3551):I/flatter(3551):异常发生时 抛出时,这是堆栈:I/flatter(3551):#0
领航员。 (软件包:flatter/src/widgets/navigator.dart:1179:9)I/flatter(3551):

1 Navigator.of(包:flatter/src/widgets/Navigator.dart:1186:6)I/flatter(3551): 2 Navigator.pop(包:flatter/src/widgets/Navigator.dart:1072:22)I/flatter( 3551):#3"MyAppState.build。 (file:///project/flutter_app_2/lib/main.dart:31:38)I/颤振(3551):

4 InkResponseState.handleTap(包装:颤振/src/材料/墨水井。省道:494:14)I/颤振(3551): 5 InkResponseEstate.build.(包装:颤振/src/材料/ink_well.dart:549:30)I/颤振(3551): 6 GestureRecognizer.invokeCallback(包:flatter/src/signatures/recognizer.dart:102:24)I/flatter( 3551):#7个手势识别器。# (套装:颤振/src/signatures/tap.dart:161:9)我/颤振(3551):#8
TapGestureRecognitor.Accept手势 (套装:颤振/src/signatures/tap.dart:123:7)我/颤振(3551):#9
GestureArenaManager.sweep (套装:颤振/src/signatures/arena.dart:156:27)I/flatter(3551):

10 _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent(包:flift/src/signatures/binding.dart:147:20)I/flift(3551): 11 _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent(包:flift/src/pirtations/binding.dart:121:22)I/flift(3551): 12 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent(包:flift/src/signatures/binding.dart:101:7)I/flift(3551): 13 _WidgetsFlutterBinding&BindingBase&GestureBinding._flushpointerreeventqueue (软件包:颤振/src/signatures/binding.dart:64:7)I/flatter(3551):

14 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (软件包:颤振/src/signatures/binding.dart:48:7)I/flatter(3551):

15#u invoke1(dart:ui/hooks.dart:134:13)I/flatter(3551):#16#u dispatchPointerDataPacket(dart:ui/hooks.dart:91:5)I/flatter(3551):I/flatter(3551):处理程序:onTap I/flatter(3551): 识别器:I/颤振(3551):
TapGestureRecognitor#a8d39(调试所有者:GestureDetector,状态:就绪, 赢得竞技场,最终位置:I/颤振(3551):偏移(51.9239.7), 发送分接下降)I/颤振(3551): ════════════════════════════════════════════════════════════════════════════════════════════════════ I/flatter(3551):引发了另一个异常:Navigator操作 请求的上下文不包括Navigator.I/flatter (3551):引发了另一个异常:请求了导航器操作 在不包含Navigator.I/flatter(3551)的上下文中: 引发了另一个异常:使用 不包括导航器的上下文。I/flatter(3551):另一个 引发异常:使用上下文请求导航器操作 这不包括导航器。I/flatter(3551):另一个 引发异常:使用上下文请求导航器操作 这不包括导航器。I/flatter(3551):另一个 引发异常:使用上下文请求导航器操作 这不包括导航器。I/flatter(3551):另一个 引发异常:使用con请求导航器操作
import 'package:flutter/material.dart';

void main() => runApp(new MyApp());

class MyApp extends StatelessWidget {
 @override
Widget build(BuildContext context) {
 return new MaterialApp(
  title: 'Flutter Demo',
  theme: new ThemeData(
    primarySwatch: Colors.blue,
  ),
  home: new MyHomePage(title: 'Flutter Demo Home Page'),
 );
}
}

 class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);

final String title;
@override
_MyHomePageState createState() => new _MyHomePageState();
 }

class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return new Scaffold(
    drawer: new Drawer(

      child: new ListView(

      children: <Widget>[
        new DrawerHeader(

          decoration: BoxDecoration(

              color: Colors.blue
          ),
          child:new Text("Hearer name"),

          ),
        new ListTile(
          title: new Text("pop1"),

          onTap: () {
            Navigator.pop(context);
          },
        ),
        new ListTile(
          title: new Text("pop2"),
          onTap: () {
            Navigator.pop(context);
          },
        ),


        new Container(
          padding: const EdgeInsets.all(20.0),
          child: new Text("asdsad"),
          decoration: BoxDecoration(
              color: Colors.grey
          ),
        ), new ListTile(
          title: new Text("pop4"),
          onTap: () {
            Navigator.pop(context);
          },
        ),
        new Container(
          padding: const EdgeInsets.all(20.0),
          child: new Text("opt2"),
        ), new Container(
          padding: const EdgeInsets.all(20.0),
          child:
          new Text("Asdsa"),
        ),
      ],
    ),),
    appBar: new AppBar(
      title: new Text("Hi , i am milla"),
    ),
    body: new Center(
        child: new ListView(
          shrinkWrap: true,
          padding: const EdgeInsets.all(20.0),
          children: <Widget>[
          ],
        )
    ),
  );
  }
 }
drawer: new Drawer(
      child: new Column(
        children: <Widget>[
          new DrawerHeader(
            child: new Container(
              child: new Text("Hearer name"),
            ),
          ),
          new Flexible(
            child: new ListView.builder(
              itemCount: 1,
              itemBuilder: (BuildContext context, int index) {
                return new ListTile(
                  title: new Text("Tap $index"),
                  onTap: () => Navigator.of(context).pop(),
                );
              },
            ),
          )
        ],
      ),
    ),
class _MyAppState extends State<MyApp> {
   @override
   Widget build(BuildContext context) {
     return Scaffold(
         drawer: new Drawer(child: new ListView(
           children: <Widget>[
               new DrawerHeader(
                 decoration:BoxDecoration(
                   color: Colors.blue
                 ),
                 child: new Container(
                   child: new Text("Hearer name"),
                 ),),
               new ListTile(
                 title: new Text("pop1"),
                 onTap: (){Navigator.pop(context);},
               ),
               new ListTile(
                 title: new Text("pop2"),
                 onTap: (){Navigator.pop(context);},
               ),
             new Container(
               padding: const EdgeInsets.all(20.0),
               child: new Text("asdsad"),
               decoration: BoxDecoration(
                 color: Colors.grey
               ),
             ), new ListTile(
                 title: new Text("pop4"),
                 onTap: (){Navigator.pop(context);},
               ),
             new Container(
               padding: const EdgeInsets.all(20.0),
               child: new Text("opt2"),
             ), new Container(
               padding: const EdgeInsets.all(20.0),
               child:
                   new Text("Asdsa"),
             ),
           ],
         ),),
         appBar: new AppBar(
           title: new Text("Hi , i am milla"),

         ),
         body: new Center(
           child: new ListView(
             shrinkWrap: true,
             padding: const EdgeInsets.all(20.0),
             children: <Widget>[
               new ProductItem("orange"),

             ],
           )
         ),
       ),
     );
   }