简体   繁体   English

RenderFlex 在底部溢出了 299423 像素。 问题似乎是由 Column 提出的

[英]A RenderFlex overflowed by 299423 pixels on the bottom. problem seems to be made by the Column

在此处输入图片说明

I'm new to flutter , or programming to be clear .我是 flutter 的新手,或者编程要清楚。 I was following a course , doing the same as the Instructor , the app worked for him , but when i try to run it ,this error shows up .我正在学习一门课程,与讲师一样,该应用程序为他工作,但是当我尝试运行它时,出现此错误。

Edit : tried to change Column to ListView but an error showed up .编辑:尝试将Column更改为ListView但出现错误。

 [![// @dart=2.9

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import './question.dart';
import './answer.dart';



class Quiz extends StatelessWidget {
  final List<Map<String, Object>> questions;
  final int questionIndex;
  final Function answerQuestion;

  Quiz(
      {@required this.questions,
      @required this.answerQuestion,
      @required this.questionIndex});

  @override
  Widget build(BuildContext context) {
    return ListView(
      children: \[
        Question(
          questions\[questionIndex\]\['questionText'\],
        ),
        ...(questions\[questionIndex\]\['answers'\] as List<Map<String, Object>>)
            .map((answer) {
          return Answer(() => answerQuestion(answer\['score'\]), answer\['text'\]);
        }).toList()
      \],
    );
  }
}][2]][2]

SingleChildScrollView( ) is for is for single child (and you have multiple) SingleChildScrollView( )是为单个孩子(你有多个)

Consider replacing your Column (children : [...]) with考虑将您的Column (children : [...])替换为

ListView(

   children: [...]

);

rather than wrapping Column in SingleChildScrollView() this way you won't run into issues down the road 🙂而不是在SingleChildScrollView()包装 Column 这样你就不会在路上遇到问题🙂

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

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