I'm battling with this issue "RenderPhysicalModel object was given an infinite size during layout.". I have one main file and importing a smaller widget in it. The code of the main file is the following:
Stack(
children: [
Container(
height: MediaQuery.of(context).size.height - 82.0,
width: MediaQuery.of(context).size.width,
color: Colors.transparent,
),
Positioned(
top: 75.0,
child:
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(45.0),
topRight: Radius.circular(45.0),
),
color: Colors.white,
),
height: MediaQuery.of(context).size.height - 100.0,
width: MediaQuery.of(context).size.width,
),
),
Positioned(
top: 30.0,
left: (MediaQuery.of(context).size.width /2) - 100.0,
child: Hero(
tag: widget.heroTag,
child: Container (
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(widget.heroTag),
fit: BoxFit.cover,
)
),
height: 200.0,
width: 200.0,
),
)
),
Positioned(
top: 250.0,
left:25.0,
right:25.0,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget> [
Text('Im testing'),
],
),
),
Positioned(
top: 280,
left:25.0,
right:25.0,
child: Calendar(),
),
]
)
],
And i am trying to add the widget Calendar () which has the following code:
Container(
height:70,
width: 50,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(_dateTime == null ? 'You didnt pick a date' : _dateTime.toString()),
RaisedButton(
child: Text('Pick a date'),
onPressed: () {
showDatePicker(
context: context,
initialDate: _dateTime ?? DateTime.now(),
firstDate: DateTime(2001),
lastDate: DateTime(2021)
).then((date) {
setState(() {
_dateTime = date;
});
});
},
I don't know why is not rendering the Calendar() widget but it is rendering the Text() widget.
Thank you.