showTextInputBottomSheet static method
dynamic
showTextInputBottomSheet({})
Implementation
static showTextInputBottomSheet({
required BuildContext context,
required String title,
String? tips,
required Function(String text) onSubmitted,
required TUITheme theme,
Offset? initOffset,
String? initText,
}) {
TextEditingController _selectionController = TextEditingController();
final isDesktopScreen = TUIKitScreenUtils.getFormFactor(context) == DeviceType.Desktop;
if (isDesktopScreen) {
if (entry != null) {
return;
}
entry = OverlayEntry(builder: (BuildContext context) {
return TUIKitDragArea(
closeFun: (){
if(entry != null){
entry?.remove();
entry = null;
}
},
initOffset: initOffset ??
Offset(MediaQuery.of(context).size.height * 0.5 + 20,
MediaQuery.of(context).size.height * 0.5 - 100),
child: Container(
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(8)),
color: theme.wideBackgroundColor,
border: Border.all(
width: 2,
color: theme.weakBackgroundColor ?? const Color(0xFFbebebe),
),
boxShadow: const [
BoxShadow(
color: Color(0xFFbebebe),
offset: Offset(5, 5),
blurRadius: 10,
spreadRadius: 1,
),
],
),
child: SizedBox(
width: 350,
child: inputBoxContent(
context: context,
isShowCancel: true,
title: title,
tips: tips,
onSubmitted: onSubmitted,
theme: theme,
initText: initText,
selectionController: _selectionController),
),
));
});
Overlay.of(context).insert(entry!);
} else {
showModalBottomSheet(
isScrollControlled: true, // !important
context: context,
builder: (BuildContext context) {
return inputBoxContent(
context: context,
title: title,
tips: tips,
initText: initText,
onSubmitted: onSubmitted,
theme: theme,
selectionController: _selectionController);
});
}
}