Flutter 从抽屉get-noSuchMethodError到页面的导航器:方法“*”在null上被调用
抽屉工作得很好,但在我在主页中添加了选项卡栏之后。从抽屉到其他页面的导航器获取错误“noSuchMethodError:方法“*”在null上被调用。我的意思是,当从抽屉中单击listTile时。这导致了那个错误 这是我的密码Flutter 从抽屉get-noSuchMethodError到页面的导航器:方法“*”在null上被调用,flutter,Flutter,抽屉工作得很好,但在我在主页中添加了选项卡栏之后。从抽屉到其他页面的导航器获取错误“noSuchMethodError:方法“*”在null上被调用。我的意思是,当从抽屉中单击listTile时。这导致了那个错误 这是我的密码 @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( backgroundColor: g
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: getTitleFontColor(),
centerTitle: true,
title: appBarTitle,
),
drawer: new Drawer(
child:
_drawerLeft(context),
),
body:
new DefaultTabController(
length: 3,
child: new Scaffold(
appBar: new AppBar(
actions: <Widget>[],
title:
TabBar(
isScrollable: true,
unselectedLabelColor: Colors.white.withOpacity(0.3),
indicatorColor: Colors.white,
tabs: [
Tab(
child: Text('A'),
),
Tab(
child: Text('B'),
),
Tab(
child: Text('C'),
),
]
),
),
body: TabBarView(
children: <Widget>[
Container(
//A,
),
Container(
child: ListView(
children:<Widget>[
Column(children: <Widget>[
// B,
],)
])
),
Container(
child: ListView(
children:<Widget>[
Column(children: <Widget>[
// C
],)
])
),
],
),
)
),
// ),
);
}
我的抽屉
return Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
ListTile(
leading: Icon(Icons.credit_card,color: getTitleFontColor()),
title: Text(
"A",
style: TextStyle(
color: getTitleFontColor(), fontSize: 16
)
),
onTap: () => {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => APage()),
),
},
),
]
是我用错导航器了吗?有人能帮忙吗。这能回答你的问题吗?看来问题出在你身上APage@intraector是的,你说得对。我错过了一些代码。