I am trying to put ListTile within a Card but I am getting a renderbox error
════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderPhysicalShape#c872a relayoutBoundary=up7
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1930 pos 12: 'hasSize'
The relevant error-causing widget was
Card
lib/…/task/make_offer.dart:100
ListView(children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16.0,
vertical: 10.0,
),
child: TextFormField(
controller: _offerController,
textInputAction: TextInputAction.next,
// textCapitalization: TextCapitalization.words,
// maxLength: 40,
decoration: const InputDecoration(
hintText: '5-9999',
prefixIcon: Icon(Icons.attach_money_rounded),
labelText: 'Your Offer',
),
keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.singleLineFormatter
],
onChanged: (offerAmount) => _offerAmount = offerAmount as int,
),
),
Card(
child: ListTile(
leading: Text('Fee'),
trailing: Text(_offerController.toString())))
]),
The issue is coming from
ListTile
'strailing
, you can wrapText
withSizedBox(width:x)
. Issue occurs on large text.Also, you can create custom ListTile while its default behavior. Here is a sample
Does it solve your issue?