I added a Listener to the DraggableScrollableSheet. When I do a print to the DSNotification.extent on the function DraggableScrollableNotification DSNotification it works and it shows me the value which is maximum 0.49, but when I add the if test and the setState I don't get the right value. It doesn't work with setState and when I remove it it always gives me false!
NotificationListener<DraggableScrollableNotification>(
onNotification:
(DraggableScrollableNotification DSNotification) {
if (DSNotification.extent == 0.49) {
// setState(() {
//print(DSNotification.extent);
scrolable = true;
// });
}
if (DSNotification.extent <= 0.49) {
//setState(() {
scrolable = false;
//print(DSNotification.extent);
//});
}
print(scrolable);
return true;
},
child: DraggableScrollableSheet(
controller: controller,
initialChildSize: 0,
minChildSize: 0.0,
maxChildSize: 0.49,
builder: (_, scrollController) {
return Container(
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.transparent),
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(15),
topRight: Radius.circular(15))),
child: ListView(controller: scrollController, children: [
nfController.myWidget,
]),
);
},
),
),