import 'package:clean/module/main/main_view.dart';
import 'package:clean/resource/assets.gen.dart';
import 'package:clean/resource/colors.gen.dart';
import 'package:flutter/Material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:lottie/lottie.dart';
import 'package:get/get.dart';
import 'package:clean/router/app_pages.dart';

void photoDeleteFinishDialog( { Function? onDismiss}) {
  const tag = 'photoDeleteFinishDialog';
  // 300ms后关闭弹窗
  Future.delayed(Duration(seconds: 3), () {
    SmartDialog.dismiss(tag: tag);
    if (onDismiss != null) {
      onDismiss();
    }
    // //   回到首页
    // Get.until((route) => Get. currentRoute ==RoutePath.mainTab);


  });
  SmartDialog.show(
      tag: tag,
      backType: SmartBackType.block,
      clickMaskDismiss: false,
      maskColor: ColorName.black,
      builder: (_) {
        return Container(
          height: double.infinity,
          width: double.infinity,
          child: Stack(
            children: [
              Positioned(

                  left: 0,
                  right: 0,
                  child: Column(
                    children: [
                      Column(
                        crossAxisAlignment: CrossAxisAlignment.center,
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: [
                          Lottie.asset(
                            Assets.anim.animFireworks,
                            height: 351.h,
                            repeat: false,
                          ),
                          Text(
                            'Perfect!',
                            textAlign: TextAlign.center,
                            style: TextStyle(
                              color: Colors.white,
                              fontSize: 32.sp,
                              fontWeight: FontWeight.w700,
                            ),
                          ),
                          SizedBox(height: 16.h),
                          SizedBox(
                            child: Row(
                              mainAxisAlignment: MainAxisAlignment.center,
                              children: [
                                Container(
                                  clipBehavior: Clip.antiAlias,
                                  decoration: BoxDecoration(),
                                  child: Assets
                                      .images.iconPreviewSwiperEndFirework
                                      .image(
                                    width: 40.w,
                                    height: 40.w,
                                  ),
                                ),
                                SizedBox(width: 4.w),
                                Text(
                                  'Photos Removed',
                                  textAlign: TextAlign.center,
                                  style: TextStyle(
                                    color: Colors.white.withValues(alpha: 0.8),
                                    fontSize: 16.sp,
                                    fontWeight: FontWeight.w400,
                                  ),
                                ),
                                SizedBox(width: 4.w),
                                Container(
                                  clipBehavior: Clip.antiAlias,
                                  decoration: BoxDecoration(),
                                  child: Assets
                                      .images.iconPreviewSwiperEndFirework
                                      .image(
                                    width: 40.w,
                                    height: 40.w,
                                  ),
                                ),
                              ],
                            ),
                          ),
                        ],
                      ),
                    ],
                  )),
              IgnorePointer(
                child: Assets.images.bgPhotoSelectedPreviewFinish.image(
                  width: 360.w,

                ),
              ),
            ],
          ),
        );
      });
}
