showPhoneDialog static method

void showPhoneDialog(
  1. BuildContext context,
  2. String phoneNumber
)

显示号码弹窗

Implementation

static void showPhoneDialog(BuildContext context, String phoneNumber) {
  showModalBottomSheet(
    context: context,
    backgroundColor: Colors.transparent,
    builder: (BuildContext context) {
      return Container(
        margin: const EdgeInsets.all(16),
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            // 主弹窗
            Container(
              width: double.infinity,
              decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.circular(12),
              ),
              child: Column(
                children: [
                  // 标题文本
                  Container(
                    padding: const EdgeInsets.symmetric(
                      horizontal: 16,
                      vertical: 20,
                    ),
                    child: Text(
                      S.of().messagePhoneCallTips(phoneNumber),
                      style: const TextStyle(
                        fontSize: 13,
                        color: CommonColors.color_999999,
                      ),
                      textAlign: TextAlign.center,
                    ),
                  ),
                  // 分割线
                  Container(height: 1, color: '#DEDEDE'.toColor()),
                  // 呼叫按钮
                  GestureDetector(
                    onTap: () {
                      Navigator.pop(context);
                      makePhoneCall(phoneNumber);
                    },
                    child: Container(
                      width: double.infinity,
                      padding: const EdgeInsets.symmetric(vertical: 16),
                      child: Text(
                        S.of().chatMessageCall,
                        style: TextStyle(
                          fontSize: 14,
                          color: CommonColors.color_333333,
                          fontWeight: FontWeight.w400,
                        ),
                        textAlign: TextAlign.center,
                      ),
                    ),
                  ),
                  // 分割线
                  Container(height: 1, color: '#DEDEDE'.toColor()),
                  // 复制号码按钮
                  GestureDetector(
                    onTap: () {
                      Navigator.pop(context);
                      copyPhoneNumber(phoneNumber);
                    },
                    child: Container(
                      width: double.infinity,
                      padding: const EdgeInsets.symmetric(vertical: 16),
                      child: Text(
                        S.of().chatMessageCopyNumber,
                        style: TextStyle(
                          fontSize: 14,
                          color: CommonColors.color_333333,
                          fontWeight: FontWeight.w400,
                        ),
                        textAlign: TextAlign.center,
                      ),
                    ),
                  ),
                ],
              ),
            ),
            const SizedBox(height: 8),
            // 取消按钮
            GestureDetector(
              onTap: () {
                Navigator.pop(context);
              },
              child: Container(
                width: double.infinity,
                decoration: BoxDecoration(
                  color: Colors.white,
                  borderRadius: BorderRadius.circular(12),
                ),
                padding: const EdgeInsets.symmetric(vertical: 16),
                child: Text(
                  S.of().messageCancel,
                  style: TextStyle(
                    fontSize: 14,
                    color: CommonColors.color_333333,
                    fontWeight: FontWeight.w400,
                  ),
                  textAlign: TextAlign.center,
                ),
              ),
            ),
            // 底部安全区域
            SizedBox(height: MediaQuery.of(context).padding.bottom),
          ],
        ),
      );
    },
  );
}