簡體   English   中英

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

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

在此處輸入圖片說明

我是 flutter 的新手,或者編程要清楚。 我正在學習一門課程,與講師一樣,該應用程序為他工作,但是當我嘗試運行它時,出現此錯誤。

編輯:嘗試將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( )是為單個孩子(你有多個)

考慮將您的Column (children : [...])替換為

ListView(

   children: [...]

);

而不是在SingleChildScrollView()包裝 Column 這樣你就不會在路上遇到問題🙂

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM