I would like to change the height of DraggableScrollableSheet when a certain button is pressed. So far this is what i have
..other code up here...
double _sheetSize=0.8;
@override
Widget build(BuildContext context) {
return DraggableScrollableSheet(
initialChildSize: 0.29,
minChildSize: 0.05,
maxChildSize: _sheetSize,
builder: (BuildContext context, _myScrollController) {
return Container(
padding:EdgeInsets.symmetric(horizontal: 40,vertical: 10),
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(.8),
offset: Offset(3, 2),
blurRadius: 7)
]),
child: PageView(
physics: NeverScrollableScrollPhysics(),
controller: _stepController,
children: [
NotificationListener<NextStep>(
child: SelectTimeWidget(myScrollController: _myScrollController),
onNotification: (notification) {
if(notification.moveToNextStep){
moveToNextStep();
setState(() {
_sheetSize=0.5;
});
}else{
moveToPreviousStep();
}
return null;
}
),
...some other code here...
In this widget, i have used a notification listener to fire up an event that i desired to change the height of the sheet
NotificationListener<NextStep>(
child: SelectTimeWidget(myScrollController: _myScrollController),
onNotification: (notification) {
if(notification.moveToNextStep){
moveToNextStep();
setState(() {
_sheetSize=0.5;
});
}else{
moveToPreviousStep();
}
return null;
}
),
Sheet height
maxChildSize: _sheetSize,
What could i be doing wrong