I want to use DraggableScrollableSheet widget on my application, when I use that like with below code, that can show without problem:
class Home
If you want to show DraggableScrollableSheet as modal you can use material showModalBottomSheet method to wrap it. Your sheet will be shown as modal, and you do not have to include it in the widget tree. Please note that under the hood it's pushed as new Route to Navigator, with all its consequences.
onPressed: (){
showModalBottomSheet(
context: context,
isScrollControlled: true,
isDismissible: true,
expand: false,
backgroundColor: Colors.transparent,
builder: (context) =>
DraggableScrollableSheet(
initialChildSize: 0.64,
minChildSize: 0.2,
maxChildSize: 1,
builder: (context, scrollController) {
return Container(
color: Colors.white,
child: ListView.builder(
controller: scrollController,
itemBuilder: (context, index) {
return ListTile(
title: Text('Item $index'),
);
},
itemCount: 20,
),
);
},
),
);
}