import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:keyboard/data/bean/keyboard_info.dart';

import '../resource/assets.gen.dart';
import '../resource/colors.gen.dart';
import 'content/character_add_tab_view.dart';

class CharacterAddDialog {
  static const String tag = 'CharacterAddDialog';

  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.iconCharacterMarket.image(
                          width: 73.w,
                          height: 25.h,
                        ),
                        GestureDetector(
                          onTap: () {
                            clickCallback();
                            SmartDialog.dismiss();
                          },
                          child: Assets.images.iconDialogCloseBlack.image(
                            width: 24.w,
                            height: 24.w,
                          ),
                        ),
                      ],
                    ),
                    SizedBox(height: 20.h),
                    Expanded(
                      child: CharacterAddTabView(
                        currentKeyboardInfo: currentKeyboardInfo,
                      ),
                    ),
                  ],
                ),
              ),
            ],
          ),
        );
      },
    );
  }
}
