import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/round_button.dart';

import 'custom_image.dart';
import 'my_appbar.dart';

class ReceivingMethodDialog extends StatefulWidget {
  final int takeType;
  final Function changeTakeType;

  ReceivingMethodDialog(this.takeType,this.changeTakeType);

  @override
  State<StatefulWidget> createState() {
    return _ReceivingMethodDialog();
  }

}

class _ReceivingMethodDialog extends State<ReceivingMethodDialog> {


  Widget build(BuildContext context) {
    return Container(
        alignment:Alignment.bottomCenter,
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.end,
          mainAxisAlignment: MainAxisAlignment.end,
          children: [
            Container(
              margin:
              EdgeInsets.only(top: 26, bottom: 8),
              // alignment: Alignment.center,
              padding: EdgeInsets.only(top: 20,bottom:20),
              decoration: BoxDecoration(
                color: Colors.white,
                boxShadow: [
                  BoxShadow(
                    color: Colors.black.withAlpha(12),
                    offset: Offset(0, 3),
                    blurRadius: 14,
                    spreadRadius: 0,
                  )
                ],
                borderRadius: BorderRadius.all(Radius.circular(8)),
              ),
              child: Column(
                children: [
                  Text(
                    S.of(context).xuanzeshangpinlingqufangshi,
                    style: TextStyle(
                      fontSize: 14.sp,
                      fontWeight: MyFontWeight.regular,
                      color: Color(0xFFA29E9E),
                    ),
                  ),
                  Container(
                    margin: EdgeInsets.only(top:20,bottom: 20),
                    height:1,
                    color:Color(0xFFF4F4F4),
                  ),
                  GestureDetector(
                    onTap:(){
                      widget.changeTakeType(1);
                      Navigator.of(context).pop();
                    },
                    child: Text(
                      S.of(context).ziti,
                      style: TextStyle(
                        fontSize: 16.sp,
                        fontWeight: widget.takeType == 1 ? MyFontWeight.semi_bold : MyFontWeight.medium,
                        color: widget.takeType == 1 ? Color(0xFF32A060):Color(0xFFA29E9E),
                      ),
                    ),
                  ),
                  Container(
                    margin: EdgeInsets.only(top: 20,bottom: 20),
                    height:1,
                    color:Color(0xFFF4F4F4),
                  ),
                  GestureDetector(
                    onTap:(){
                      widget.changeTakeType(2);
                      Navigator.of(context).pop();
                    },
                    child:Text(
                      "物流配送",
                      style: TextStyle(
                        fontSize: 16.sp,
                        fontWeight: widget.takeType == 2 ? MyFontWeight.semi_bold : MyFontWeight.medium,
                        color: widget.takeType == 2 ? Color(0xFF32A060):Color(0xFFA29E9E),
                      ),
                    ),
                  ),
                ],
              ),
            ),
            GestureDetector(
              onTap: (){
                Navigator.of(context).pop();
              },
              child:Container(
                  margin: EdgeInsets.only(top:16),
                  height:68.h,
                  alignment: Alignment.center,
                  decoration: BoxDecoration(
                    borderRadius:
                    BorderRadius.circular(18),
                    color: Color(0xFF32A060),
                  ),
                  child:
                  Text(
                    S.of(context).quxiao,
                    style: TextStyle(
                      fontSize: 18.sp,
                      fontWeight: MyFontWeight.semi_bold,
                      color: Colors.white,
                    ),
                  )
              ),
            ),
          ],
        ),
    );
  }
}