Android 与BottomNavigationBar一起使用时,容器的大小受到限制

Android 与BottomNavigationBar一起使用时,容器的大小受到限制,android,flutter,dart,scroll,bottomnavigationview,Android,Flutter,Dart,Scroll,Bottomnavigationview,我有一个应用了BottomNavigationBar的屏幕。索引为0时,将导致home.dart 在home.dart中,我想创建一列小部件。它包含2个标题(放入行小部件)和2个列表视图。我希望第一个列表视图水平滚动,第二个垂直滚动。两个ListView都是可滚动的。然而,似乎两个列表(或容器)的大小都受到某种限制,因为第二个ListView滚动行为是它只在屏幕的下半部分滚动,而不是整个屏幕 我想在home.dart中添加一个扩展到整个容器外部的SingleChildScrollView。但它返

我有一个应用了BottomNavigationBar的屏幕。索引为0时,将导致home.dart

在home.dart中,我想创建一列小部件。它包含2个标题(放入行小部件)和2个列表视图。我希望第一个列表视图水平滚动,第二个垂直滚动。两个ListView都是可滚动的。然而,似乎两个列表(或容器)的大小都受到某种限制,因为第二个ListView滚动行为是它只在屏幕的下半部分滚动,而不是整个屏幕

我想在home.dart中添加一个扩展到整个容器外部的SingleChildScrollView。但它返回了错误

主屏幕.省道

int _currentTab = 0;
void onTabTapped(int tabNumber) {
    setState(() {
      _currentTab = tabNumber;
    });
  }
@override
  void initState() {
    super.initState();
    this.setState(() {
      contents = [
        HomeTab(),
        DownloadedTab(),
        SettingTab()
      ];
    });
  }
@override
Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
        appBar: AppBar(
          title: Text('Home'),
        ),
        body: Container(
          child: contents != null ? contents[_currentTab] : Text("Page is loaded"),
        ),
        bottomNavigationBar: BottomNavigationBar(
          type: BottomNavigationBarType.fixed,
          onTap: onTabTapped,
          backgroundColor: Theme.ColorsMode.appBarGradientStart,
          currentIndex: _currentTab,
          items: [
            BottomNavigationBarItem(
              icon: new Icon(Icons.home),
              title: new Text('Home')),
            BottomNavigationBarItem(
              icon: new Icon(Icons.file_download),
              title: new Text('Download')),
            BottomNavigationBarItem(
              icon: new Icon(Icons.settings),
              title: new Text('Setting')),
          ],
        ),
      ),
    );
  }
霍姆·达特

@override
Widget build(Build context) {
  return Container(
    child: Column(
      children: <Widget>[
          Row(
            children: <Widget>[
              Text('Course', textAlign: TextAlign.left, style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold)),
            ],
          ),
          Expanded(
            child: Container(
              // height: 6000.0,
              child: ListView.builder(
                physics: BouncingScrollPhysics(),
                scrollDirection: Axis.horizontal,
                itemCount: (showInHomeClass != null && showInHomeClass != null) ? showInHomeClass.length : 0,
                itemBuilder: (context, index) {
                  return Container(
                    width: MediaQuery.of(context).size.width * 0.6,
                    child: FittedBox(
                      fit: BoxFit.cover,
                      child: GestureDetector(
                        onTap: () {},
                        child: Card(
                          child: Center (
                            child: Image.network('https://example.com'),
                          ),
                        ),
                      ),
                    ),
                  );
                }
              ),
            ),
          ),
          Row(
            children: <Widget>[
              Text('News', textAlign: TextAlign.left, style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold)),
            ],
          ),
          Expanded(
            child: Container(
              // height: 6000.0,
              child: ListView.builder(
                physics: BouncingScrollPhysics(),
                scrollDirection: Axis.vertical,
                itemCount: (showInHomeClass != null && showInHomeClass != null) ? showInHomeClass.length : 0,
                itemBuilder: (context, index) {
                  return Container(
                    width: MediaQuery.of(context).size.width * 0.6,
                    child: FittedBox(
                      fit: BoxFit.cover,
                      child: GestureDetector(
                        onTap: () {},
                        child: Card(
                          child: Center (
                            child: Image.network('https://example.com'),
                          ),
                        ),
                      ),
                    ),
                  );
                }
              ),
            ),
          )
      ],
    ),
  );
}
有什么建议吗


════════ Exception caught by widgets library ═══════════════════════════════════
The following assertion was thrown building Listener:
'package:flutter/src/widgets/framework.dart': Failed assertion: line 1786 pos 12: '_elements.contains(element)': is not true.


Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=BUG.md

The relevant error-causing widget was
    SingleChildScrollView 
lib\…\Home\Home.dart:115
#4      Element.inflateWidget 
package:flutter/…/widgets/framework.dart:3176
#5      Element.updateChild 
package:flutter/…/widgets/framework.dart:2988
#6      SingleChildRenderObjectElement.mount 
package:flutter/…/widgets/framework.dart:5445
...
════════════════════════════════════════════════════════════════════════════════
Reloaded 6 of 675 libraries in 919ms.

════════ Exception caught by widgets library ═══════════════════════════════════
'package:flutter/src/widgets/framework.dart': Failed assertion: line 1786 pos 12: '_elements.contains(element)': is not true.
The relevant error-causing widget was
    SingleChildScrollView