0

I am learning flutter right now and my SinglePageScrollView is not working, Please help me out, I am trying to solve it since 10 hours, I am just brewww right now.

This is my code btw

SingleChildScrollView(
 child: Container(
 child: Column(
 children: [
 Column(
 children: [
 Column(
 children: [
 Container(
 width: MediaQuery.of(context).size.width,
 child: Image.asset("assets/images/img.jpg"),
 ),
 Container(
 margin: const EdgeInsets.only(top: 5),
 alignment: Alignment.center,
 width: MediaQuery.of(context).size.width,
 child: const Text(
 "Hii, This is what i probably uploaded",
 style: TextStyle(
 fontSize: 20,
 fontWeight: FontWeight.bold,
 ),
 ),
 ),
 Divider(color: Colors.black)
 ],
 )
 ],
 ),
 Column(
 children: [
 Column(
 children: [
 Container(
 width: MediaQuery.of(context).size.width,
 child: Image.asset("assets/images/img.jpg"),
 ),
 Container(
 margin: const EdgeInsets.only(top: 5),
 alignment: Alignment.center,
 width: MediaQuery.of(context).size.width,
 child: const Text(
 "Hii, This is what i probably uploaded",
 style: TextStyle(
 fontSize: 20,
 fontWeight: FontWeight.bold,
 ),
 ),
 ),
 Divider(color: Colors.black)
 ],
 )
 ],
 ),
 ],
 ),
 ),
 )

Btw, SingleChildScrollView is the child of Row widget

This Screenshot can explain more

asked Dec 17, 2022 at 5:57
2
  • Check this stackoverflow.com/questions/54799003/… out. It might help Commented Dec 17, 2022 at 6:01
  • Add container height as "MediaQuery.of(context).size.height" Commented Dec 17, 2022 at 6:25

2 Answers 2

1

Your code is working perfectly, it has only one small mistake,

SingleChildScrollview always need some height means in how much area we want scroll our child widgets.

You’ve 2 widgets in your Column

  1. Row
  2. SingleChildScrollview

You want to scroll your child widgets in Column except Row area, so wrap it within Expanded

Expanded(
 child: SingleChildScrollView(
....
answered Dec 17, 2022 at 9:41
Sign up to request clarification or add additional context in comments.

Comments

0

Row must have children or you have an unclosed parenthesis in the container.

return Scaffold(
 appBar: AppBar(),
 body: Column(
 children: [
 Row(
 children: [
 SingleChildScrollView(
 child: Container(),
 )
 ],
 )
 ],
 ),
);
return Scaffold(
 appBar: AppBar(),
 body: Column(
 children: [
 Row(),
 SingleChildScrollView(
 child: Container(),
 ),
 ],
 ),
);
answered Dec 17, 2022 at 6:21

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.