簡體   English   中英

我需要得到問題和答案,這些問題和答案在我的地圖列表中,其他地圖由 class 和構造函數制成

[英]I Need to get questions and answer which is in my list of maps ad others made of class and constructor

我需要在列表視圖生成器中獲取問題和答案,該生成器位於我的地圖列表中,其他地圖由 class 和構造函數制成。 請幫我找出答案

ListView.builder(
                itemCount: examlist.length,
                itemBuilder: (BuildContext context, int index) {
                  return Card(
                    child: ListTile(
                      contentPadding: EdgeInsets.all(20),
                      title: Text(
                        examlist[index].title,
    
                        **//HERE I NEED TO PUT QUESTIONS
                        //HERE I NEED TO PUT ANSWERS**
                      ),
                      subtitle: Text(
                        examlist[index].desc, 
                      ),
                    ),
                  );
                },
              ),
            );

這是我的列表,其中包含根據 class 和構造函數的描述和標題以及問題和答案

List<Examlist> examlist = [
        Examlist(
            title: 'G.C.E A/L E-Tech Tamil - 2022',
            desc:
                'GCE A/L ICT  Unit Exam Papers Tamil Medium 2020  (New Syllabus). You can download using the following link Below. It’s free to download.',
            quesans: [
              {
                'question':
                    'Confidence intervals are useful when trying to estimate',
                'answer': 'unknown parameters',
              }
            ]),
        Examlist(
            title: 'G.C.E O/L Islam Tamil - 2022',
            desc:
                'GCE A/L ICT  Unit Exam Papers Tamil Medium 2020  (New Syllabus). You can download using the following link Below. It’s free to download.',
            quesans: [
              {
                'question':
                    'Confidence intervals are useful when trying to estimate',
                'answer': 'unknown parameters',
              }
            ]),
      ];

快速回答者

 ListView.builder(
                itemCount: examlist.length,
                itemBuilder: (BuildContext context, int index) {
                  final questionsList = examlist[index].quesans;
                  
                  for (var i = 0; i < questionsList.length; i++) {
                    q = questionsList[question];
                    a = questionsList[answer];
                    // you can get each question and answer here 
                    //but this bad decision. 
                    // you should move this to model or controller if you want
                  }
                  return Card(
                    child: ListTile(
                      contentPadding: EdgeInsets.all(20),
                      title: Text(
                        examlist[index].title,
    
                        **//HERE I NEED TO PUT QUESTIONS
                        //HERE I NEED TO PUT ANSWERS**
                      ),
                      subtitle: Text(
                        examlist[index].desc, 
                      ),
                    ),
                  );
                },
              ),
            );

暫無
暫無

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

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