Pageview ->“失败的断言:第 4269 行 pos 14:'owner!._debugCurrentBuildTarget == this':不是真的”错误

时间:2021-06-18 11:15:06

标签: flutter dart

我在 PageView 上收到“Failed assertion: line 4269 pos 14: 'owner!._debugCurrentBuildTarget == this': is not true”。我检查了一下,一切都井井有条,就像身体、控制器和底部导航栏一样,一切都在正确的位置。它还告诉我: “一个 RenderViewport 需要一个 RenderSliv​​er 类型的孩子,但收到一个 RenderErrorBox 类型的孩子”

 FutureBuilder<User>(
        future: callUser(user.id),
        builder: (context, snapshot) {
          if (snapshot.hasError) print(snapshot.error);

          return snapshot.hasData ? Scaffold(
              body: PageView(
                controller: _pageController,
                children: <Widget>[
                  ProfileScreen(user: snapshot.data),
                  SearchScreen(user:snapshot.data,),
                ],
                onPageChanged: (int index) {
                  setState(() {
                    _currentTab = index;
                  }); },),

              bottomNavigationBar: CupertinoTabBar(

                currentIndex: _currentTab,
                onTap: (int index) {
                  setState(() {
                    _currentTab = index;
                  });
                  _pageController.animateToPage(
                    index,
                    duration: Duration(milliseconds: 200),
                    curve: Curves.easeIn,
                  );
                },
                items: [

                  BottomNavigationBarItem(
                    icon: Icon(
                      Icons.smartphone,
                      size: MediaQuery.of(context).size.height*0.045,
                      color:   Colors.black,
                    ),
                  ),
               
                  BottomNavigationBarItem(
                    icon: Icon(
                      Icons.search,
                      size: MediaQuery.of(context).size.height*0.045,
                      color: Colors.black,
                    ), ),], )) :


          Center(child: CircularProgressIndicator(backgroundColor: Colors.pink,valueColor: new AlwaysStoppedAnimation<Color>(Colors.pinkAccent)));
        })

我是不是遗漏了什么?这是什么问题?

0 个答案:

没有答案