customer_dialog.dart 6.5 KB
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:wow_english/route/route.dart';

class CustomerTwoActionDialog extends Dialog {
  const CustomerTwoActionDialog(
      this.title,
      this.leftTitle,
      this.rightTitle,
      this.content,
      this.leftTap,
      this.rightTap, {super.key});
  final String title;
  final String leftTitle;
  final String rightTitle;
  final String content;
  final GestureTapCallback leftTap;
  final GestureTapCallback rightTap;

  @override
  Widget build(BuildContext context) {
    super.build(context);
    return Container(
      height: 208.h,
      alignment: Alignment.center,
      child: ConstrainedBox(
        constraints: BoxConstraints(
          maxHeight: 208.h,
          maxWidth: 307.w
        ),
        child: Container(
          padding: EdgeInsets.symmetric(horizontal: 24.w,vertical: 15.h),
          decoration: BoxDecoration(
              color: Colors.white,
              border: Border.all(
                  color: const Color(0xFF333333),
                  width: 1.5
              ),
              borderRadius: BorderRadius.circular(10.r)
          ),
          child: Column(
            children: [
              Text(
                title,
                textAlign: TextAlign.center,
                style: TextStyle(
                    fontSize: 21.sp,
                    color: const Color(0xFF333333)
                ),
              ),
              Expanded(
                child: Container(
                  alignment: Alignment.center,
                  child: Text(
                      content,
                      textAlign: TextAlign.left,
                      style: TextStyle(
                          color: const Color(0xFF333333),
                          fontSize: 13.sp
                      )
                  ),
                ),
              ),
              Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  TextButton(
                      onPressed: leftTap,
                      child: Container(
                        padding: EdgeInsets.symmetric(
                            horizontal: 6.w,vertical: 2.h
                        ),
                        decoration: BoxDecoration(
                            color: const Color(0xFFFBB661),
                            border: Border.all(
                                color: const Color(0xFF333333),
                                width: 1.5
                            ),
                            borderRadius: BorderRadius.circular(10.r)
                        ),
                        child: Text(
                          leftTitle,
                          textAlign: TextAlign.center,
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: 19.sp
                          ),),
                      )),
                  27.horizontalSpace,
                  TextButton(
                      onPressed: rightTap,
                      child: Container(
                        decoration: BoxDecoration(
                            color: Colors.white,
                            border: Border.all(
                                color: const Color(0xFF333333),
                                width: 1.0
                            ),
                            borderRadius: BorderRadius.circular(10.r)
                        ),
                        padding: EdgeInsets.symmetric(
                            horizontal: 6.w,vertical: 2.h
                        ),
                        alignment: Alignment.center,
                        child: Text(
                          rightTitle,
                          textAlign: TextAlign.center,
                          style: TextStyle(
                              color: const Color(0xFF333333),
                              fontSize: 19.sp
                          ),),
                      ))
                ],
              )
            ],
          ),
        ),
      ),
    );
  }
}

class CustomerOneActionDialog extends Dialog {
  const CustomerOneActionDialog(this.title, this.ensureTitle, this.content, this.ensureTap, {super.key});
  final String title;
  final String ensureTitle;
  final String content;
  final GestureTapCallback ensureTap;

  @override
  Widget build(BuildContext context) {
    super.build(context);
    return Container(
      alignment: Alignment.center,
      child: ConstrainedBox(
        constraints: BoxConstraints(
          maxHeight: 208.h,
          maxWidth: 247.w
        ),
        child: Container(
          padding: EdgeInsets.symmetric(horizontal: 24.w,vertical: 15.h),
          decoration: BoxDecoration(
              color: Colors.white,
              border: Border.all(
                  color: const Color(0xFF333333),
                  width: 1.5
              ),
              borderRadius: BorderRadius.circular(10.r)
          ),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Text(
                title,
                textAlign: TextAlign.center,
                style: TextStyle(
                    fontSize: 21.sp,
                    color: const Color(0xFF333333)
                ),
              ),
              Text(
                  content,
                  textAlign: TextAlign.left,
                  style: TextStyle(
                      color: const Color(0xFF333333),
                      fontSize: 13.sp
                  )
              ),
              TextButton(
                  onPressed: ensureTap,
                  child: Container(
                    height: 31.h,
                    decoration: BoxDecoration(
                        color: Colors.white,
                        border: Border.all(
                            color: const Color(0xFF333333),
                            width: 1.0
                        ),
                        borderRadius: BorderRadius.circular(10.r)
                    ),
                    padding: EdgeInsets.symmetric(
                        horizontal: 6.w
                    ),
                    child: Text(
                      ensureTitle,
                      textAlign: TextAlign.center,
                      style: TextStyle(
                          color: const Color(0xFF333333),
                          fontSize: 19.sp
                      ),),
                  ))
            ],
          ),
        ),
      ),
    );
  }
}