showSingleTextInput static method

Future<String> showSingleTextInput({
  1. String title = 'Title',
  2. String message = '',
  3. String initialText = '',
  4. String hintText = '',
  5. String cancelLabelText = 'Cancel',
  6. String okLabelText = 'OK',
})

显示单个文本输入框弹窗

Implementation

static Future<String> showSingleTextInput({
  String title = 'Title',
  String message = '',
  String initialText = '',
  String hintText = '',
  String cancelLabelText = 'Cancel',
  String okLabelText = 'OK',
}) async {
  final texts = await showTextInputDialog(
    context: Get.context!,
    title: title,
    message: message.isNotEmpty ? message : null,
    textFields: [
      DialogTextField(
        initialText: initialText,
        hintText: hintText,
      ),
    ],
  );
  return texts != null && texts.isNotEmpty ? texts[0] : '';
}