So I have the following code:
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
CheckboxListTile(
title: Text("helo"),
controlAffinity: ListTileControlAffinity.leading,
value: true,
onChanged: null,
),
Text(
"Forgot Password?",
style: TextStyle(color: Colors.blueGrey),
)
],
),
my aim is to create a "Remember me" check box and "Forgot Password?" in a row.
When I run this code it gives me the following error:
RenderBox was not laid out: RenderMergeSemantics#19dcc relayoutBoundary=up8 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1785 pos 12: 'hasSize'
The relevant error-causing widget was Row lib\main.dart:106
═══════════════════════════════════════════════════════════════════════════════
════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out:
_RenderColoredBox#cd072 relayoutBoundary=up14
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1785 pos 12: 'hasSize'
The relevant error-causing widget was CheckboxListTile
Is there a way that I can get my desired output where the "Remember me" check box and "Forgot Password?" is in a Row?
Also, what is the problem with the current code?
Wrap the CheckboxListTile
in Expanded
widget like shown below:
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: CheckboxListTile(
title: Text("helo"),
controlAffinity: ListTileControlAffinity.leading,
value: true,
onChanged: null,
),
),
Text(
"Forgot Password?",
style: TextStyle(color: Colors.blueGrey),
)
],
),
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.