أحاول إنشاء تنقل درج باستخدام إطار رفرفة ، لكنني أحصل على الاستثناء التالي في كل مرة أقوم بتشغيله
Another exception was thrown: Navigator operation requested with a context that does not include a Navigator.
فما هو الحل ، أي مساعدة؟
لقد استخدمت فئة المستكشف على النحو التالي
void main() {
runApp(new MyApp());
}
class MyApp extends StatefulWidget {
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return new AppStates();
}
}
class AppStates extends State<MyApp> {
@override
Widget build(BuildContext context) {
// TODO: implement build
return MaterialApp(
home: new Scaffold(
appBar: AppBar(
title: Text("Application App Bar"),
),
drawer: Drawer(
child: ListView(
children: <Widget>[
ListTile(
title: Text("Next Page"),
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => NextPage()));
},
)
],
),
),
),
);
}
}
ورمز فئة NextPage هو
class NextPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
// TODO: implement build
return MaterialApp(
home: new Scaffold(
appBar: new AppBar(
title: new Text("Next Page App Bar"),
),
),
);
}
}