import 'package:flutter/material.dart';

import '../base/YSBase.dart';
import '../generated/l10n.dart';
import '../tools/YSColors.dart';
import '../tools/YSTools.dart';

class YSWalletExportPrivate extends StatefulWidget {
  final Map wallet;
  const YSWalletExportPrivate({Key? key, required this.wallet}) : super(key: key);

  @override
  YSWalletExportPrivateState createState() => YSWalletExportPrivateState();
}

class YSWalletExportPrivateState extends State<YSWalletExportPrivate> {
  @override
  Widget build(BuildContext context) {
    return YSBase(
      isBake: true,
      ysChild: Padding(
        padding: EdgeInsets.only(left: hsp(20),right: hsp(20)),
        child: Column(
          children: [
            Container(
              padding: EdgeInsets.only(top: hsp(20)),
              height: ysHeight(context)-ysTOP(context)-hsp(150),
              child: Align(
                alignment: Alignment.center,
                child: Column(
                  //仅供直接扫描
                  // 维码禁止保存、截图、以及拍照。仅供用户在安全环境下直接扫描来方便地导入钱包
                  // 在安全环境下使用请在确保四周无人及无摄像头的情况下使用。二维码一旦被他人获取将造成无可挽回的资产损失。
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [

                    Align(
                      alignment: Alignment.center,
                      child: SizedBox(
                        height: hsp(200),
                        width: hsp(200),
                        child: YSCodeImage.codeImage(widget.wallet['private']),
                      ),
                    ),
                    Container(
                      width: ysWidth(context),
                      margin: EdgeInsets.only(bottom: hsp(30),top: hsp(20)),
                      decoration: BoxDecoration(
                          color: YSColors.lineColor(context),
                          borderRadius: const BorderRadius.all(Radius.circular(10))
                      ),
                      padding: EdgeInsets.all(hsp(15)),
                      child: Column(
                        children: [
                          Text(S.current.SIYAODIZHI,style: YSColors.contentStyle(context),),
                          Text(widget.wallet['private'],style: YSColors.subStyle(context),textAlign: TextAlign.center,)
                        ],
                      ),
                    ),
                    GestureDetector(
                      onTap: (){
                        YSCopyPaste.copy(widget.wallet['private']);
                      },
                      behavior: HitTestBehavior.opaque,
                      child: Container(
                        margin: EdgeInsets.only(top: hsp(50)),
                        height: hsp(50),
                        alignment: Alignment.center,
                        decoration: BoxDecoration(
                            color: YSColors.buttonColor(context),
                            borderRadius: const BorderRadius.all(Radius.circular(5))
                        ),
                        child: Text(S.current.FUZHI,style: YSColors.buttonStyle(context),),
                      ),
                    )

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