0

Sorry because I don't know how to explain this behavior exactly in English. So I give a gif image for easy understanding.

I want to avoid/ prevent seeing white background when scrolling over the top of SingleChildScrollView.

These are my code for this behavior:

@override
 Widget build(BuildContext context) {
 return Scaffold(
 body: SingleChildScrollView(
 child: Container(
 color: Colors.amberAccent,
 height: LayoutUtils.getScreenHeight(context) + 1000, // Just get screen height and plus 1000 units
 )),
 );

Does anyone know how to fix it? And please correct my question to make sense. Thank you in advance.

enter image description here

Kaushik Chandru
18k4 gold badges24 silver badges44 bronze badges
asked Jul 10, 2022 at 13:53
3
  • How about making your Scaffold background color to the same Colors.amberAccent? Commented Jul 10, 2022 at 13:57
  • hmmmm try physic alwaysScrollablePhysics or NestScrollablePhysic to avoid a scrolling like bouncing Commented Jul 10, 2022 at 13:58
  • I use physics : ClampingScrollPhysics() as @Kaushik Chandru suggest and it work like a charm. Commented Jul 10, 2022 at 18:38

1 Answer 1

6

To the SingleChildScrollView add

physics : ClampingScrollPhysics(),

For more info about scrollphysics check this

answered Jul 10, 2022 at 14:14
Sign up to request clarification or add additional context in comments.

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.