'if and else else condition both condition is running problem
I am able to filter date according to selected date of calendar but along with the filter icons are also showing which should not be shown where list is shown need help.This is the code everything is working but the problem is i am getting list also the cannot show list icon also meaning else icon are also being shown. when list is there else condition should not be shown but it is also showing meaning both if and else condition is running at the same time
SingleChildScrollView(
child: Column(
children: homeworkSnapshot.data.map((homework){
if(dateController.text == homework.savedHomeworkSubmissionDate){
return Padding(
padding: const EdgeInsets
.symmetric(vertical: 3),
child: SizedBox(
width: double.infinity,
// height: MediaQuery.of(context).size.height*0.105,
child: GestureDetector(
onTap: () {
Navigator.of(context)
.pushReplacement(
MaterialPageRoute(
builder: (ctx)=>HomeworkPostScreen(
savedHomeworkId: homework
.savedHomeworkId,
savedHomeworkCName: homework
.savedHomeworkClassName,
savedHomeworkSName: homework
.savedHomeworkSectionName,
savedHomeworkSubName: homework
.savedHomeworkSubjectName,
savedHomeworkT: homework
.savedHomeworkTitle,
savedHomeworkL: homework
.link,
savedHomeworkD: homework
.savedHomeworkDetail,
savedHomeworkImgs: homework
.savedHomeworkImage,
savedHomeworkSD: homework
.savedHomeworkSubmissionDate,
)));
},
child: Card(
elevation: 0.0,
child: Padding(
padding: const EdgeInsets
.symmetric(
horizontal: 10,
vertical: 5),
child: Row(
crossAxisAlignment: CrossAxisAlignment
.start,
children: [
Padding(
padding: const EdgeInsets
.symmetric(
horizontal: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment
.start,
children: [
const SizedBox(
height: 5),
Text(homework
.savedHomeworkTitle),
const SizedBox(
height: 50),
Row(
children: [
const Text(
"Deadline :",
style: TextStyle(
color: Colors
.black38),),
Text(
homework
.savedHomeworkSubmissionDate,
style: const TextStyle(
color: Colors
.black38),)
],
)
],
),
),
const SizedBox(
width: 70),
Container(
height: 100,
width: 1,
color: Colors.blue,
),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(homework.savedHomeworkSubjectName ??" ",
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14),
overflow: TextOverflow.clip,),
const SizedBox(
height: 20),
Text(
"Class: ",
style: TextStyle(
color: ColorCombination(0).appBarColor),),
Text(
"${homework.savedHomeworkClassName ??" "}(${homework.savedHomeworkSectionName ??" "})",
style: TextStyle(
color: ColorCombination(0).appBarColor),),
],
),
),
)
],
),
),
),
),
),
);
}else{
return Padding(
padding: const EdgeInsets.symmetric(vertical: 200),
child: Center(
child: Column(
children: [
Image.asset("icons/empty_homework_icon.png"),
const SizedBox(height: 30),
const Text("Homework List Not Found",style: TextStyle(color: Colors.blue,fontWeight: FontWeight.bold),),
const SizedBox(height: 10),
const Text("Looks like there are no homework record for the",style: TextStyle(color: Colors.black38),),
const Text("day",style: TextStyle(color: Colors.black38),)
],
),
),
);
}
}).toList(),
),
);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
