首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >颤振嵌套列表视图为什么我使用行?

颤振嵌套列表视图为什么我使用行?
EN

Stack Overflow用户
提问于 2018-11-05 03:45:23
回答 2查看 1.9K关注 0票数 2

下面的代码不使用行小部件,但在使用嵌套列表视图和行时会出现错误,如果这是我的用例,那么在上面的代码中,我有一行,其中有两列

代码语言:javascript
复制
Widget build(BuildContext context) {
// TODO: implement build
return Scaffold(
  appBar: AppBar(
    title: Text("Dashboard"),
    actions: <Widget>[
      IconButton(
        icon: Icon(Icons.add_circle),
        iconSize: 50.0,
        onPressed: () {
          Navigator.push(
            context,
            MaterialPageRoute(
              builder: (BuildContext context) => AddMember(),
            ),
          );
        },
      ),
    ],
  ),
  drawer: MainDrawer(),
  body: Container(
    decoration: BoxDecoration(
      image: Background().buildBackgroundImage(),
    ),
    child: ListView(
      children: <Widget>[
        Row(
          children: <Widget>[
            Column(
              children: <Widget>[
                Text("1"),
              ],
            ),
            Column(
              children: <Widget>[
                Text("Hammad"),
                ListView.builder(
                  shrinkWrap: true,
                  physics: ClampingScrollPhysics(),
                  itemBuilder: (BuildContext context, int index) {
                    return Text("data");
                  },
                  itemCount: 100,
                ),
              ],
            ),
          ],
        )
      ],
    ),
  ),
);

  } }

代码会产生以下错误?

I/颤振( 6704):RenderShrinkWrappingViewport#9e1c7 relayoutBoundary=up14需要-布局需要-油漆I/颤振( 6704):创建者: ShrinkWrappingViewport←_ScrollableScope←IgnorePointer#a 619←Semantic←I/flutter ( 6704):听者←_GestureSemantics←I/颤振( 6704):RawGestureDetector-LabeledGlobalKey#dbe17←I/flutter ( 6704):_ScrollSemantics-GlobalKey#17359 _GestureSemantics RepaintBoundary CustomPaint RepaintBoundary parentData( 6704):NotificationListener I/flutter ( 6704):(可使用大小)I/颤振( 6704):约束:BoxConstraints(无约束)I/颤振( 6704):尺寸:缺失I/颤振( 6704):axisDirection:下行I/颤振( 6704):crossAxisDirection:右I/颤振( 6704):偏移:ScrollPositionWithSingleContext#d8d3b(偏移:0,范围: null..null,视口: null,I/颤振( 6704):ScrollableState,ClampingScrollPhysics -> ClampingScrollPhysics,IdleScrollActivity#ce116,I/颤振( 6704):ScrollDirection.idle) I/颤振( 6704):这个RenderObject有以下后代(显示深度5):I/颤振( 6704):RenderSliverPadding#a684d需要-布局需要-油漆I/颤振( 6704):RenderSliverList#59143需要-布局需要-油漆I/颤振( 6704):════════════════════════════════════════════════════════════════════════════════════════════════════I/颤振( 6704):另一个异常被抛出: RenderBox未被布局: RenderShrinkWrappingViewport#9e1c7 relayoutBoundary=up14 RenderBox RenderShrinkWrappingViewport#9e1c7 relayoutBoundary=up14 RenderBox/颤振( 6704):另一个异常被抛出:RenderBox未布局: RenderIgnorePointer#0105f relayoutBoundary=up13 RenderBox油漆I/颤振( 6704):抛出了另一个异常: RenderBox未被部署: RenderSemanticsAnnotations#cdf64 relayoutBoundary=up12 RenderBox油漆I/颤振( 6704):另一个异常被抛出: RenderBox未布局: RenderPointerListener#8301a relayoutBoundary=up11 RenderBox laid /颤振( 6704):另一个异常被抛出: RenderBox未布局: RenderSemanticsGestureHandler#89bf4 relayoutBoundary=up10 RenderBox油漆I/颤振(6704);抛出了另一个异常:RenderBox未布局:_RenderScrollSemantics#6bd35 relayoutBoundary=up9需要--油漆I/颤振( 6704):抛出了另一个异常:RenderBox未布局: RenderRepaintBoundary#417b1 relayoutBoundary=up8需要-油漆I/颤振( 6704):另一个异常被抛出: RenderBox未被布局: RenderCustomPaint#97f18 relayoutBoundary=up7 RenderBox was /颤振( 6704):另一个异常被抛出: RenderBox未被布局: RenderRepaintBoundary#df728 relayoutBoundary=up6需求-油漆I/颤振( 6704):另一个异常被抛出: RenderBox未被部署: RenderFlex#44487 relayoutBoundary=up5需要-油漆I/颤振( 6704):另一个异常被抛出:RenderBox未被部署: RenderFlex#99d5f relayoutBoundary=up4需要-油漆I/颤振( 6704):另一个例外被抛出:引发:'package:flutter/src/rendering/sliver_multi_box_adaptor.dart':失败断言:第443行pos 12:‘Failed .assertion’:不是真。I/颤振( 6704):引发另一个异常: NoSuchMethodError:在null上调用getter 'scrollOffsetCorrection‘。I/debugAssertIsValid( 6704):抛出另一个异常:debugAssertIsValid:方法'debugAssertIsValid‘被调用为null。I/颤振( 6704):引发了另一个异常: NoSuchMethodError:在null上调用了getter 'visible‘。

EN

回答 2

Stack Overflow用户

发布于 2018-11-05 05:44:04

用灵活的Widget包装您的列。

代码语言:javascript
复制
Flexible(
           child: Column(
           children: <Widget>[
票数 2
EN

Stack Overflow用户

发布于 2020-04-23 12:16:28

请记住,每当您使用Row小部件或列小部件时,都必须为所有其他小部件指定一定的大小(小于可用空间),但是如果您不确定大小,那么就给所有小部件指定大小,这需要最小的大小才能看上去很好,对于其他小部件使用扩展小部件。

查看idea的代码

代码语言:javascript
复制
Row(
  children: <Widget>[
    Expanded(
      //Widget that is long and can cause overflow
      child: LongWidget(),
    ),
    //Give definite Size to this widget
    FixedSizedWidget()
  ],
),                               
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53148038

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档