I'm having a problem which i have been trying to solve for the last 3 hours but it's pointless.
Now get to the point, I'm making an custom CupertinoDialog, everything looks good to me. Idk why is this happening. I've try multiple method on Stackoverflow but it's pointless. I hope someone can save me from this bug.
======== Exception caught by rendering library =====================================================
The following assertion was thrown during performLayout():
RenderBox was not laid out: RenderIntrinsicWidth#b0789 relayoutBoundary=up5 NEEDS-PAINT
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1930 pos 12: 'hasSize'
Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=2_bug.md
The relevant error-causing widget was:
SimpleDialog file:///D:/FlutterProject/airchecker/lib/main.dart:50:29
When the exception was thrown, this was the stack:
#2 RenderBox.size (package:flutter/src/rendering/box.dart:1930:12)
#3 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:117:21)
#4 RenderObject.layout (package:flutter/src/rendering/object.dart:1779:7)
#5 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#6 RenderCustomPaint.performLayout (package:flutter/src/rendering/custom_paint.dart:545:11)
...
The following RenderObject was being processed when the exception was fired: _RenderInkFeatures#383cc relayoutBoundary=up4 NEEDS-PAINT
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(280.0<=w<=331.4, 0.0<=h<=561.6)
... size: MISSING
RenderObject: _RenderInkFeatures#383cc relayoutBoundary=up4 NEEDS-PAINT
needs compositing
parentData: <none> (can use size)
constraints: BoxConstraints(280.0<=w<=331.4, 0.0<=h<=561.6)
size: MISSING
... child: RenderIntrinsicWidth#b0789 relayoutBoundary=up5 NEEDS-PAINT
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(280.0<=w<=331.4, 0.0<=h<=561.6)
... size: MISSING
... stepWidth: 56.0
... stepHeight: null
... child: RenderConstrainedBox#9892a NEEDS-LAYOUT NEEDS-PAINT
... needs compositing
... parentData: <none>
... constraints: MISSING
... size: MISSING
... additionalConstraints: BoxConstraints(280.0<=w<=Infinity, 0.0<=h<=Infinity)
... child: RenderFlex#bca83 NEEDS-LAYOUT NEEDS-PAINT
... needs compositing
... parentData: <none>
... constraints: MISSING
... size: MISSING
... direction: vertical
... mainAxisAlignment: start
... mainAxisSize: min
... crossAxisAlignment: stretch
... verticalDirection: down
... child 1: RenderPadding#27dc0 NEEDS-LAYOUT NEEDS-PAINT
... parentData: offset=Offset(0.0, 0.0); flex=null; fit=null
... constraints: MISSING
... size: MISSING
... padding: EdgeInsets(24.0, 24.0, 24.0, 0.0)
... textDirection: ltr
... child 2: RenderRepaintBoundary#dda4c NEEDS-LAYOUT NEEDS-PAINT
... needs compositing
... parentData: offset=Offset(0.0, 0.0); flex=1; fit=FlexFit.loose
... constraints: MISSING
... size: MISSING
... usefulness ratio: no metrics collected yet (never painted)
====================================================================================================
Here's my code:
void showAlertDialog(BuildContext context, String title, String content) {
showCupertinoDialog(
context: context,
builder: (builder) => SimpleDialog(
title: title.text.semiBold.make().centered(),
children: [
content.text.make().centered().expand(),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Container(
width: 100,
child: OutlinedButton(
style: OutlinedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(4)),
side: BorderSide(color: Colors.red, width: 1.0), // HERE
),
side:
BorderSide(color: Colors.red, width: 1.0)), // AND HERE
onPressed: () {},
child: 'Cancel'.text.color(Colors.red).make(),
),
),
Container(
width: 100,
child: TextButton(
onPressed: () {},
child: 'OK'.text.white.make().px(15),
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Colors.red),
),
),
),
],
),
],
),
);
}
#override
Widget build(BuildContext context) {
return Scaffold(
body: Padding(
padding: const EdgeInsets.all(50.0),
child: GestureDetector(
onTap: (){
showAlertDialog(context, "tit", "Content");
},
child: ClipPath(
clipper: MyClip(),
child: Container(
width: 200,
height: 300,
color: Colors.lightGreenAccent,
),
),
),
),
);
}
}
#Nobody,
As pskink mentioned, try to use Text(content), I just replaced
title: title.text.semiBold.make().centered()
for
title: Text(title)
and
content.text.make().centered().expand()
for
Row(mainAxisAlignment: MainAxisAlignment.center,
children: [Text(content)],)
and it works, I've never used velocity_x, but it seems that's the problem
Related
Since i implemnetd the FittedBox with a Full width Image the app tells me to that i have a render error but i cant fix it.
All the other widgets have a expanded function and it all worked fine until i inserted the banner.
But even if i make it as small as 5 pixel the app tells me the same error..
How can i fix that?
I assume its the fitted box.
The Error:
════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderFittedBox#d209c relayoutBoundary=up3 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
package:flutter/…/rendering/box.dart:1
Failed assertion: line 2001 pos 12: 'hasSize'
The relevant error-causing widget was
Column
lib/…/event_details_screen/match_details.dart:45
The following RenderObject was being processed when the exception was fired: RenderFittedBox#d209c relayoutBoundary=up3 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
RenderObject: RenderFittedBox#d209c relayoutBoundary=up3 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
constraints: BoxConstraints(0.0<=w<=428.0, 0.0<=h<=Infinity)
size: MISSING
fit: fitWidth
alignment: Alignment.center
textDirection: ltr
child: RenderSemanticsAnnotations#a5a83 relayoutBoundary=up4 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: (can use size)
constraints: BoxConstraints(unconstrained)
size: Size(0.0, 0.0)
child: RenderImage#d2457 relayoutBoundary=up5 NEEDS-PAINT
parentData: (can use size)
constraints: BoxConstraints(unconstrained)
size: Size(0.0, 0.0)
image: null
alignment: Alignment.center
invertColors: false
filterQuality: low
class _DefaultDetailsState extends State<DefaultDetails> {
final double padding = EVENT_DETAILS_PADDING;
#override
Widget build(BuildContext context) {
return DetailScreen(
child: _screen(),
);
}
Widget _screen() {
return Column(
children: [
_section(
flex: 4,
child: TournamentTitleSection(
event: widget.event,
host: widget.host,
),
),
FittedBox(
fit: BoxFit.fitWidth,
child: Image.asset('assets/images/ads/mockup_ad.PNG'),
),
_section(
flex: 10,
child: DefaultDetailsSection(
event: widget.event,
host: widget.host,
),
),
_divider(),
_section(
flex: 4,
child: TimesSection(
event: widget.event,
calendarName: _calendarName,
),
),
...
The Widget _section.
Widget _section({Widget? child, int flex = 1}) {
return Expanded(
flex: flex,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: padding),
child: child ?? const SizedBox(),
),
);
}
I allready tried to wrap it in a Expanded Widget and also sized boy but nothing worked.
I notify a very strange bug in my Flutter app. I'm using a ListView with an itemExtend value. When navigating inside the app everything is working fine – no error messages in the console. But after a Hot Reload, for example by editing and saving the code on the file on which the ListView is placed, I get many RenderRepaintBoundary errors.
This is my ListView:
return ListView.builder(
padding: EdgeInsets.only(top: 25, bottom: 20),
shrinkWrap: true,
itemExtent: 95, // Error only appears if I add itemExtent
physics: ClampingScrollPhysics(),
itemCount: entriesController.guestbookEntries.length,
itemBuilder: (BuildContext context, int index) {
return GestureDetector(
onLongPress: () async {
// Some stuff
},
child: Text("Test Widget")
);
},
);
After Hot Reload I get the following error messages in the console (But the app works as expected):
[Easy Localization] Build [Easy Localization] Init Localization
Delegate [Easy Localization] Init provider
════════ Exception caught by rendering library
═════════════════════════════════ The following _CastError was thrown
during performLayout(): Null check operator used on a null value
The relevant error-causing widget was ListView When the exception was
thrown, this was the stack
#0 RenderSliverFixedExtentBoxAdaptor.performLayout
#1 RenderObject.layout
#2 RenderSliverEdgeInsetsPadding.performLayout
#3 RenderSliverPadding.performLayout
#4 RenderObject.layout ... The following RenderObject was being processed when the exception was fired:
RenderSliverFixedExtentList#b073b relayoutBoundary=up11 NEEDS-LAYOUT
NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE RenderObject:
RenderSliverFixedExtentList#b073b relayoutBoundary=up11 NEEDS-LAYOUT
NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
needs compositing
parentData: paintOffset=Offset(0.0, 25.0) (can use size)
constraints: SliverConstraints(AxisDirection.down, GrowthDirection.forward, ScrollDirection.idle, scrollOffset: 0.0,
remainingPaintExtent: Infinity, crossAxisExtent: 390.0,
crossAxisDirection: AxisDirection.right, viewportMainAxisExtent:
Infinity, remainingCacheExtent: Infinity, cacheOrigin: 0.0)
geometry: SliverGeometry(scrollExtent: 760.0, paintExtent: 760.0, maxPaintExtent: 760.0, cacheExtent: 760.0)
scrollExtent: 760.0
paintExtent: 760.0
maxPaintExtent: 760.0
cacheExtent: 760.0
currently live children: 0 to 7
child with index 0: RenderIndexedSemantics#56371 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
needs compositing
parentData: index=0; layoutOffset=0.0
constraints: BoxConstraints(w=390.0, h=95.0)
semantic boundary
size: Size(390.0, 95.0)
index: 0
child: RenderRepaintBoundary#1056f NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
needs compositing
parentData: (can use size)
constraints: BoxConstraints(w=390.0, h=95.0)
layer: OffsetLayer#9f74a
engine layer: OffsetEngineLayer#9b21b
offset: Offset(0.0, 25.0)
size: Size(390.0, 95.0)
metrics: 83.3% useful (1 bad vs 5 good)
diagnosis: this is a useful repaint boundary and should be kept
child: RenderSemanticsGestureHandler#c0c8b NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: (can use size)
constraints: BoxConstraints(w=390.0, h=95.0)
size: Size(390.0, 95.0)
gestures: long press
child: RenderPointerListener#c4b22 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: (can use size)
constraints: BoxConstraints(w=390.0, h=95.0)
size: Size(390.0, 95.0)
behavior: deferToChild
listeners: down
child with index 1: RenderIndexedSemantics#c082a NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
needs compositing
parentData: index=1; layoutOffset=95.0
constraints: BoxConstraints(w=390.0, h=95.0)
semantic boundary
size: Size(390.0, 95.0)
index: 1
child: RenderRepaintBoundary#f5bbf NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
needs compositing
parentData: (can use size)
constraints: BoxConstraints(w=390.0, h=95.0)
layer: OffsetLayer#003b7
engine layer: OffsetEngineLayer#75c0b
offset: Offset(0.0, 120.0)
size: Size(390.0, 95.0)
metrics: 83.3% useful (1 bad vs 5 good)
diagnosis: this is a useful repaint boundary and should be kept
child: RenderSemanticsGestureHandler#eee56 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: (can use size)
constraints: BoxConstraints(w=390.0, h=95.0)
size: Size(390.0, 95.0)
gestures: long press
child: RenderPointerListener#82ca0 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: (can use size)
constraints: BoxConstraints(w=390.0, h=95.0)
size: Size(390.0, 95.0)
behavior: deferToChild
listeners: down
child with index 2: RenderIndexedSemantics#dc0db NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
needs compositing
parentData: index=2; layoutOffset=190.0
constraints: BoxConstraints(w=390.0, h=95.0)
semantic boundary
size: Size(390.0, 95.0)
index: 2
child: RenderRepaintBoundary#394b9 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
needs compositing
parentData: (can use size)
constraints: BoxConstraints(w=390.0, h=95.0)
layer: OffsetLayer#19e8a
engine layer: OffsetEngineLayer#11d00
offset: Offset(0.0, 215.0)
size: Size(390.0, 95.0)
metrics: 83.3% useful (1 bad vs 5 good)
diagnosis: this is a useful repaint boundary and should be kept
child: RenderSemanticsGestureHandler#0a954 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: (can use size)
constraints: BoxConstraints(w=390.0, h=95.0)
size: Size(390.0, 95.0)
gestures: long press
child: RenderPointerListener#d9fec NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: (can use size)
constraints: BoxConstraints(w=390.0, h=95.0)
size: Size(390.0, 95.0)
behavior: deferToChild
listeners: down
child with index 3: RenderIndexedSemantics#7cad9 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
needs compositing
parentData: index=3; layoutOffset=285.0
constraints: BoxConstraints(w=390.0, h=95.0)
semantic boundary
size: Size(390.0, 95.0)
index: 3
child: RenderRepaintBoundary#6e0bd NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
needs compositing
parentData: (can use size)
constraints: BoxConstraints(w=390.0, h=95.0)
layer: OffsetLayer#cacc4
engine layer: OffsetEngineLayer#8785f
offset: Offset(0.0, 310.0)
size: Size(390.0, 95.0)
metrics: 83.3% useful (1 bad vs 5 good)
diagnosis: this is a useful repaint boundary and should be kept
child: RenderSemanticsGestureHandler#0f21d NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: (can use size)
constraints: BoxConstraints(w=390.0, h=95.0)
size: Size(390.0, 95.0)
gestures: long press
child: RenderPointerListener#90d32 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: (can use size)
constraints: BoxConstraints(w=390.0, h=95.0)
size: Size(390.0, 95.0)
behavior: deferToChild
listeners: down
child with index 4: RenderIndexedSemantics#98e3a NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
needs compositing
parentData: index=4; layoutOffset=380.0
constraints: BoxConstraints(w=390.0, h=95.0)
semantic boundary
size: Size(390.0, 95.0)
index: 4
child: RenderRepaintBoundary#4b651 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
needs compositing
parentData: (can use size)
constraints: BoxConstraints(w=390.0, h=95.0)
layer: OffsetLayer#4d349
engine layer: OffsetEngineLayer#3ac9d
offset: Offset(0.0, 405.0)
size: Size(390.0, 95.0)
metrics: 83.3% useful (1 bad vs 5 good)
diagnosis: this is a useful repaint boundary and should be kept
child: RenderSemanticsGestureHandler#d08c0 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: (can use size)
constraints: BoxConstraints(w=390.0, h=95.0)
size: Size(390.0, 95.0)
gestures: long press
child: RenderPointerListener#4d447 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: (can use size)
constraints: BoxConstraints(w=390.0, h=95.0)
size: Size(390.0, 95.0)
behavior: deferToChild
listeners: down
child with index 5: RenderIndexedSemantics#3c29c NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
needs compositing
parentData: index=5; layoutOffset=475.0
constraints: BoxConstraints(w=390.0, h=95.0)
semantic boundary
size: Size(390.0, 95.0)
index: 5
child: RenderRepaintBoundary#95d2d NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
needs compositing
parentData: (can use size)
constraints: BoxConstraints(w=390.0, h=95.0)
layer: OffsetLayer#0a5f6
engine layer: OffsetEngineLayer#48bb1
offset: Offset(0.0, 500.0)
size: Size(390.0, 95.0)
metrics: 83.3% useful (1 bad vs 5 good)
diagnosis: this is a useful repaint boundary and should be kept
child: RenderSemanticsGestureHandler#9d4f2 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: (can use size)
constraints: BoxConstraints(w=390.0, h=95.0)
size: Size(390.0, 95.0)
gestures: long press
child: RenderPointerListener#41da2 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: (can use size)
constraints: BoxConstraints(w=390.0, h=95.0)
size: Size(390.0, 95.0)
behavior: deferToChild
listeners: down
child with index 6: RenderIndexedSemantics#97f8c NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
needs compositing
parentData: index=6; layoutOffset=570.0
constraints: BoxConstraints(w=390.0, h=95.0)
semantic boundary
size: Size(390.0, 95.0)
index: 6
child: RenderRepaintBoundary#43698 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
needs compositing
parentData: (can use size)
constraints: BoxConstraints(w=390.0, h=95.0)
layer: OffsetLayer#4c73b
engine layer: OffsetEngineLayer#cf9c5
offset: Offset(0.0, 595.0)
size: Size(390.0, 95.0)
metrics: 83.3% useful (1 bad vs 5 good)
diagnosis: this is a useful repaint boundary and should be kept
child: RenderSemanticsGestureHandler#a439c NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: (can use size)
constraints: BoxConstraints(w=390.0, h=95.0)
size: Size(390.0, 95.0)
gestures: long press
child: RenderPointerListener#c1b95 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: (can use size)
constraints: BoxConstraints(w=390.0, h=95.0)
size: Size(390.0, 95.0)
behavior: deferToChild
listeners: down
child with index 7: RenderIndexedSemantics#af472 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
needs compositing
parentData: index=7; layoutOffset=665.0
constraints: BoxConstraints(w=390.0, h=95.0)
semantic boundary
size: Size(390.0, 95.0)
index: 7
child: RenderRepaintBoundary#af250 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
needs compositing
parentData: (can use size)
constraints: BoxConstraints(w=390.0, h=95.0)
layer: OffsetLayer#45ab6
engine layer: OffsetEngineLayer#f6a96
offset: Offset(0.0, 690.0)
size: Size(390.0, 95.0)
metrics: 83.3% useful (1 bad vs 5 good)
diagnosis: this is a useful repaint boundary and should be kept
child: RenderSemanticsGestureHandler#aac55 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: (can use size)
constraints: BoxConstraints(w=390.0, h=95.0)
size: Size(390.0, 95.0)
gestures: long press
child: RenderPointerListener#428a8 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: (can use size)
constraints: BoxConstraints(w=390.0, h=95.0)
size: Size(390.0, 95.0)
behavior: deferToChild
listeners: down ════════════════════════════════════════════════════════════════════════════════
Reloaded 67 of 2009 libraries in 683ms.
Do you have an idea what happens here and why without Hot Reload everything works fine? And how to fix such an error? I tried to remove the itemExtend. Then it works and the error does not appear. But without itemExtend I have some flickering in my ListView. Looks like order changing or something else. Its very ugly. Therefore I need to itemExtend to fix it.
If you need a better view of the code context, I send you the code of the entire file. By the way. There are still no gos like handling data inside a build method. Its an old project and I'm on the way to rewrite it entirely. But this things are not responsible for the error. It is interesting, that the error does not appear when I remove "itemExtend". How is that possible?
The entire code:
class GuestGuestbookContent extends StatelessWidget {
GuestGuestbookContent({
Key key,
}) : super(key: key);
GuestbooksController get guestbooksController => Get.find();
EntriesController get entriesController => Get.find();
UsersController get usersController => Get.find();
#override
Widget build(BuildContext context) {
return SliverToBoxAdapter(
child: Container(
padding: EdgeInsets.only(bottom: 50, top: 50),
alignment: Alignment.center,
child: entriesController.obx((state) {
return Column(
children: [
Container(
child: MixinBuilder(
initState: (_) async {
await entriesController.checkGuestbookForUserEntries(
guestbooksController.currentGuestbook.value.id);
},
builder: (_) {
if (entriesController.hasUserEntry.value == true) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding:
const EdgeInsets.only(left: 25.0, right: 25),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text("your_entries",
style: Get.theme.textTheme.headline4)
.tr(),
IconButton(
alignment: Alignment.centerRight,
padding: EdgeInsets.all(0),
icon: Icon(
entriesController.showOwnEntries.value ==
false
? CupertinoIcons.arrow_down
: CupertinoIcons.arrow_up,
color: Get.theme.colorScheme.primary,
size: 20,
),
onPressed: () => entriesController
.showOwnEntries.value =
!entriesController.showOwnEntries.value)
],
),
),
entriesController.showOwnEntries.value == true
? _buildUserEntries()
: Container(),
SizedBox(height: 15),
],
);
} else {
bool isOpen = true;
DateTime startDate;
if (guestbooksController
.currentGuestbook.value.startDate !=
null) {
startDate = DateTime.parse(guestbooksController
.currentGuestbook.value.startDate);
isOpen = startDate.isAtSameMomentAs(DateTime.now()) ||
startDate.isBefore(DateTime.now());
}
if (isOpen) {
return _buildAddEntryButton();
} else {
return Container(
child: Column(
children: [
Image.asset("assets/animations/clock.gif",
width:
context.isTablet ? 400 : Get.width / 2),
SizedBox(
height: 15,
),
Text("guestbook_opens_at").tr(),
SizedBox(height: 5),
Text(
DateFormat(tr("date_format"))
.format(startDate),
style: Get.theme.textTheme.headline1)
],
),
);
}
}
},
),
),
// Alle Einträge
guestbooksController.currentGuestbook.value.isPublic == true ||
_isModerator() == true
? _buildAllEntriesContainer()
: Container(),
],
);
}, onLoading: LoadingSpinner()),
),
);
}
bool _isModerator() {
return usersController.userIsModerator(
userID: usersController.ownUser.value.uid,
guestbook: guestbooksController.currentGuestbook.value);
}
CupertinoButton _buildAddEntryButton() {
return CupertinoButton(
child: Column(
children: [
Icon(
Icons.add,
size: 50,
),
Text(
"create_entry",
style:
TextStyle(color: Get.theme.colorScheme.primary, fontSize: 20),
).tr(),
SizedBox(height: 25),
],
),
onPressed: () => Get.toNamed("writeNewEntry"));
}
ListView _buildUserEntries() {
return ListView.builder(
shrinkWrap: true,
padding: EdgeInsets.only(top: 0, bottom: 10),
physics: ClampingScrollPhysics(),
itemCount: entriesController.userEntriesData.length,
itemBuilder: (BuildContext context, int index) {
final Entry entry = entriesController.userEntriesData[index];
// Manage description
String entryContent = "";
List entryContentInput = [];
if (entry.content != null) {
final parsedContent = jsonDecode(entry.content);
if (parsedContent != null) {
for (int i = 0; i < parsedContent.length; i++) {
entryContentInput.add(parsedContent[i]["insert"]);
}
entryContent = entryContentInput.join("").toString();
}
}
return GestureDetector(
onLongPress: () {
_userEntryOptions(entry);
},
child: GuestListTile(
entry: entry,
description: entryContent != null && entryContent.isNotEmpty
? entryContent
: tr("no_text_added"),
owner: entry.owner,
hasImages: entry.images != null && entry.images.isNotEmpty,
hasVideos: entry.videos != null && entry.videos.isNotEmpty,
hasPainting:
entry.paintingImage != null && entry.paintingImage.isNotEmpty,
),
);
});
}
Container _buildAllEntriesContainer() {
return Container(
child: MixinBuilder(
builder: (EntriesController controller) {
if (controller.guestbookEntriesWithoutOwn.length > 0) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(left: 25.0, right: 25),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text("entries_from_all_guests",
style: Get.theme.textTheme.headline4)
.tr(),
CircleAvatar(
radius: 10,
backgroundColor: Get.theme.colorScheme.primary,
child: Text(
controller.guestbookEntriesWithoutOwn.length
.toString(),
style: TextStyle(
fontSize: 10,
color: Get.theme.colorScheme.background)),
)
],
),
),
_buildAllEntries(controller.guestbookEntriesWithoutOwn),
],
);
} else {
return Container();
}
},
),
);
}
Widget _buildAllEntries(List<Entry> entries) {
if (entries != null && entries.isNotEmpty) {
return ListView.builder(
padding: EdgeInsets.only(top: 10, bottom: 10),
physics: ClampingScrollPhysics(),
shrinkWrap: true,
itemExtent: 95,
itemCount: entries.length,
itemBuilder: (BuildContext context, int index) {
Entry entry;
if (entries.length > 0) {
entry = entries[index];
// Manage description
String entryContent = "";
List entryContentInput = [];
if (entry.content != null) {
final parsedContent = jsonDecode(entry.content);
if (parsedContent != null) {
for (int i = 0; i < parsedContent.length; i++) {
entryContentInput.add(parsedContent[i]["insert"]);
}
entryContent = entryContentInput.join("").toString();
}
}
return GestureDetector(
onLongPress: () async {
final userID = await getUid();
if (usersController.userIsModerator(
userID: userID,
guestbook:
guestbooksController.currentGuestbook.value) ==
true) {
_userEntryOptions(entry);
}
},
child: GuestListTile(
entry: entry,
description: entryContent != null &&
entryContent.isNotEmpty &&
entryContent != "\n"
? entryContent
: tr("no_content"),
owner: entry.owner,
hasImages: entry.images != null && entry.images.isNotEmpty,
hasVideos: entry.videos != null && entry.videos.isNotEmpty,
hasPainting: entry.paintingImage != null &&
entry.paintingImage.isNotEmpty,
),
);
} else {
return Container();
}
});
} else {
return Container();
}
}
void _userEntryOptions(Entry entry) {
Get.bottomSheet(CupertinoActionSheet(
actions: [
CupertinoActionSheetAction(
onPressed: () {
Get.back();
_deleteUserEntryConfirmation(entry);
},
child: Text("delete_this_entry").tr(),
isDestructiveAction: true,
)
],
));
}
void _deleteUserEntryConfirmation(Entry entry) {
Get.dialog(CupertinoAlertDialog(
title: Text("delete_my_entry_desc").tr(),
actions: [
CupertinoDialogAction(
child: Text("yes_delete_entry").tr(),
isDestructiveAction: true,
onPressed: () {
Get.back();
_deleteUserEntry(entry);
},
),
CupertinoDialogAction(
child: Text("no_not_delete_entry").tr(),
onPressed: () {
Get.back();
},
)
],
));
}
void _deleteUserEntry(Entry entry) async {
await entriesController.deleteEntireUserEntry(entry);
await MySnackbar()
.createSnackbar(message: tr("entry_deleted_successfully"), seconds: 2);
}
}
By the way: I'm using the getx package for state management. This is the reason because I can go with a Stateless widget.
Rebuild the app using the command flutter clean
You didn't provide a lot of code, but maybe you should try wrapping your ListView.builder with Expanded widget? :)
Then your code would become something like:
return Expanded(
child: ListView.builder(
padding: EdgeInsets.only(top: 25, bottom: 20),
shrinkWrap: true,
itemExtent: 95,
physics: ClampingScrollPhysics(),
itemCount: entriesController.guestbookEntries.length,
itemBuilder: (BuildContext context, int index) {
return GestureDetector(
onLongPress: () async {
// Some stuff
},
child: GuestListTile()
);
},
));
The Expanded widget consumes available space which comes in handy if used in a Column or a Row -- you can read more about it # Flutter - Expanded.
It seems your guestbookEntries from entriesController variable is null when you do hot reload. Check the value if null show some loading indicator, then show the ListView when it's not null.
Your widget doesn't show anything much, because there is no controller class code.
Use this : Your Problem will be solved
return Container(
height: double.maxfinite;
child:SingleChildScrollView(
child: ListView.builder(
padding: EdgeInsets.only(top: 25, bottom: 20),
shrinkWrap: true,
itemExtent: 95,
physics: NeverScrollableScrollPhysics(),
itemCount: entriesController.guestbookEntries.length,
itemBuilder: (BuildContext context, int index) {
return GestureDetector(
onLongPress: () async {
// Some stuff
},
child: GuestListTile()
);
},
)));
I have the following FutureBuilder and I am trying to display a loading spinner when the connection state is in waiting status but am getting alot of exception regarding size. Not sure where to include the size since my spinner already has a size.
return Scaffold(
backgroundColor: Colors.grey[100],
appBar: AppBar(
backgroundColor: Colors.grey[100],
elevation: 0,
brightness: Brightness.light,
leading: Icon(null),
actions: <Widget>[
IconButton(
onPressed: () {},
icon: Icon(
Icons.shopping_basket,
color: Colors.grey[800],
),
)
],
),
body: SafeArea(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.symmetric(horizontal: 20.0),
child: FutureBuilder(
future: _screenFuture,
// ignore: missing_return
builder: (context, snap) {
if (snap.error != null &&
!snap.error
.toString()
.contains('NoSuchMethodError')) {
return Center(child: Text('Something went wrong!'));
} else if (snap.hasData) {
var categoriesData = Provider.of<Categories>(context);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
FadeAnimation(
1,
Text(
'Food Delivery',
style: TextStyle(
color: Colors.grey[80],
fontWeight: FontWeight.bold,
fontSize: 30),
)),
SizedBox(
height: 20,
),
Container(
height: 50,
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: categoriesData.items.length,
itemBuilder: (ctx, i) => FadeAnimation(
1,
makeCategory(
isActive: true,
title: categoriesData.items
.toList()[i]
.title)))),
SizedBox(
height: 10,
),
],
);
} else if (snap.connectionState ==
ConnectionState.waiting) {
return Center(child: Loading());
}
})),
SizedBox(
height: 30,
)
],
),
),
);
Loading spinner class
class Loading extends StatelessWidget {
#override
Widget build(BuildContext context) {
return Container(
color: Colors.white,
child: SpinKitFadingCircle(
color: Colors.black,
size: 30,
)
);
}
}
Exceptions I am getting: I see that it is pointing to line 7 of my loading spinner but I am honestly not sure what to make of it.
════════ Exception caught by rendering library ═════════════════════════════════
The following assertion was thrown during performResize():
'package:flutter/src/widgets/overlay.dart': Failed assertion: line 720 pos 12: 'constraints.biggest.isFinite': is not true.
2
Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=2_bug.md
The relevant error-causing widget was
MaterialApp
lib\widgets\loading.dart:7
When the exception was thrown, this was the stack
#2 _RenderTheatre.computeDryLayout
package:flutter/…/widgets/overlay.dart:720
#3 RenderBox.performResize
package:flutter/…/rendering/box.dart:2332
#4 RenderObject.layout
package:flutter/…/rendering/object.dart:1758
#5 RenderProxyBoxMixin.performLayout
package:flutter/…/rendering/proxy_box.dart:116
#6 RenderObject.layout
package:flutter/…/rendering/object.dart:1779
...
The following RenderObject was being processed when the exception was fired: _RenderTheatre#d0b0d NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
RenderObject: _RenderTheatre#d0b0d NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
arentData: <none> (can use size)
constraints: BoxConstraints(0.0<=w<=320.0, 0.0<=h<=Infinity)
size: MISSING
skipCount: 0
textDirection: ltr
onstage 1: RenderIgnorePointer#7e525 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: not positioned; offset=Offset(0.0, 0.0)
constraints: MISSING
size: MISSING
ignoring: false
ignoringSemantics: implicitly false
child: RenderBlockSemantics#115dd NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: <none>
constraints: MISSING
blocks semantics of earlier render objects below the common boundary
size: MISSING
blocking: true
child: RenderExcludeSemantics#791f1 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: <none>
constraints: MISSING
size: MISSING
excluding: true
child: RenderSemanticsGestureHandler#fab4a NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: <none>
constraints: MISSING
size: MISSING
behavior: opaque
gestures: tap
onstage 2: RenderSemanticsAnnotations#e679a NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: not positioned; offset=Offset(0.0, 0.0)
constraints: MISSING
size: MISSING
child: RenderOffstage#31df1 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: <none>
constraints: MISSING
size: MISSING
offstage: false
child: RenderSemanticsAnnotations#12c91 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: <none>
constraints: MISSING
size: MISSING
child: RenderRepaintBoundary#93c1c NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
needs compositing
parentData: <none>
constraints: MISSING
size: MISSING
usefulness ratio: no metrics collected yet (never painted)
no offstage children
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by rendering library ═════════════════════════════════
BoxConstraints forces an infinite height.
The relevant error-causing widget was
MaterialApp
lib\widgets\loading.dart:7
════════════════════════════════════════════════════════════════════════════════
After removing materialApp in loading spinner, I am now getting this exception:
════════ Exception caught by widgets library ═══════════════════════════════════
The following assertion was thrown building SpinKitFadingCircle(state: _SpinKitFadingCircleState#75158(ticker active)):
No Directionality widget found.
Stack widgets require a Directionality widget ancestor to resolve the 'alignment' argument.
The default value for 'alignment' is AlignmentDirectional.topStart, which requires a text direction.
The specific widget that could not find a Directionality ancestor was: Stack
alignment: AlignmentDirectional.topStart
fit: loose
dirty
The ownership chain for the affected widget is: "Stack ← SizedBox ← Center ← SpinKitFadingCircle ← ColoredBox ← Container ← Loading ← Center ← MyApp ← [root]"
Typically, the Directionality widget is introduced by the MaterialApp or WidgetsApp widget at the top of your application widget tree. It determines the ambient reading direction and is used, for example, to determine how to lay out text, how to interpret "start" and "end" values, and to resolve EdgeInsetsDirectional, AlignmentDirectional, and other *Directional objects.
Instead of providing a Directionality widget, another solution would be passing a non-directional 'alignment', or an explicit 'textDirection', to the Stack.
from the error message, I guess if you wrapped SpinKitFadingCircle inside a Directionality it might work! if it didn't, we need more info about the SpinKitFadingCircle widget.
class Loading extends StatelessWidget {
#override
Widget build(BuildContext context) {
return Container(
color: Colors.white,
child: Directionality(
textDirection: TextDirection.rtl,
child: SpinKitFadingCircle(
color: Colors.black,
size: 30,
),
),
);
}
}
I have my listView that works correctly without the Row code, but I need to place a textfield and a button under the last element of the ListView. both at the same height. that's why I thought about using Row. but if I try to write it under my listView and start the app, I don't see anything, not even the listView. as an error it is only reported to me:
The relevant error-causing widget was:
ListView file:///Users/apple/Desktop/Work%202021/toduba-merchant/lib/tabs/home_tab.dart:95:22
When the exception was thrown, this was the stack:
#0 RenderViewportBase._paintContents (package:flutter/src/rendering/viewport.dart:649:25)
#1 RenderViewportBase.paint (package:flutter/src/rendering/viewport.dart:641:7)
#2 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2322:7)
#3 PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:140:11)
#4 PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:100:5)
...
The following RenderObject was being processed when the exception was fired: RenderViewport#ba090
... needs compositing
... parentData: (can use size)
... constraints: BoxConstraints(w=375.0, h=474.9)
... layer: OffsetLayer#32030 DETACHED
... engine layer: Null#007db
... offset: Offset(0.0, 0.0)
... size: Size(375.0, 474.9)
... axisDirection: down
... crossAxisDirection: right
... offset: ScrollPositionWithSingleContext#d8a7b(offset: 0.0, range: null..null, viewport: 474.9, ScrollableState, BouncingScrollPhysics -> RangeMaintainingScrollPhysics, IdleScrollActivity#f75ff, ScrollDirection.idle)
... anchor: 0.0
RenderObject: RenderViewport#ba090
needs compositing
parentData: (can use size)
constraints: BoxConstraints(w=375.0, h=474.9)
layer: OffsetLayer#32030 DETACHED
engine layer: Null#007db
offset: Offset(0.0, 0.0)
size: Size(375.0, 474.9)
axisDirection: down
crossAxisDirection: right
offset: ScrollPositionWithSingleContext#d8a7b(offset: 0.0, range: null..null, viewport: 474.9, ScrollableState, BouncingScrollPhysics -> RangeMaintainingScrollPhysics, IdleScrollActivity#f75ff, ScrollDirection.idle)
anchor: 0.0
... center child: RenderSliverPadding#7222a relayoutBoundary=up1 NEEDS-PAINT
... needs compositing
... parentData: paintOffset=Offset(0.0, 0.0) (can use size)
... constraints: SliverConstraints(AxisDirection.down, GrowthDirection.forward, ScrollDirection.idle, scrollOffset: 0.0, remainingPaintExtent: 474.9, crossAxisExtent: 375.0, crossAxisDirection: AxisDirection.right, viewportMainAxisExtent: 474.9, remainingCacheExtent: 724.9, cacheOrigin: 0.0)
... geometry: null
... padding: EdgeInsets.all(20.0)
... textDirection: ltr
... child: RenderSliverList#9d74e relayoutBoundary=up2 NEEDS-PAINT
... needs compositing
... parentData: paintOffset=Offset(0.0, 0.0) (can use size)
... constraints: SliverConstraints(AxisDirection.down, GrowthDirection.forward, ScrollDirection.idle, scrollOffset: 0.0, remainingPaintExtent: 454.9, crossAxisExtent: 335.0, crossAxisDirection: AxisDirection.right, viewportMainAxisExtent: 474.9, remainingCacheExtent: 704.9, cacheOrigin: 0.0)
... geometry: null
... currently live children: 0 to 3
... child with index 0: RenderIndexedSemantics#3b488 relayoutBoundary=up3 NEEDS-PAINT
... needs compositing
... parentData: index=0; layoutOffset=0.0 (can use size)
... constraints: BoxConstraints(w=335.0, 0.0<=h<=Infinity)
... semantic boundary
... size: Size(335.0, 29.0)
... index: 0
... child: RenderRepaintBoundary#8cd41 relayoutBoundary=up4 NEEDS-PAINT
... needs compositing
... parentData: (can use size)
... constraints: BoxConstraints(w=335.0, 0.0<=h<=Infinity)
... size: Size(335.0, 29.0)
... usefulness ratio: no metrics collected yet (never painted)
... child with index 1: RenderIndexedSemantics#c3e1f relayoutBoundary=up3 NEEDS-PAINT
... needs compositing
... parentData: index=1; layoutOffset=29.0 (can use size)
... constraints: BoxConstraints(w=335.0, 0.0<=h<=Infinity)
... semantic boundary
... size: Size(335.0, 260.0)
... index: 1
... child: RenderRepaintBoundary#16c99 relayoutBoundary=up4 NEEDS-PAINT
... needs compositing
... parentData: (can use size)
... constraints: BoxConstraints(w=335.0, 0.0<=h<=Infinity)
... size: Size(335.0, 260.0)
... usefulness ratio: no metrics collected yet (never painted)
... child with index 2: RenderIndexedSemantics#967b1 relayoutBoundary=up3 NEEDS-PAINT
... needs compositing
... parentData: index=2; layoutOffset=289.0 (can use size)
... constraints: BoxConstraints(w=335.0, 0.0<=h<=Infinity)
... semantic boundary
... size: Size(335.0, 22.0)
... index: 2
... child: RenderRepaintBoundary#348b5 relayoutBoundary=up4 NEEDS-PAINT
... needs compositing
... parentData: (can use size)
... constraints: BoxConstraints(w=335.0, 0.0<=h<=Infinity)
... size: Size(335.0, 22.0)
... usefulness ratio: no metrics collected yet (never painted)
... child with index 3: RenderIndexedSemantics#047b6 relayoutBoundary=up3 NEEDS-PAINT
... needs compositing
... parentData: index=3; layoutOffset=311.0 (can use size)
... constraints: BoxConstraints(w=335.0, 0.0<=h<=Infinity)
... semantic boundary
... size: MISSING
... index: 3
... child: RenderRepaintBoundary#af13c relayoutBoundary=up4 NEEDS-PAINT
... needs compositing
... parentData: (can use size)
... constraints: BoxConstraints(w=335.0, 0.0<=h<=Infinity)
... size: MISSING
... usefulness ratio: no metrics collected yet (never painted)
return Container(
color: appColors.primaryColor,
child: ListView(
primary: false,
children: [
// TITOLO
Align(
alignment: Alignment.center,
child: Container(
child: Text(
localization.showQR,
style: Theme.of(context).primaryTextTheme.headline5.copyWith(
color: appColors.green,
fontWeight: FontWeight.bold,
),
),
),
),
Align(
alignment: Alignment.center,
child: Container(
child: qrCodeHolder
),
),
Align(
alignment: Alignment.center,
child: Container(
child: AutoSizeText(
localization.home_subLabel,
textAlign: TextAlign.center,
maxLines: 1,
style: Theme.of(context).primaryTextTheme.headline5.copyWith(
color: appColors.green,
fontWeight: FontWeight.bold,
),
),
),
),
Positioned(
//top: size.height * .02,
//right: size.width * .02,
child: Row(
children: [
TextField(
inputFormatters: [
new LengthLimitingTextInputFormatter(7),
],
decoration: InputDecoration(
filled: true,
fillColor: Colors.white,
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.white),
),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white),
),
),
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18.0,
color: Colors.black,
),
),
IconButton(
icon: Image.asset("assets/images/send.png"),
onPressed: () => showDialog(context: context, builder: (_) => PaymentDialog()),
),
Text("dfjbsdifbsdf"),
]
),
),
],
padding: EdgeInsets.all(20.0),
),
);
You need to wrap your TextField in an Expanded widget or a container with limited width.
This is because the Row assumes it can take maximum width, and the TextField and TextFormField widget by default try to take the maximum width possible.
By putting them inside each other, you'll get the error you are having.
Use this for the TextField, inside a row, it must be wrapped in Expanded or Flexible.
Row(
children: [
Expanded(
child: TextField ()
)
])
Maybe one of you already came across these problems. I spent numerous hours with trying to get the ListView (I also tried ExpansionPanelList) into a container that pans from the right edge into the screen (help menu) over the existing widgets. I have already created a mock-up starting with a basic ListView and then added feature by feature again. But now I am stuck and the error message is not of much help (to me).
Those exceptions are thrown as soon as I add the AnimatedPositioned. The main message seems to be an issue with constraints.hasBoundedWidth': is not true.
════════ Exception caught by rendering library ═════════════════════════════════════════════════════
The following assertion was thrown during performLayout():
'package:flutter/src/rendering/viewport.dart': Failed assertion: line 1754 pos 16: 'constraints.hasBoundedWidth': is not true.
Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=BUG.md
The relevant error-causing widget was:
ListView file:///Users/holger/IdeaProjects/math/lib/tmp.dart:496:40
When the exception was thrown, this was the stack:
#2 RenderShrinkWrappingViewport.performLayout (package:flutter/src/rendering/viewport.dart:1754:16)
#3 RenderObject.layout (package:flutter/src/rendering/object.dart:1775:7)
#4 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
#5 RenderObject.layout (package:flutter/src/rendering/object.dart:1775:7)
#6 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
...
The following RenderObject was being processed when the exception was fired: RenderShrinkWrappingViewport#a1875 relayoutBoundary=up7 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(0.0<=w<=Infinity, 0.0<=h<=716.8)
... size: MISSING
... axisDirection: down
... crossAxisDirection: right
... offset: ScrollPositionWithSingleContext#20c01(offset: 0.0, range: null..null, viewport: null, ScrollableState, AlwaysScrollableScrollPhysics -> BouncingScrollPhysics, IdleScrollActivity#3e990, ScrollDirection.idle)
RenderObject: RenderShrinkWrappingViewport#a1875 relayoutBoundary=up7 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
needs compositing
parentData: <none> (can use size)
constraints: BoxConstraints(0.0<=w<=Infinity, 0.0<=h<=716.8)
size: MISSING
axisDirection: down
crossAxisDirection: right
offset: ScrollPositionWithSingleContext#20c01(offset: 0.0, range: null..null, viewport: null, ScrollableState, AlwaysScrollableScrollPhysics -> BouncingScrollPhysics, IdleScrollActivity#3e990, ScrollDirection.idle)
... child 0: RenderSliverPadding#078d5 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: layoutOffset=None
... constraints: MISSING
... geometry: null
... padding: EdgeInsets.zero
... textDirection: ltr
... child: RenderSliverList#fd0a6 NEEDS-LAYOUT NEEDS-PAINT
... parentData: paintOffset=Offset(0.0, 0.0)
... constraints: MISSING
... geometry: null
... no children current live
════════════════════════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by rendering library ═════════════════════════════════════════════════════
RenderBox was not laid out: RenderShrinkWrappingViewport#a1875 relayoutBoundary=up7 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1713 pos 12: 'hasSize'
The relevant error-causing widget was:
ListView file:///Users/holger/IdeaProjects/math/lib/tmp.dart:496:40
The lower part of the exception message is repeated multiple times, maybe once for every animation step. Then the messages finish with those below, where the reference container is the one of AnimatedPositiones > IgnorePointer > Container
════════ Exception caught by rendering library ═════════════════════════════════════════════════════
The following assertion was thrown during paint():
RenderBox was not laid out: RenderDecoratedBox#a83d8
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1713 pos 12: 'hasSize'
Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=BUG.md
The relevant error-causing widget was:
Container file:///Users/holger/IdeaProjects/math/lib/tmp3.dart:474:32
When the exception was thrown, this was the stack:
#2 RenderBox.size (package:flutter/src/rendering/box.dart:1713:12)
#3 RenderDecoratedBox.paint (package:flutter/src/rendering/proxy_box.dart:2067:12)
#4 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2307:7)
#5 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:191:13)
#6 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:133:15)
...
The following RenderObject was being processed when the exception was fired: RenderDecoratedBox#a83d8
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=331.2, h=716.8)
... size: MISSING
... decoration: BoxDecoration
... color: Color(0xffffffff)
... configuration: ImageConfiguration(bundle: PlatformAssetBundle#b6597(), devicePixelRatio: 3.0, locale: en_US, textDirection: TextDirection.ltr, platform: iOS)
RenderObject: RenderDecoratedBox#a83d8
needs compositing
parentData: <none> (can use size)
constraints: BoxConstraints(w=331.2, h=716.8)
size: MISSING
decoration: BoxDecoration
color: Color(0xffffffff)
configuration: ImageConfiguration(bundle: PlatformAssetBundle#b6597(), devicePixelRatio: 3.0, locale: en_US, textDirection: TextDirection.ltr, platform: iOS)
... child: RenderFlex#28045 NEEDS-PAINT
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=331.2, h=716.8)
... size: MISSING
... direction: horizontal
... mainAxisAlignment: start
... mainAxisSize: max
... crossAxisAlignment: center
... textDirection: ltr
... verticalDirection: down
... textBaseline: alphabetic
... child 1: RenderPadding#b537d relayoutBoundary=up1 NEEDS-PAINT
... parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
... constraints: BoxConstraints(0.0<=w<=Infinity, 0.0<=h<=716.8)
... size: Size(59.0, 716.8)
... padding: EdgeInsets(3.0, 0.0, 0.0, 0.0)
... textDirection: ltr
... child: RenderFlex#4c2a2 relayoutBoundary=up2 NEEDS-PAINT
... parentData: offset=Offset(3.0, 0.0) (can use size)
... constraints: BoxConstraints(0.0<=w<=Infinity, 0.0<=h<=716.8)
... size: Size(56.0, 716.8)
... direction: vertical
... mainAxisAlignment: spaceEvenly
... mainAxisSize: max
... crossAxisAlignment: center
... verticalDirection: down
... child 1: RenderSemanticsGestureHandler#c07e2 relayoutBoundary=up3 NEEDS-PAINT
... parentData: offset=Offset(0.0, 330.4); flex=null; fit=null (can use size)
... constraints: BoxConstraints(unconstrained)
... size: Size(56.0, 56.0)
... gestures: tap
... child 2: _RenderScrollSemantics#80100 relayoutBoundary=up1 NEEDS-PAINT
... needs compositing
... parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
... constraints: BoxConstraints(0.0<=w<=Infinity, 0.0<=h<=716.8)
... semantic boundary
... size: MISSING
... child: RenderPointerListener#695c7 relayoutBoundary=up2 NEEDS-PAINT
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(0.0<=w<=Infinity, 0.0<=h<=716.8)
... size: MISSING
... behavior: deferToChild
... listeners: signal
... child: RenderSemanticsGestureHandler#db442 relayoutBoundary=up3 NEEDS-PAINT
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(0.0<=w<=Infinity, 0.0<=h<=716.8)
... size: MISSING
... gestures: <none>
════════════════════════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by rendering library ═════════════════════════════════════════════════════
RenderBox was not laid out: RenderDecoratedBox#a83d8
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1713 pos 12: 'hasSize'
The relevant error-causing widget was:
Container file:///Users/holger/IdeaProjects/math/lib/tmp3.dart:474:32
The ListView looks like this, it shows headers of different tags and each can be expanded to show detail information.
AnimatedPositioned(duration: Duration(milliseconds: 800),
left: _drawerLeft,
top:5,
child: IgnorePointer(ignoring: (_drawerLeft <= MediaQuery.of(context).size.width / 3 ? false:true),
child: Container(
height:0.8*1 * MediaQuery.of(context).size.height, width:0.8 * MediaQuery.of(context).size.width,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
CupertinoButton(
child: Icon(fwdBtn),
onPressed: () {
setState(() {
_drawerLeft = 1 * MediaQuery.of(context).size.width;
controller.reverse();
});
},
),
ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: usedTagData.length, itemBuilder: (BuildContext context, int index) {
return Column(
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(usedTagData[index].header, style: TextStyle(color: CupertinoColors.link)),
CupertinoButton(
child: Icon(dwnBtn),
onPressed: () {
setState(() {
usedTagData[index].isExpanded = !usedTagData[index].isExpanded;
});
},
),
],
),
(usedTagData[index].isExpanded ?
Text(usedTagData[index].content)
:
Container()
),
]
);
}
),
],
),
)),
)
The AnimatedPositioned is a widget of
return Container(
height: MediaQuery.of(context).size.height,
child: Stack(
fit: StackFit.expand,
children: <Widget>[
Do you have any idea how to go forward on this or do the exception messages provide any hint to you?
The only way you would get ListView to work with Row is to set a predefined width. Your ListView tries to expand infinitely so you should constrain it by setting a predefined width.
Here is an example:
Row(
children:[
SizedBox(
width:200,
child:ListView()
),
]),