-
Notifications
You must be signed in to change notification settings - Fork 29.4k
Closed
Closed
Copy link
Labels
r: solvedIssue is closed as solvedIssue is closed as solved
Description
Steps to reproduce
I'm encountering an issue with the Chip widget in Flutter when using it within a ListTile's trailing property. The widget fails to layout properly, leading to repeated assertion errors related to missing size constraints.
- Create a ListTile with a Chip widget placed in the trailing property.
- Apply constraints using a Container around the Chip widget.
- Run the app and observe the error logs related to layout and rendering.
Expected results
The Chip widget should layout correctly within its parent ListTile and render without any assertion failures or errors.
Actual results
The Chip widget causes an assertion failure during layout, specifically related to the RenderObject missing a size. The following error is observed repeatedly:
The following RenderObject was being processed when the exception was fired: _RenderChip#9eac7
relayoutBoundary=up48 NEEDS-LAYOUT
NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE:
...
Another exception was thrown: Assertion failed:
file:///Users/j/Documents/flutter/packages/flutter/lib/src/rendering/box.dart:2164:12
Code sample
import 'package:flutter/material.dart';
import 'package:auto_size_text/auto_size_text.dart';
class ChipIssueExample extends StatelessWidget {
const ChipIssueExample({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
const Color colorPrimary = Colors.blue; // Replace with your desired color
return Scaffold(
body: Center(
child: ListTile(
trailing: Container(
constraints: const BoxConstraints(
maxWidth: 98.0,
minWidth: 98.0,
),
child: Chip(
backgroundColor: colorPrimary,
label: const AutoSizeText(
"Verified",
maxFontSize: 18,
),
),
),
title: const AutoSizeText(
"KYC Information",
maxFontSize: 24,
),
),
),
);
}
}
void main() {
runApp(MaterialApp(
home: ChipIssueExample(),
));
}Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
packages/flutter/src/rendering/binding.dart 468:5 [_handlePersistentFrameCallback]
packages/flutter/src/scheduler/binding.dart 1397:7 [_invokeFrameCallback]
packages/flutter/src/scheduler/binding.dart 1318:9 handleDrawFrame
packages/flutter/src/scheduler/binding.dart 1040:9 <fn>
dart-sdk/lib/_internal/js_dev_runtime/private/isolate_helper.dart 48:11 internalCallback
The following RenderObject was being processed when the exception was fired: _RenderChip#23b2f relayoutBoundary=up48 NEEDS-LAYOUT
NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE:
creator: _ChipRenderWidget ← Builder ← Padding-[GlobalKey#5f34d] ← Ink ← AnimatedBuilder ← Listener
← RawGestureDetector ← GestureDetector ← Semantics ← DefaultSelectionStyle ← Builder ← MouseRegion
← ⋯
parentData: offset=Offset(0.0, 0.0) (can use size)
constraints: BoxConstraints(0.0<=w<=96.0, 0.0<=h<=46.0)
size: MISSING
This RenderObject had the following descendants (showing up to depth 5):
avatar: RenderStack#b51a3 NEEDS-LAYOUT NEEDS-PAINT
label: _RenderLayoutBuilder#fa221 NEEDS-LAYOUT NEEDS-PAINT
deleteIcon: RenderStack#824ea NEEDS-LAYOUT NEEDS-PAINT
════════════════════════════════════════════════════════════════════════════════════════════════════
Another exception was thrown: Assertion failed:
file:///Users/j/Documents/flutter/packages/flutter/lib/src/rendering/box.dart:2164:12
Another exception was thrown: Assertion failed:
file:///Users/j/Documents/flutter/packages/flutter/lib/src/rendering/box.dart:2164:12
Flutter Doctor output
Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.0, on macOS 13.6.7 22G720 darwin-x64, locale
en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[!] Xcode - develop for iOS and macOS (Xcode 14.3.1)
! Flutter recommends a minimum Xcode version of 15.
Download the latest version or update via the Mac App Store.
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.91.0)
[✓] Connected device (2 available)
[✓] Network resources
! Doctor found issues in 1 category.
j@MacBook-Pro ~ %
Metadata
Metadata
Assignees
Labels
r: solvedIssue is closed as solvedIssue is closed as solved