Reputation: 1151
[on web] tried to fit some widgets inside a FittedBox
like this :
FittedBox(
fit: BoxFit.scaleDown,
child: AnimatedContainer(...)
)
but screen and console show only this message :
there's nothing else in the console
what's the next step here ? :D
Upvotes: 28
Views: 34162
Reputation: 586
I got this error because of my bloc provider
@override
Widget build(BuildContext context) {
return BlocProvider(
your build method should return BlocProvider first !
Upvotes: 0
Reputation: 1
if the error appears when you have clicked button at the bottom sheet, just set enabledrag to false.
builder: (context) => BottomSheet(
onClosing: () {},
enableDrag: false,
Upvotes: 0
Reputation: 79
Just answering this because none of the Answers above worked for me:
My IDE (VSCode) changed the initState() method to async because I accidentally wrote a method as "await" and then just tapped the autoerrorfix
Upvotes: 0
Reputation: 306
I encountered this error as a result of incorporating multiple Consumer widgets of the same model Provider. Solution was to follow Provider package guidelines of incorporating one Consumer widget at the top of the widget tree where the state object is to be shared from.
Upvotes: 0
Reputation: 51
I was getting this error because somewhere in my code, I applied a wrong widget mistakenly, and that was the same stateless widget that I was writing. To make it more clear:
stateless widget - MyWidget //For example
.
.
.
Now somewhere in between the code:
Column(
children: [
MyWidget(), //This went wrong, I was supposed to Use some other widget.
]);
Upvotes: 3
Reputation: 17576
I was getting this error inside of a CustomScrollView because one of my widgets wasn't inside of a SliverToBoxAdapter.
SliverToBoxAdapter(
child: Row(
children: [
Text('Activity',
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 18),),
],
),
)
I'd just make sure all widgets in your sliver list are actually slivers.
Upvotes: 25
Reputation: 1151
More Info was provided by the framework after a little messing around with the code , like extra children , random sizes to parents . . .
Error >> ... object was given an infinite size during layout
ultimately some like this worked :
FittedBox(
fit: BoxFit.scaleDown,
child: Container(
height: MediaQuery.of(context).size.height * .65,
child: AnimatedContainer(...)
)
Upvotes: 5