我正在尝试使用 构建一个演示聊天应用程序Flutter。在主屏幕之后,我通常Navigator.push会转到详细信息屏幕。问题截图:
第一个屏幕的构建方法:
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Chat Thread App"),
actions: <Widget>[
IconButton(
icon: Icon(Icons.settings),
onPressed: () {
Navigator.pushNamed(context, '/settings');
},
)
],
),
body: isLoading
? Center(
child: CircularProgressIndicator(),
)
: new ChatThreadListCard(messageThreads: _messageThreadLists, user: _user,),
);
}
Run Code Online (Sandbox Code Playgroud)
方法代码Navigator.push:
Navigator.push(context, MaterialPageRoute(
builder: (context) => ChatDetailsScreen(threadModel: new ThreadModel(
user.id,
user.fullName,
user.pic,
"otherId",
"otherName",
"otherPic",
post.threadId
)
),
),);
Run Code Online (Sandbox Code Playgroud)
第二个屏幕的构建方法,其中产生了问题:
return Scaffold(
appBar: AppBar(
title: Text("Chat demo"),
), …Run Code Online (Sandbox Code Playgroud)