Reputation: 935
Why this code is not correct?
I have this error:
RenderBox was not laid out: RenderRepaintBoundary#681d3 relayoutBoundary=up1 NEEDS-PAINT 'package:flutter/src/rendering/box.dart': Failed assertion: line 1930 pos 12: 'hasSize'
The relevant error-causing widget was Scaffold lib…\rank\rankView.dart:23
Should I define size for scaffold?
SafeArea(
child: Scaffold(
resizeToAvoidBottomInset: false,
body: SingleChildScrollView(
child: Stack(children: <Widget>[
Positioned(
top: 550,
left: 8,
right: 8,
bottom: 0,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
for (final result in controller.results)
Container(height: 50, color: Colors.black),
]))
Upvotes: 0
Views: 1042
Reputation: 251
Why you are using scaffold inside a safearea. If you have this as a screen. they you can simply return a scaffold
and add safearea
as a child of scaffold.
return Scaffold(
body: SafeArea(), );
like this
So better you can use container position it according to. and then add a child column
to the container.
So your code might look like this,
Scaffold(
resizeToAvoidBottomInset: false,
body: SafeArea(
child: SingleChildScrollView(
child: Container(
//you need to position from the top 550 and left right 8 units
//that you can do by the margin or padding:
margin: EdgeInsets.only(top: 550, left: 8, right: 8),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
for (final result in controller.results)
Container(height: 50, color: Colors.black),
],
),
),
),
),
);
That should work perfectly.
Upvotes: 1