首页 > 解决方案 > 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();
        }
        }),
   );
   }
  }

标签: flutterdartflutter-layout

解决方案


推荐阅读