네. 원하는 뷰를 전달할 child 매개변수를 받는 공유 showModalBottomSheet 함수를 정의하세요
///
/// Open the shared modal sheet
///
Future<R?> openSharedModal<R>({
required BuildContext pageContext,
required Widget content,
bool? scrollControlled,
ShapeBorder? borderShape,
bool dismissible = true,
}) {
return showModalBottomSheet<R>(
isDismissible: dismissible,
context: pageContext,
elevation: SheetSettings.elevation,
barrierColor: SheetPalette.barrier,
isScrollControlled: scrollControlled ?? true,
enableDrag: true,
backgroundColor: SheetPalette.modal.ofContext(_pageContext),
shape: borderShape ?? SheetSettings.borderShape,
builder: (BuildContext sheetContext) {
return content;
},
);
}
영어에서 번역·원문 보기Yes. Define a shared showModalBottomSheet function, with a child parameter carrying the view you want
///
/// Open the shared modal sheet
///
Future<R?> openSharedModal<R>({
required BuildContext pageContext,
required Widget content,
bool? scrollControlled,
ShapeBorder? borderShape,
bool dismissible = true,
}) {
return showModalBottomSheet<R>(
isDismissible: dismissible,
context: pageContext,
elevation: SheetSettings.elevation,
barrierColor: SheetPalette.barrier,
isScrollControlled: scrollControlled ?? true,
enableDrag: true,
backgroundColor: SheetPalette.modal.ofContext(_pageContext),
shape: borderShape ?? SheetSettings.borderShape,
builder: (BuildContext sheetContext) {
return content;
},
);
}