showAsModalBottomSheet method
Implementation
void showAsModalBottomSheet(BuildContext sheetContext) {
showModalBottomSheet(
isScrollControlled: true,
clipBehavior: Clip.hardEdge,
/// Due to a Flutter issue, the bottom sheet cannot be dragged down to dismiss it once its content fills the screen height.
/// Until it has been fixed, the drag handle should be shown such that the user can still dismiss the sheet by dragging the handle at the top.
/// https://github.com/flutter/flutter/issues/36283
showDragHandle: true,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(18.0)),
),
context: sheetContext,
builder: (context) {
/// Due to the modal sheet having a separate context and thus no relation
/// to the main context of the NeoTechWidget, we capture DartBlockNotifications
/// from the sheet's context and manually re-dispatch them using the parent context.
/// The parent context may not necessarily be the NeoTechWidget's context,
/// as certain sheets open additional nested sheets with their own contexts,
/// hence this process needs to be repeated for every sheet until the NeoTechWidget's
/// context is reached.
return NotificationListener<DartBlockNotification>(
onNotification: (notification) {
notification.dispatch(sheetContext);
return true;
},
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.only(
left: 8,
right: 8,
top: 8 + MediaQuery.of(context).viewInsets.top,
bottom: 16 + MediaQuery.of(context).viewInsets.bottom,
),
child: this,
),
),
);
// return DraggableScrollableSheet(
// initialChildSize: 0.75,
// minChildSize: 0.13,
// maxChildSize: 0.9,
// expand: false,
// builder: (context, scrollController) => SingleChildScrollView(
// controller: scrollController,
// child: Padding(
// padding: const EdgeInsets.all(8),
// child: this,
// ),
// ),
// );
},
);
}