showInputBottomSheet function
dynamic
showInputBottomSheet(
- BuildContext context, {
- required String title,
- String contentText = "",
- String hintText = "",
- int maxLength = 50,
- required InputDoneCallBack callback,
显示底部输入弹窗
Implementation
showInputBottomSheet(
BuildContext context, {
required String title, // 弹窗标题
String contentText = "", // 输入框初始内容
String hintText = "", // 输入框提示文字
int maxLength = 50, // 输入框最大字符长度
required InputDoneCallBack callback, // 输入完成后的回调函数
}) {
showModalBottomSheet(
context: context,
constraints: BoxConstraints(
maxHeight: ScreenUtil().screenHeight -
MediaQuery.of(context).viewPadding.top -
MediaQuery.of(context).viewPadding.bottom, // 最大高度设置
),
barrierColor: const Color.fromRGBO(0, 0, 0, 0.7),
// 背景遮罩颜色
isScrollControlled: true,
// 是否可以拖动滚动
enableDrag: false,
// 是否允许拖动关闭
backgroundColor: Colors.transparent,
// 弹窗背景颜色
builder: (context) => _InputSheetWidget(
title: title,
topLeftText: "取消",
// 左侧按钮文本
topRightText: "确定",
// 右侧按钮文本
inputDoneCallBack: callback,
// 输入完成后的回调
contentText: contentText,
// 输入框初始内容
maxLength: maxLength,
// 输入框最大字符长度
hintText: hintText, // 输入框提示文字
),
);
}