import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';

import '../resource/colors.gen.dart';
import '../resource/string.gen.dart';

showAnalyseSuccessDialog({VoidCallback? onViewClick}) async {
  const String tag = 'showAnalyseSuccessDialog';
  SmartDialog.show(
      tag: tag,
      permanent: true,
      clickMaskDismiss: false,
      usePenetrate: true,
      maskColor: Colors.transparent,
      alignment: const Alignment(0, 0.68),
      builder: (_) => GestureDetector(
            onTap: () {
              onViewClick?.call();
              SmartDialog.dismiss(tag: tag, force: true);
            },
            child: Container(
              decoration: BoxDecoration(
                color: ColorName.black70,
                borderRadius: BorderRadius.circular(8),
              ),
              padding: EdgeInsets.symmetric(horizontal: 18.w, vertical: 8.w),
              child: IntrinsicWidth(
                child: Row(
                  children: [
                    Text(StringName.talkAnalysisSuccess.tr,
                        style:
                            TextStyle(fontSize: 14.sp, color: ColorName.white)),
                    SizedBox(width: 10.w),
                    Container(
                        decoration: BoxDecoration(
                          color: ColorName.colorPrimary,
                          borderRadius: BorderRadius.circular(6),
                        ),
                        padding: EdgeInsets.symmetric(
                            horizontal: 12.w, vertical: 6.w),
                        child: Text(
                          StringName.talkAnalysisSuccessBtnTxt.tr,
                          style: TextStyle(
                              fontSize: 13.sp,
                              color: ColorName.white,
                              height: 1),
                        ))
                  ],
                ),
              ),
            ),
          ));
  await Future.delayed(const Duration(seconds: 5));
  SmartDialog.dismiss(tag: tag, force: true);
}
