Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

help me create a conditional breakpoint for this code in dart. import 'package:flutter / material . dart'; import 'package:google _ fonts / google _ fonts.dart';

help me create a conditional breakpoint for this code in dart. import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:adv_project/widgets/answer_button.dart';
import 'package:adv_project/data/questions.dart';
class QuestionsScreen extends StatefulWidget {
const QuestionsScreen({
super.key,
required this.onSelectAnswer,
});
final void Function(String answer) onSelectAnswer;
@override
State createState(){
return _QuestionsScreen();
}
}
class _QuestionsScreen extends State {
var currentQuestionIndex =0;
answerQuestion(String selectedAnswer){
widget.onSelectAnswer(selectedAnswer);
// currentQuestionIndex = currentQuestionIndex +1;
// currentQuestionIndex +=1;
setState((){
currentQuestionIndex++; // increments the value by 1
});
}
@override
Widget build(context){
final currentQuestion = questions[currentQuestionIndex];
return SizedBox(
width: double.infinity,
child: Container(
margin: const EdgeInsets.all(40),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Center(
child: Text(
currentQuestion.text,
style: GoogleFonts.lato(
color: const Color.fromARGB(255,235,217,255),
fontSize: 24,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
),
const SizedBox(height: 30),
...currentQuestion.shuffledAnswers.map((option){
return AnswerButton(
answerText: option,
onTap: (){
answerQuestion(option);
},
);
}),
],
),
),
);
}
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Science Project Ideas In Health Care Volume 1

Authors: Zemelak Goraga

1st Edition

B0CPX2RWPF, 979-8223791072

More Books

Students also viewed these Databases questions

Question

What is Aufbau's rule explain with example?

Answered: 1 week ago

Question

At what level(s) was this OD intervention scoped?

Answered: 1 week ago