I was trying to show a list of items with the following code, I've tried to wrap this Column
with Expanded
but getting the same error.
class QuizDoneByStudent extends StatelessWidget {
const QuizDoneByStudent({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
var size = MediaQuery.of(context).size;
return Scaffold(
backgroundColor: kDarkGrey2,
body: SafeArea(
child: Container(
child: Column(
children: [
Stack(
clipBehavior: Clip.none,
children: [
Container(
height: size.height * .2,
decoration: BoxDecoration(
image: DecorationImage(
image:
NetworkImage("https://imgur.com/Mr6Rozm.png"))),
),
Positioned(
bottom: -20,
left: 20,
child: CircleAvatar(
radius: 35,
backgroundColor: kLightGreyColor,
backgroundImage:
NetworkImage("https://i.imgur.com/MGcuXst.png"),
),
),
Positioned(
bottom: -33,
left: 100,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"DonaldTrump",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 20),
),
SizedBox(
height: 10,
),
Text(
"@fintory",
style: TextStyle(
color: Colors.white,
),
)
],
),
)
],
),
SizedBox(
height: 50,
),
PostQuizStatListView()
],
),
),
),
);
}
}
class PostQuizStatListView extends StatelessWidget {
const PostQuizStatListView({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: ListView.separated(
shrinkWrap: true,
itemBuilder: (BuildContext context, int index) {
return PostQuizStat();
},
separatorBuilder: (BuildContext context, int index) => SizedBox(
height: 10,
),
itemCount: 5),
);
}
}
class PostQuizStat extends StatefulWidget {
const PostQuizStat({
Key? key,
}) : super(key: key);
@override
_PostQuizStatState createState() => _PostQuizStatState();
}
class _PostQuizStatState extends State<PostQuizStat> {
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
border: Border.all(color: kLightGreyColor),
borderRadius: BorderRadius.circular(15)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
CachedNetworkImage(
placeholder: (context, url) =>
Image.asset("assets/images/post_placeholder.png"),
imageUrl: "https://imgur.com/uHZ3Mim.png",
),
SizedBox(
width: 10,
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"The Future of sdsfd sd ffsdf sdfsdf d ",
style:
TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
),
SizedBox(
height: 5,
),
Text(
"5 - 8 - 2021 14:30",
style: TextStyle(color: Colors.white),
)
],
),
SizedBox(
width: 10,
),
Text(
"88%",
style: TextStyle(
color: Colors.white, fontWeight: FontWeight.bold, fontSize: 30),
)
],
),
);
}
}