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:location/resource/string.gen.dart';
import 'package:location/utils/common_expand.dart';

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

class NewsReportDialog {
  static const String _tag = 'AccountReplaceDialog';

  static void show() {
    SmartDialog.show(
        builder: (_) => _NewsReportDialogView(),
        tag: _tag,
        clickMaskDismiss: false);
  }

  static void dismiss() {
    SmartDialog.dismiss(tag: _tag);
  }
}

class _NewsReportDialogView extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      width: 274.w,
      decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(16.r),
          border: Border.all(
            color: Colors.white,
            width: 2.w,
          ),
          gradient: LinearGradient(
              begin: Alignment.topCenter,
              end: Alignment.bottomCenter,
              colors: [
                '#E4E4FF'.color,
                '#FFFFFF'.color,
              ])),
      child: Stack(
        alignment: Alignment.center,
        children: [
          // Positioned(
          //     top: 16.w,
          //     right: 16.w,
          //     child: GestureDetector(
          //       onTap: onCloseClick,
          //       child: Assets.images.iconAgreementClose
          //           .image(width: 20.w, height: 20.w),
          //     )),
          buildAccountReplaceContent(),
        ],
      ),
    );
  }

  Widget buildAccountReplaceContent() {
    return IntrinsicHeight(
      child: Column(
        children: [
          SizedBox(height: 33.w),
          Assets.images.iconNewsReportAgree.image(height: 76.w),
          SizedBox(height: 29.w),
          Text("提交成功",
              style: TextStyle(
                  fontSize: 17.sp,
                  color: '#333333'.color,
                  fontWeight: FontWeight.bold)),
          SizedBox(height: 20.w),
          GestureDetector(
            onTap: onKnowClick,
            child: Container(
              width: 229.w,
              height: 43.w,
              decoration: BoxDecoration(
                color: ColorName.colorPrimary,
                borderRadius: BorderRadius.circular(100.r),
              ),
              child: Center(
                child: Text("我知道了",
                    style: TextStyle(
                        fontSize: 14.sp,
                        color: Colors.white,
                        fontWeight: FontWeight.w500)),
              ),
            ),
          ),
          SizedBox(height: 20.w),
        ],
      ),
    );
  }

  void onCloseClick() {
    NewsReportDialog.dismiss();
  }

  void onKnowClick() {
    NewsReportDialog.dismiss();
  }
}

