showModalBottom<T> static method
显示底部模态框
Implementation
static Future<T?> showModalBottom<T>({
required Widget child,
Widget? title,
Widget? leading,
List<Widget>? actions,
Widget? bottom,
EdgeInsetsGeometry? padding,
double? minHeight,
bool showTitle = true,
bool isScrollControlled = true,
bool useSafeArea = true,
Color? backgroundColor,
}) async {
final context = ComContext.context;
final boxConstraints =
minHeight != null ? BoxConstraints(minHeight: minHeight) : null;
return await showModalBottomSheet(
context: context,
isScrollControlled: isScrollControlled,
useSafeArea: useSafeArea,
constraints: boxConstraints,
backgroundColor: backgroundColor ?? Theme.of(context).dialogTheme.backgroundColor,
builder: (BuildContext context) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
if (showTitle)
ComTitleBar(
title: title,
leading: leading,
actions: actions,
),
if (bottom != null) bottom,
ConstrainedBox(
constraints: BoxConstraints(
maxHeight:
MediaQuery.of(context).size.height * _defaultModalHeight,
),
child: SingleChildScrollView(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).padding.bottom +
MediaQuery.of(context).viewInsets.bottom,
),
child: child,
),
),
],
);
},
);
}