颤振两个级别的选项卡问题

时间:2018-08-20 03:05:13

标签: tabs dart flutter

我创建了具有两个级别的选项卡的布局。布局看起来不错,但是单击第二层(“关注者”选项卡)选项卡不起作用,并且激活了“收藏夹”选项卡。

我创建了具有两个级别的选项卡的布局。布局看起来不错,但是单击第二层(“关注者”选项卡)选项卡不起作用,并且激活了“收藏夹”选项卡。

enter image description here

new Container(
  decoration: new BoxDecoration(color: Colors.pinkAccent),
  child: new TabBar(
    controller: _controller,
    tabs: [
      new Tab(
        text: 'Favorites',
      ),
      new Tab(
        text: 'Follows',
      ),
    ],
  ),
),
new Expanded(
  child: new TabBarView(
    controller: _controller,
    children: <Widget>[
      new Container(
              child: buildGrid(context, Posts),
            ),
      new Container(
              child: new Column(
                children: <Widget>[
                  new Container(
                    decoration: new BoxDecoration(
                        color: Colors.grey),
                    child: new TabBar(
                      controller: tabController,
                      tabs: [
                        new Tab(
                          text: 'Follower',
                        ),
                        new Tab(
                          text: 'Following',
                        ),
                      ],
                    ),
                  ),
                  new Expanded(
                      child: new TabBarView(
                          controller: tabController,
                          children: <Widget>[
                        new ListView.builder(
                          itemCount: followerList.length,
                          itemBuilder: (context, index) {
                            return Container(
                              padding: EdgeInsets.only(
                                  left: 10.0),
                              child: Column(
                                crossAxisAlignment:
                                    CrossAxisAlignment
                                        .start,
                                children: <Widget>[
                                  new Row(
                                      children: <Widget>[
                                        new HeroProfile(
                                            followerList[
                                                    index]
                                                [
                                                "userID"]),
                                        new Container(
                                          padding:
                                              new EdgeInsets
                                                      .only(
                                                  left:
                                                      10.0),
                                        ),
                                        new Column(
                                          crossAxisAlignment:
                                              CrossAxisAlignment
                                                  .start,
                                          children: <
                                              Widget>[
                                            new Text(
                                              followerList[
                                                      index]
                                                  [
                                                  'userName'],
                                              style: new TextStyle(
                                                  fontFamily: 'Ubuntu',
                                                  letterSpacing: 0.5,
                                                  //     fontWeight: FontWeight.bold,
                                                  fontSize: 13.0,
                                                  color: Colors.black),
                                            ),
                                            new Container(
                                              padding: new EdgeInsets
                                                      .only(
                                                  bottom:
                                                      5.0),
                                            ),
                                            new Text(
                                              followerList[
                                                      index]
                                                  [
                                                  'country'],
                                              style: new TextStyle(
                                                  fontFamily: 'Ubuntu',
                                                  letterSpacing: 0.5,
                                                  //     fontWeight: FontWeight.bold,
                                                  fontSize: 13.0,
                                                  color: Colors.lightBlue),
                                            ),
                                          ],
                                        )
                                      ]),
                                  new Divider(),
                                ],
                              ),
                            );
                          },
                        ),
                        new ListView.builder(
                          itemCount: followerList.length,
                          itemBuilder: (context, index) {
                            return Container(
                              padding: EdgeInsets.only(
                                  left: 10.0),
                              child: Column(
                                crossAxisAlignment:
                                    CrossAxisAlignment
                                        .start,
                                children: <Widget>[
                                  new Row(
                                      children: <Widget>[
                                        new HeroProfile(
                                            followerList[
                                                    index]
                                                [
                                                "userID"]),
                                        new Container(
                                          padding:
                                              new EdgeInsets
                                                      .only(
                                                  left:
                                                      10.0),
                                        ),
                                        new Column(
                                          crossAxisAlignment:
                                              CrossAxisAlignment
                                                  .start,
                                          children: <
                                              Widget>[
                                            new Text(
                                              followerList[
                                                      index]
                                                  [
                                                  'userName'],
                                              style: new TextStyle(
                                                  fontFamily: 'Ubuntu',
                                                  letterSpacing: 0.5,
                                                  fontSize: 13.0,
                                                  color: Colors.black),
                                            ),
                                            new Container(
                                              padding: new EdgeInsets
                                                      .only(
                                                  bottom:
                                                      5.0),
                                            ),
                                            new Text(
                                              followerList[
                                                      index]
                                                  [
                                                  'country'],
                                              style: new TextStyle(
                                                  fontFamily: 'Ubuntu',
                                                  letterSpacing: 0.5,
                                                  fontSize: 13.0,
                                                  color: Colors.lightBlue),
                                            ),
                                          ],
                                        )
                                      ]),
                                  new Divider(),
                                ],
                              ),
                            );
                          },
                        ),
                      ])),
                ],
              ),
            )
    ],
  ),
),

0 个答案:

没有答案