简体   繁体   English

底部溢出 224 像素的 RenderFlex

[英]A RenderFlex overflowed by 224 pixels on the bottom

How to fix the following error?如何修复以下错误?

A RenderFlex overflowed by 224 pixels on the bottom.一个 RenderFlex 在底部溢出了 224 个像素。

on the Column widget在列小部件上

@override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Read message'),
      ),
      body: Column( //the error is here
        children: [
          Padding(
            padding: const EdgeInsets.all(20.0).copyWith(bottom: 10),
            child: Row( ...

在此处输入图像描述

Wrap your Column with a SingleChildScrollViewSingleChildScrollView包裹你的Column

Depending on the device screen, these widgets can overflow, there are few solutions to handle it.根据设备屏幕,这些小部件可能会溢出,处理它的解决方案很少。

  1. Use Column wrapped in SingleChildScrollView使用包含在 SingleChildScrollView 中的 Column

SingleChildScrollView( child: Column(children: children), ) SingleChildScrollView(子:列(子:子),)

  1. Use ListView使用列表视图

ListView( children: children ) ListView(儿童:儿童)

  1. Use combination of both Column and ListView(you should use Expanded/Flexible, or give a fixed height to the ListView when doing so).使用 Column 和 ListView 的组合(你应该使用 Expanded/Flexible,或者这样做时给 ListView 一个固定的高度)。

Column( children: [...children.take(2).toList(), // show first 2 children in Column Expanded( child: ListView( children: children.getRange(3, children.length).toList(), ), // And rest of them in ListView ), ], ) Column( children: [...children.take(2).toList(), // 显示 Column Expanded(child: ListView( children: children.getRange(3, children.length).toList(), 中的前 2 个子项) ), // 以及 ListView 中的 rest ), ], )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM