showDoubleTextInput static method

Future<List<String>> showDoubleTextInput({
  1. String title = 'Title',
  2. String message = '',
  3. List<String>? initialTexts,
  4. List<String>? hintTexts,
  5. String cancelLabelText = 'Cancel',
  6. String okLabelText = 'OK',
})

显示2个文本输入框弹窗

Implementation

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