flutter - Flutter:如何返回到特定的底部导航栏
问题描述
我现在在颤振应用程序中遇到问题。特别是在我的底部导航栏中。因此,在我的导航栏中,我有名称为(社区、订阅源、我的活动、个人资料)的项目。我面临的问题是在“Feeds”中,因为在我的“Feeds”中我有一张卡片,并且在那张卡片中我有一个名为“查看个人资料”的按钮,当我单击“查看个人资料”时,它会将我重定向到新页面,在该页面中显示所选卡的“个人资料”。现在的问题是当我返回时,当我单击页面中的“<-”标志时,它会返回到“社区”页面,这是我导航栏上的第一个导航。
现在的问题是,当我单击“<-”标志时,如何返回“Feeds”导航。请帮忙。
我的“供稿”用户界面:
单击“查看个人资料”时的 UI:
单击“查看个人资料”按钮时的代码:
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => new OrgProfile(
doc.data['Name of Organization'])));
},
当您单击“查看个人资料”时,我在新页面上的代码:
class _OrgProfileState extends State<OrgProfile> {
@override
final db = Firestore.instance;
Container buildItem(DocumentSnapshot doc) {
return Container(
child: Column(
children: <Widget>[
Center(
child: Padding(
padding: const EdgeInsets.only(top: 20.0),
child: CircleAvatar(
radius: 70,
),
),
),
Text(
'${doc.data['Email']}',
style: TextStyle(color: Colors.black),
)
],
),
);
}
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(widget.orgName)),
body: StreamBuilder<QuerySnapshot>(
stream: db
.collection('USERS')
.where('Name of Organization', isEqualTo: widget.orgName)
.snapshots(),
builder: (context, snapshot) {
if (snapshot.hasData) {
return Column(
children: snapshot.data.documents
.map((doc) => buildItem(doc))
.toList());
} else {
return SizedBox();
}
}),
);
}
}
解决方案
推荐阅读
- google-cloud-platform - 如何设置 Google Vision 将其 API 调用发送到哪个服务器?
- ios - 为什么必须在主队列上异步调用 resignFirstResponder() 来关闭键盘
- sql - 使用 GORM 生成查询的 Cthulu 过滤器解析器
- python - 如何在 Python 中的标题后发送一些空白行
- javascript - 完成付款过程后横幅不显示 - javascript/html
- java - OpenGL ES 3.0 中的粒子系统优化
- python-3.x - AttributeError:'str' 对象没有属性'append'。我该如何解决这个错误
- bash - 如何使用 bash 计算文件中某行的出现次数?(有加号)
- python - 使用列表循环将变量添加到元组
- c# - 如何根据另一个列表中的表单顺序对列表进行排序