I want to add an image in the body: in this code
import 'package:flutter/material.dart';
import 'qs.dart';
import 'answer.dart';
class body extends StatelessWidget {
final List questions;
final int _questionindex;
final VoidCallback _answerQuestion;
body(this.questions, this._questionindex, this._answerQuestion);
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text(
'Dragons be here',
style: TextStyle(
fontFamily: "Arial",
fontSize: 35,
fontWeight: FontWeight.bold,
),
),
titleSpacing: 1.0,
centerTitle: true,
),
body: SizedBox(
width: double.infinity,
child: _questionindex < questions.length
? Column(
children: <Widget>[
qs(
(questions[_questionindex]['questiontext']) as String,
),
...((questions[_questionindex]['answers']) as List<String>)
.map((answer) {
return Answer(_answerQuestion, answer);
}).toList()
],
)
: Center(
child: Text(
'Good boi you just finished da quiz',
textAlign: TextAlign.center,
),
),
),
);
}
}
I tried all of the code from How do I Set Background image in Flutter? I have done all of the suggestions from other StackOverflow answers and it doesn't work. THANKS!