I'm new to flutter , or programming to be clear . 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 .
[![// @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)
Consider replacing your Column (children : [...])
with
ListView(
children: [...]
);
rather than wrapping Column in SingleChildScrollView()
this way you won't run into issues down the road 🙂
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.