textInputDialog static method
Future<void>
textInputDialog({
- required BuildContext context,
- required String title,
- required String message,
- bool barrierDismissible = true,
- String textLeftButton = 'OK',
- String textRightButton = 'Cancel',
- Function? onPressedLeftButton,
- Function? onPressedRightButton,
- DestructiveAction destructiveAction = DestructiveAction.right,
- DefaultAction defaultAction = DefaultAction.none,
- Color androidDestructiveColor = Colors.red,
- bool popByDefault = true,
- bool hasSecondaryButton = true,
- String? placeholder,
- TextEditingController? controller,
- TextInputType? keyboardType,
- Function? onChanged,
- Function? onEditingComplete,
This method will display a dialog with two buttons that have actions
Implementation
static Future<void> textInputDialog({
required BuildContext context,
required String title,
required String message,
bool barrierDismissible = true,
String textLeftButton = 'OK',
String textRightButton = 'Cancel',
Function? onPressedLeftButton,
Function? onPressedRightButton,
DestructiveAction destructiveAction = DestructiveAction.right,
DefaultAction defaultAction = DefaultAction.none,
Color androidDestructiveColor = Colors.red,
bool popByDefault = true,
bool hasSecondaryButton = true,
String? placeholder,
TextEditingController? controller,
TextInputType? keyboardType,
Function? onChanged,
Function? onEditingComplete,
}) async =>
await showDialog(
context: context,
barrierDismissible: barrierDismissible,
builder: (context) {
if (Theme.of(context).platform == TargetPlatform.iOS) {
return CupertinoTextInputDialog(
message: message,
title: title,
defaultAction: defaultAction,
destructiveAction: destructiveAction,
textLeftButton: textLeftButton,
textRightButton: textRightButton,
onPressedLeftButton: onPressedLeftButton,
onPressedRightButton: onPressedRightButton,
popByDefault: popByDefault,
hasSecondaryButton: hasSecondaryButton,
placeholder: placeholder,
controller: controller,
keyboardType: keyboardType,
onChanged: onChanged,
onEditingComplete: onEditingComplete,
);
}
return MaterialTextInputDialog(
message: message,
title: title,
defaultAction: defaultAction,
destructiveAction: destructiveAction,
textLeftButton: textLeftButton,
textRightButton: textRightButton,
onPressedLeftButton: onPressedLeftButton,
onPressedRightButton: onPressedRightButton,
popByDefault: popByDefault,
hasSecondaryButton: hasSecondaryButton,
placeholder: placeholder,
controller: controller,
keyboardType: keyboardType,
onChanged: onChanged,
onEditingComplete: onEditingComplete,
androidDestructiveColor: androidDestructiveColor,
);
});