import 'dart:ui';

import 'package:flutter/cupertino.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:keyboard/dialog/custom_character/custom_character_add_view.dart';

import '../../data/bean/keyboard_info.dart';
import '../../resource/assets.gen.dart';
import '../../resource/colors.gen.dart';

class CustomCharacterAddDialog {
  static const String tag = 'CustomCharacterAddDialog';
  static void show({
    required KeyboardInfo currentKeyboardInfo,
    required VoidCallback clickCallback,
  }) {
    SmartDialog.show(
      tag: tag,
      backType: SmartBackType.block,
      clickMaskDismiss: false,
      maskColor: ColorName.black70,
      builder: (_) {
        return SizedBox(
          width: double.infinity,
          height: double.infinity,
          child: Column(
            mainAxisAlignment: MainAxisAlignment.end,
            children: [
              Container(
                padding: EdgeInsets.only(
                  bottom: 28.h,
                  left: 16.w,
                  right: 16.w,
                  top: 22.h,
                ),
                alignment: Alignment.topCenter,
                width: double.infinity,
                height: 712.h,
                decoration: BoxDecoration(
                  color: const Color(0xFFF6F5FA),
                  borderRadius: BorderRadius.circular(20.r),
                ),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  mainAxisAlignment: MainAxisAlignment.start,
                  children: [
                    Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Assets.images.iconCustomCharacterAddMarket.image(
                          width: 68.w,
                          height: 20.h,
                        ),
                        GestureDetector(
                          onTap: () {
                            clickCallback();
                            SmartDialog.dismiss();
                          },
                          child: Assets.images.iconDialogCloseBlack.image(
                            width: 24.w,
                            height: 24.w,
                          ),
                        ),
                      ],
                    ),
                    SizedBox(height: 10.h),
                    Expanded(
                      child: CustomCharacterAddView(
                        currentKeyboardInfo: currentKeyboardInfo,
                      ),
                    ),
                  ],
                ),
              ),
            ],
          ),
        );
      },
    );
  }
}