CustomAlertDialog default BoxConstraints

This commit is contained in:
csf 2022-09-29 21:09:40 +08:00
parent deedac3497
commit d11ae197f3
3 changed files with 10 additions and 4 deletions

View File

@ -561,6 +561,7 @@ class CustomAlertDialog extends StatelessWidget {
required this.content,
this.actions,
this.contentPadding,
this.contentBoxConstraints = const BoxConstraints(maxWidth: 500),
this.onSubmit,
this.onCancel})
: super(key: key);
@ -569,6 +570,7 @@ class CustomAlertDialog extends StatelessWidget {
final Widget content;
final List<Widget>? actions;
final double? contentPadding;
final BoxConstraints contentBoxConstraints;
final Function()? onSubmit;
final Function()? onCancel;
@ -600,7 +602,8 @@ class CustomAlertDialog extends StatelessWidget {
title: title,
contentPadding: EdgeInsets.symmetric(
horizontal: contentPadding ?? 25, vertical: 10),
content: content,
content:
ConstrainedBox(constraints: contentBoxConstraints, child: content),
actions: actions,
),
);
@ -645,9 +648,7 @@ void msgBox(
}
dialogManager.show((setState, close) => CustomAlertDialog(
title: _msgBoxTitle(title),
content: ConstrainedBox(
constraints: BoxConstraints(maxWidth: 500),
child: Text(translate(text), style: const TextStyle(fontSize: 15))),
content: Text(translate(text), style: const TextStyle(fontSize: 15)),
actions: buttons,
onSubmit: hasOk ? submit : null,
onCancel: hasCancel == true ? cancel : null,

View File

@ -570,6 +570,8 @@ class FileModel extends ChangeNotifier {
Text(title)
],
),
contentBoxConstraints:
BoxConstraints(minHeight: 100, minWidth: 400, maxWidth: 400),
content: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
@ -627,6 +629,8 @@ class FileModel extends ChangeNotifier {
Text(title)
],
),
contentBoxConstraints:
BoxConstraints(minHeight: 100, minWidth: 400, maxWidth: 400),
content: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,

View File

@ -268,6 +268,7 @@ class FfiModel with ChangeNotifier {
if (isPeerAndroid) {
_touchMode = true;
if (parent.target != null &&
parent.target!.connType == ConnType.defaultConn &&
parent.target!.ffiModel.permissions['keyboard'] != false) {
Timer(
const Duration(milliseconds: 100),